release 1.7.6
[m6w6/ext-http] / tests / parse_message_004.phpt
1 --TEST--
2 http_parse_message() recursive
3 --SKIPIF--
4 <?php
5 include 'skip.inc';
6 ?>
7 --FILE--
8 <?php
9
10 echo "-TEST\n";
11 $message =
12 "HEAD / HTTP/1.1
13 Host: www.example.com
14 Accept: */*
15 HTTP/1.1 200 Ok
16 Server: Funky/1.0
17 Content-Length: 10
18 GET / HTTP/1.1
19 Host: www.example.com
20 Accept: */*
21 HTTP/1.1 200 Ok
22 Server: Funky/1.0
23 Content-Length: 10
24
25 1234567890
26 ";
27
28 var_dump(http_parse_message($message));
29
30 echo "Done\n";
31 ?>
32 --EXPECTF--
33 %aTEST
34 object(stdClass)%a {
35 ["type"]=>
36 int(2)
37 ["httpVersion"]=>
38 float(1.1)
39 ["responseCode"]=>
40 int(200)
41 ["responseStatus"]=>
42 string(2) "Ok"
43 ["headers"]=>
44 array(2) {
45 ["Server"]=>
46 string(9) "Funky/1.0"
47 ["Content-Length"]=>
48 string(2) "10"
49 }
50 ["body"]=>
51 string(10) "1234567890"
52 ["parentMessage"]=>
53 object(stdClass)%a {
54 ["type"]=>
55 int(1)
56 ["httpVersion"]=>
57 float(1.1)
58 ["requestMethod"]=>
59 string(3) "GET"
60 ["requestUrl"]=>
61 string(1) "/"
62 ["headers"]=>
63 array(2) {
64 ["Host"]=>
65 string(15) "www.example.com"
66 ["Accept"]=>
67 string(3) "*/*"
68 }
69 ["body"]=>
70 string(0) ""
71 ["parentMessage"]=>
72 object(stdClass)%a {
73 ["type"]=>
74 int(2)
75 ["httpVersion"]=>
76 float(1.1)
77 ["responseCode"]=>
78 int(200)
79 ["responseStatus"]=>
80 string(2) "Ok"
81 ["headers"]=>
82 array(2) {
83 ["Server"]=>
84 string(9) "Funky/1.0"
85 ["Content-Length"]=>
86 string(2) "10"
87 }
88 ["body"]=>
89 string(0) ""
90 ["parentMessage"]=>
91 object(stdClass)%a {
92 ["type"]=>
93 int(1)
94 ["httpVersion"]=>
95 float(1.1)
96 ["requestMethod"]=>
97 string(4) "HEAD"
98 ["requestUrl"]=>
99 string(1) "/"
100 ["headers"]=>
101 array(2) {
102 ["Host"]=>
103 string(15) "www.example.com"
104 ["Accept"]=>
105 string(3) "*/*"
106 }
107 ["body"]=>
108 string(0) ""
109 ["parentMessage"]=>
110 NULL
111 }
112 }
113 }
114 }
115 Done