Test Failure Report for ext/standard/tests/http/bug48929.phpt ('Bug #48929 (duplicate \r\n sent after last header line)')
Script
1:
<?php 2: require 'server.inc'; 3: 4: function do_test($context_options) { 5: 6: $context = stream_context_create(array('http' => $context_options)); 7: 8: $responses = array( 9: "data://text/plain,HTTP/1.0 200 OK\r\n\r\n", 10: ); 11: 12: $pid = http_server("tcp://127.0.0.1:12342", $responses, $output); 13: 14: foreach($responses as $r) { 15: 16: $fd = fopen('http://127.0.0.1:12342/', 'rb', false, $context); 17: 18: fseek($output, 0, SEEK_SET); 19: var_dump(stream_get_contents($output)); 20: fseek($output, 0, SEEK_SET); 21: } 22: 23: http_server_kill($pid); 24: } 25: 26: echo "-- Test: requests with 'header' as array --\n"; 27: 28: do_test(array('header' => array('X-Foo: bar', 'Content-Type: text/plain'), 'method' => 'POST', 'content' => 'ohai')); 29: 30: echo "-- Test: requests with 'header' as string --\n"; 31: 32: do_test(array('header' => "X-Foo: bar\r\nContent-Type: text/plain", 'method' => 'POST', 'content' => 'ohai')); 33: 34: ?> 35:
Expected
-- Test: requests with 'header' as array --
string(103) "POST / HTTP/1.0
Host: 127.0.0.1:12342
Content-Length: 4
X-Foo: bar
Content-Type: text/plain
ohai"
-- Test: requests with 'header' as string --
string(103) "POST / HTTP/1.0
Host: 127.0.0.1:12342
Content-Length: 4
X-Foo: bar
Content-Type: text/plain
ohai"
Output
-- Test: requests with 'header' as array --
string(0) ""
-- Test: requests with 'header' as string --
string(0) ""
Diff
002+ string(0) ""
002- string(103) "POST / HTTP/1.0
003- Host: 127.0.0.1:12342
004- Content-Length: 4
005- X-Foo: bar
006- Content-Type: text/plain
007-
008- ohai"
004+ string(0) ""
010- string(103) "POST / HTTP/1.0
011- Host: 127.0.0.1:12342
012- Content-Length: 4
013- X-Foo: bar
014- Content-Type: text/plain
015-
016- ohai"
Generated at Tue, 21 May 2013 17:04:51 +0000 (15 hours ago)
|