-
Notifications
You must be signed in to change notification settings - Fork 7.7k
/
bug61548.phpt
129 lines (108 loc) · 2.22 KB
/
bug61548.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
--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
Connection: close
First:1
Second:2
Content-type: text/plain
GET /foo HTTP/1.0
Host: 127.0.0.1:12342
Connection: close
First:1
Second:2
POST / HTTP/1.0
Host: 127.0.0.1:12342
Connection: close
First:1
Second:2
Content-type: text/plain
GET /foo HTTP/1.0
Host: 127.0.0.1:12342
Connection: close
First:1
Second:2
POST / HTTP/1.0
Host: 127.0.0.1:12342
Connection: close
First:1
Second:2
Content-type: text/plain
Third:
GET /foo HTTP/1.0
Host: 127.0.0.1:12342
Connection: close
First:1
Second:2
Third:
POST / HTTP/1.0
Host: 127.0.0.1:12342
Connection: close
First:1
Content-type:text/plain
Second:2
GET /foo HTTP/1.0
Host: 127.0.0.1:12342
Connection: close
First:1
Second:2
POST / HTTP/1.0
Host: 127.0.0.1:12342
Connection: close
First:1
Content-type:text/plain
Second:2
GET /foo HTTP/1.0
Host: 127.0.0.1:12342
Connection: close
First:1
Second:2
POST / HTTP/1.0
Host: 127.0.0.1:12342
Connection: close
First:1
Content-type:text/plain
Second:2
Third:
GET /foo HTTP/1.0
Host: 127.0.0.1:12342
Connection: close
First:1
Second:2
Third:
Done