1--TEST-- 2Bug #48929 (duplicate \r\n sent after last header line) 3--INI-- 4allow_url_fopen=1 5--SKIPIF-- 6<?php require 'server.inc'; http_server_skipif('tcp://127.0.0.1:12342'); ?> 7--FILE-- 8<?php 9require 'server.inc'; 10 11function do_test($context_options) { 12 13 $context = stream_context_create(array('http' => $context_options)); 14 15 $responses = array( 16 "data://text/plain,HTTP/1.0 200 OK\r\n\r\n", 17 ); 18 19 $pid = http_server("tcp://127.0.0.1:12342", $responses, $output); 20 21 foreach($responses as $r) { 22 23 $fd = fopen('http://127.0.0.1:12342/', 'rb', false, $context); 24 25 fseek($output, 0, SEEK_SET); 26 var_dump(stream_get_contents($output)); 27 fseek($output, 0, SEEK_SET); 28 } 29 30 http_server_kill($pid); 31} 32 33echo "-- Test: requests with 'header' as array --\n"; 34 35do_test(array('header' => array('X-Foo: bar', 'Content-Type: text/plain'), 'method' => 'POST', 'content' => 'ohai')); 36 37echo "-- Test: requests with 'header' as string --\n"; 38 39do_test(array('header' => "X-Foo: bar\r\nContent-Type: text/plain", 'method' => 'POST', 'content' => 'ohai')); 40 41?> 42--EXPECT-- 43-- Test: requests with 'header' as array -- 44string(103) "POST / HTTP/1.0 45Host: 127.0.0.1:12342 46Content-Length: 4 47X-Foo: bar 48Content-Type: text/plain 49 50ohai" 51-- Test: requests with 'header' as string -- 52string(103) "POST / HTTP/1.0 53Host: 127.0.0.1:12342 54Content-Length: 4 55X-Foo: bar 56Content-Type: text/plain 57 58ohai" 59