forked from sabre-io/http
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce memory footprint when parsing HTTP result
In order to resolve sabre-io#82 to avoid additional memory copy of response body (from $response to $responseBody), We deperecated `parseCurlResult` method which use `substr` function to separate HTTP headers and body and create new method `parseCurlResponse` instead. We register `receiveCurlHeader` method as callback function by curl_setopt using `CURLOPT_HEADERFUNCTION` option. This changes is not intended to resolve issue sabre-io#15 See sabre-io#115 (comment)
- Loading branch information
Gasol Wu
committed
Dec 14, 2018
1 parent
bc1743a
commit 3d2f720
Showing
3 changed files
with
137 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
$data = str_repeat('x', 32 * 1024 * 1024); | ||
header('Content-Length: '.strlen($data)); | ||
header('Content-Type: text/plain'); | ||
|
||
echo $data; |