-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix curl_copy_handle() with CURLINFO_HEADER_OUT
The CURLOPT_DEBUGDATA will point to the old curl handle after copying. Update it to point to the new handle. We don't separately store whether CURLINFO_HEADER_OUT is enabled, so I'm doing this unconditionally. It should be harmless if CURLOPT_DEBUGFUNCTION is not used.
- Loading branch information
Showing
2 changed files
with
30 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--TEST-- | ||
Test curl_copy_handle() with CURLINFO_HEADER_OUT | ||
--SKIPIF-- | ||
<?php include 'skipif.inc'; ?> | ||
--FILE-- | ||
<?php | ||
include 'server.inc'; | ||
$host = curl_cli_server_start(); | ||
|
||
$url = "{$host}/get.inc"; | ||
$ch = curl_init($url); | ||
|
||
curl_setopt($ch, CURLINFO_HEADER_OUT, 1); | ||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | ||
$ch2 = curl_copy_handle($ch); | ||
echo curl_exec($ch), PHP_EOL; | ||
var_dump(strstr(curl_getinfo($ch, CURLINFO_HEADER_OUT), "\r", true)); | ||
unset($ch); | ||
echo curl_exec($ch2), PHP_EOL; | ||
var_dump(strstr(curl_getinfo($ch2, CURLINFO_HEADER_OUT), "\r", true)); | ||
|
||
?> | ||
--EXPECT-- | ||
Hello World! | ||
Hello World! | ||
string(21) "GET /get.inc HTTP/1.1" | ||
Hello World! | ||
Hello World! | ||
string(21) "GET /get.inc HTTP/1.1" |