mahara-contributors team mailing list archive
-
mahara-contributors team
-
Mailing list archive
-
Message #11106
Re: [Bug 1080352] Re: mahara_http_request function doesn't returns request data (should split header and body)
Hugh, you're absolutely right...
To clarify my situation a bit. A recently discovered mahara_http_request
function (maybe had known about it eralier, but forgot...). So I'm trying
to get rid of all the dependant libraries for cloud plugin, because
mahara_http_request does it all, though slightly different.
Most of the time I only need to know if the request response code equals
200 (is OK). But when dealing with OAuth 1.0 authentication and getting the
access token, this is returned in the body of response. The function
mahara_http_request returna everything (header and body) as data. Upon
further inspection I just discovered that header_size is already returned
as part of info. So there's really nothing to do, but to delete this bug
and I'll change my code accordingly (parse that response on my end ;).
Thanks, Gregor
2012/11/18 Hugh Davenport <1080352@xxxxxxxxxxxxxxxxxx>
> 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 subscribed to the bug
> report.
> 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
>
--
----------
Gregor Anželj, prof.
Gimnazija Bežigrad, Ljubljana
--
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:
Incomplete
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
References