summaryrefslogtreecommitdiff
path: root/ext/standard/tests/http/bug80838.phpt
blob: 2b81e042bba578841bba47fe65cc0a2a48851493 (plain)
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
--TEST--
Bug #80838 (HTTP wrapper waits for HTTP 1 response after HTTP 101)
--INI--
allow_url_fopen=1
--SKIPIF--
<?php require 'server.inc'; http_server_skipif('tcp://127.0.0.1:12342'); ?>
--FILE--
<?php
require 'server.inc';

$responses = [
  "data://text/plain,HTTP/1.1 101 Switching Protocols\r\nHeader1: Value1\r\nHeader2: Value2\r\n\r\n"
    . "Hello from another protocol"
];

$pid = http_server('tcp://127.0.0.1:12342', $responses);

$options = [
  'http' => [
    'ignore_errors' => true
  ],
];

$ctx = stream_context_create($options);

$fd = fopen('http://127.0.0.1:12342/', 'rb', false, $ctx);
fclose($fd);
var_dump($http_response_header);

http_server_kill($pid);

?>
--EXPECT--
array(3) {
  [0]=>
  string(32) "HTTP/1.1 101 Switching Protocols"
  [1]=>
  string(15) "Header1: Value1"
  [2]=>
  string(15) "Header2: Value2"
}