|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-10-01 09:13 UTC] mike@php.net
[2013-10-01 09:13 UTC] mike@php.net
-Status: Open
+Status: Closed
[2014-10-07 23:17 UTC] stas@php.net
[2014-10-07 23:28 UTC] stas@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 09 04:00:01 2025 UTC |
Description: ------------ Line 445 of http_fopen_wrapper.c only works of the content-type is at the end of a list of header fields in the context. It fails if it is in the middle, or the beginning. memmove(tmp, tmp + (s2 + 1 - tmp_c), tmp_c + l - 1 - s2); To see the problem watch the HTTP stream in something like WireShark. Test script: --------------- <?php $http = array( 'header' => null ."AnyHeader: 1\r\n" // BUG on line 445 of http_fopen_wrapper.c of PHP: content_type cannot be in the middle of headers. ."Content-type: anythingyouwanthere\r\n" ."SomeOtherHeader: 2\r\n" ); /* PHP incorrectly sends across when following the "Location": GET /services/storm/lead HTTP/1.0 Host: storm SomeOtherHeader: 2ent-type: anythingyouwanthere SomeOtherHeader: 2 */ $http['method'] = 'POST'; $options = array('http' => $http); $context = stream_context_create($options); $result = file_get_contents('http://some/url/that/resturns/201/and/has/a/Location/in/the/header', false, $context); Expected result: ---------------- GET /services/storm/lead HTTP/1.0 Host: storm AnyHeader: 1 SomeOtherHeader: 2 Actual result: -------------- GET /services/storm/lead HTTP/1.0 Host: storm SomeOtherHeader: 2ent-type: anythingyouwanthere SomeOtherHeader: 2