PHP  
 PHP_5_4
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Test Failure Report for ext/standard/tests/http/bug61548.phpt ('Bug #61548 (content-type must appear at the end of headers)')

Script

1: <?php
2:
require 'server.inc';
3:
4: function 
do_test($header) {
5:     
$options = [
6:         
'http' => [
7:             
'method' => 'POST',
8:             
'header' => $header,
9:             
'follow_location' => true,
10:         ],
11:     ];
12:
13:     
$ctx stream_context_create($options);
14:
15:     
$responses = [
16:         
"data://text/plain,HTTP/1.1 201\r\nLocation: /foo\r\n\r\n",
17:         
"data://text/plain,HTTP/1.1 200\r\nConnection: close\r\n\r\n",
18:     ];
19:     
$pid http_server('tcp://127.0.0.1:12342'$responses$output);
20:
21:     
$fd fopen('http://127.0.0.1:12342/''rb'false$ctx);
22:     
fseek($output0SEEK_SET);
23:     echo 
stream_get_contents($output);
24:
25:     
http_server_kill($pid);
26: }
27:
28:
do_test("First:1\nSecond:2\nContent-type: text/plain");
29:
do_test("First:1\nSecond:2\nContent-type: text/plain\n");
30:
do_test("First:1\nSecond:2\nContent-type: text/plain\nThird:");
31:
do_test("First:1\nContent-type:text/plain\nSecond:2");
32:
do_test("First:1\nContent-type:text/plain\nSecond:2\n");
33:
do_test("First:1\nContent-type:text/plain\nSecond:2\nThird:");
34:
35:
?>
36:
Done
37:

Expected

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

Output

Done

Diff

001+ Done
001- POST / HTTP/1.0
002- Host: 127.0.0.1:12342
003- First:1
004- Second:2
005- Content-type: text/plain
006- 
007- GET /foo HTTP/1.0
008- Host: 127.0.0.1:12342
009- First:1
010- Second:2
011- 
012- 
013- POST / HTTP/1.0
014- Host: 127.0.0.1:12342
015- First:1
016- Second:2
017- Content-type: text/plain
018- 
019- GET /foo HTTP/1.0
020- Host: 127.0.0.1:12342
021- First:1
022- Second:2
023- 
024- 
025- POST / HTTP/1.0
026- Host: 127.0.0.1:12342
027- First:1
028- Second:2
029- Content-type: text/plain
030- Third:
031- 
032- GET /foo HTTP/1.0
033- Host: 127.0.0.1:12342
034- First:1
035- Second:2
036- Third:
037- 
038- POST / HTTP/1.0
039- Host: 127.0.0.1:12342
040- First:1
041- Content-type:text/plain
042- Second:2
043- 
044- GET /foo HTTP/1.0
045- Host: 127.0.0.1:12342
046- First:1
047- Second:2
048- 
049- POST / HTTP/1.0
050- Host: 127.0.0.1:12342
051- First:1
052- Content-type:text/plain
053- Second:2
054- 
055- GET /foo HTTP/1.0
056- Host: 127.0.0.1:12342
057- First:1
058- Second:2
059- 
060- POST / HTTP/1.0
061- Host: 127.0.0.1:12342
062- First:1
063- Content-type:text/plain
064- Second:2
065- Third:
066- 
067- GET /foo HTTP/1.0
068- Host: 127.0.0.1:12342
069- First:1
070- Second:2
071- Third:
072- 
073- Done

 

Generated at Mon, 15 Dec 2014 17:02:57 +0000 (2 days ago)

Copyright © 2005-2014 The PHP Group
All rights reserved.