← Back to team overview

mahara-contributors team mailing list archive

[Bug 1080352] Re: mahara_http_request function doesn't returns request data (should split header and body)

 

Hi Gregor,

>From a performance point of view, I would avoid this and instead just
add the header_size to the result class. Then you can parse the body
into the 2 parts in the place you need it.

Even better, add all the usefule info stuff from
http://php.net/manual/en/function.curl-getinfo.php, though what is
useful in there is up for opinion...

The way you have it, it is essentially doubling the memory requirements
for every request.

Cheers,

Hugh

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
https://bugs.launchpad.net/bugs/1080352

Title:
  mahara_http_request function doesn't returns request data (should
  split header and body)

Status in Mahara ePortfolio:
  New

Bug description:
  When using mahara_http_request function (lib/web.php) it returns the response of request in the following format:
      $result = new StdClass();
      $result->data = curl_exec($ch);
      $result->info = curl_getinfo($ch);
      $result->error = curl_error($ch);
      $result->errno = curl_errno($ch);

  It would be very useful to separate or split data part into header and
  body parts, like:

      $result = new StdClass();
      $result->data = curl_exec($ch);
      // Parse out header and body
      $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
      $result->header = substr($result->data, 0, $header_size);
      $result->body = substr($result->data, $header_size);
      $result->info = curl_getinfo($ch);
      $result->error = curl_error($ch);
      $result->errno = curl_errno($ch);

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1080352/+subscriptions


Follow ups

References