diff options
author | Michael Wallner <mike@php.net> | 2013-10-01 11:11:48 +0200 |
---|---|---|
committer | Michael Wallner <mike@php.net> | 2013-10-01 11:11:48 +0200 |
commit | d29a01de3f35a33c539a805e28a22a6514924a19 (patch) | |
tree | 2e094fcc1f2e2bc6426ab8ba96a94c1b8d28477b /ext/standard/tests/http | |
parent | 66cd9ef04cf20ead3db58f0bb387bb2070dbc591 (diff) | |
parent | ad139d9a00d9de206c7aae4f85eff08eff2c429e (diff) | |
download | php-git-d29a01de3f35a33c539a805e28a22a6514924a19.tar.gz |
Merge branch 'PHP-5.5'
* PHP-5.5:
Fixed bug #61548
Conflicts:
ext/standard/http_fopen_wrapper.c
Diffstat (limited to 'ext/standard/tests/http')
-rw-r--r-- | ext/standard/tests/http/bug61548.phpt | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/ext/standard/tests/http/bug61548.phpt b/ext/standard/tests/http/bug61548.phpt new file mode 100644 index 0000000000..138b15a338 --- /dev/null +++ b/ext/standard/tests/http/bug61548.phpt @@ -0,0 +1,118 @@ +--TEST-- +Bug #61548 (content-type must appear at the end of headers) +--INI-- +allow_url_fopen=1 +--SKIPIF-- +<?php require 'server.inc'; http_server_skipif('tcp://127.0.0.1:12342'); ?> +--FILE-- +<?php +require 'server.inc'; + +function do_test($header) { + $options = [ + 'http' => [ + 'method' => 'POST', + 'header' => $header, + 'follow_location' => true, + ], + ]; + + $ctx = stream_context_create($options); + + $responses = [ + "data://text/plain,HTTP/1.1 201\r\nLocation: /foo\r\n\r\n", + "data://text/plain,HTTP/1.1 200\r\nConnection: close\r\n\r\n", + ]; + $pid = http_server('tcp://127.0.0.1:12342', $responses, $output); + + $fd = fopen('http://127.0.0.1:12342/', 'rb', false, $ctx); + fseek($output, 0, SEEK_SET); + echo stream_get_contents($output); + + http_server_kill($pid); +} + +do_test("First:1\nSecond:2\nContent-type: text/plain"); +do_test("First:1\nSecond:2\nContent-type: text/plain\n"); +do_test("First:1\nSecond:2\nContent-type: text/plain\nThird:"); +do_test("First:1\nContent-type:text/plain\nSecond:2"); +do_test("First:1\nContent-type:text/plain\nSecond:2\n"); +do_test("First:1\nContent-type:text/plain\nSecond:2\nThird:"); + +?> +Done +--EXPECT-- +POST / HTTP/1.0 +Host: 127.0.0.1:12342 +First:1 +Second:2 +Content-type: text/plain + +GET /foo HTTP/1.0 +Host: 127.0.0.1:12342 +First:1 +Second:2 + + +POST / HTTP/1.0 +Host: 127.0.0.1:12342 +First:1 +Second:2 +Content-type: text/plain + +GET /foo HTTP/1.0 +Host: 127.0.0.1:12342 +First:1 +Second:2 + + +POST / HTTP/1.0 +Host: 127.0.0.1:12342 +First:1 +Second:2 +Content-type: text/plain +Third: + +GET /foo HTTP/1.0 +Host: 127.0.0.1:12342 +First:1 +Second:2 +Third: + +POST / HTTP/1.0 +Host: 127.0.0.1:12342 +First:1 +Content-type:text/plain +Second:2 + +GET /foo HTTP/1.0 +Host: 127.0.0.1:12342 +First:1 +Second:2 + +POST / HTTP/1.0 +Host: 127.0.0.1:12342 +First:1 +Content-type:text/plain +Second:2 + +GET /foo HTTP/1.0 +Host: 127.0.0.1:12342 +First:1 +Second:2 + +POST / HTTP/1.0 +Host: 127.0.0.1:12342 +First:1 +Content-type:text/plain +Second:2 +Third: + +GET /foo HTTP/1.0 +Host: 127.0.0.1:12342 +First:1 +Second:2 +Third: + +Done + |