Mercurial > hg > nginx-tests
annotate http_headers_multi.t @ 1990:85d88cd5091c
Tests: SSI include stub tests.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 04 Jul 2024 17:42:55 +0300 |
parents | a095b971fbcc |
children |
rev | line source |
---|---|
1766
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
2 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
3 # (C) Maxim Dounin |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
4 # (C) Nginx, Inc. |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
5 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
6 # Tests for handling of multiple http headers and access via variables. |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
7 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
8 ############################################################################### |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
9 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
10 use warnings; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
11 use strict; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
12 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
13 use Test::More; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
14 use Socket qw/ CRLF /; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
15 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
16 BEGIN { use FindBin; chdir($FindBin::Bin); } |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
17 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
18 use lib 'lib'; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
19 use Test::Nginx; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
20 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
21 ############################################################################### |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
22 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
23 select STDERR; $| = 1; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
24 select STDOUT; $| = 1; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
25 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
26 my $t = Test::Nginx->new()->has(qw/http rewrite proxy/)->plan(42); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
27 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
28 $t->write_file_expand('nginx.conf', <<'EOF'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
29 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
30 %%TEST_GLOBALS%% |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
31 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
32 daemon off; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
33 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
34 events { |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
35 } |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
36 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
37 http { |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
38 %%TEST_GLOBALS_HTTP%% |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
39 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
40 server { |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
41 listen 127.0.0.1:8080; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
42 server_name localhost; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
43 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
44 location / { |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
45 add_header X-Forwarded-For $http_x_forwarded_for; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
46 add_header X-Cookie $http_cookie; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
47 add_header X-Foo $http_foo; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
48 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
49 add_header X-Cookie-Foo $cookie_foo; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
50 add_header X-Cookie-Bar $cookie_bar; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
51 add_header X-Cookie-Bazz $cookie_bazz; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
52 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
53 return 204; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
54 } |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
55 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
56 location /s { |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
57 add_header Cache-Control foo; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
58 add_header Cache-Control bar; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
59 add_header Cache-Control bazz; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
60 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
61 add_header Link foo; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
62 add_header Link bar; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
63 add_header Link bazz; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
64 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
65 add_header Foo foo; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
66 add_header Foo bar; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
67 add_header Foo bazz; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
68 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
69 add_header X-Sent-CC $sent_http_cache_control; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
70 add_header X-Sent-Link $sent_http_link; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
71 add_header X-Sent-Foo $sent_http_foo; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
72 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
73 return 204; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
74 } |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
75 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
76 location /t { |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
77 add_trailer Foo foo; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
78 add_trailer Foo bar; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
79 add_trailer Foo bazz; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
80 add_trailer X-Sent-Trailer-Foo $sent_trailer_foo; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
81 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
82 return 200 ""; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
83 } |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
84 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
85 location /v { |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
86 add_header X-Forwarded-For $http_x_forwarded_for; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
87 add_header X-Cookie $http_cookie; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
88 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
89 add_header X-HTTP-Host $http_host; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
90 add_header X-User-Agent $http_user_agent; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
91 add_header X-Referer $http_referer; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
92 add_header X-Via $http_via; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
93 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
94 add_header X-Content-Length $content_length; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
95 add_header X-Content-Type $content_type; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
96 add_header X-Host $host; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
97 add_header X-Remote-User $remote_user; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
98 |
1960
e44ee916b959
Tests: adjusted http_headers_multi.t for $content_length changes.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1766
diff
changeset
|
99 proxy_pass http://127.0.0.1:8080/backend; |
1766
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
100 } |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
101 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
102 location /d { |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
103 return 204; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
104 } |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
105 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
106 location /u { |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
107 add_header X-Upstream-Set-Cookie $upstream_http_set_cookie; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
108 add_header X-Upstream-Bar $upstream_http_bar; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
109 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
110 add_header X-Upstream-Cookie-Foo $upstream_cookie_foo; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
111 add_header X-Upstream-Cookie-Bar $upstream_cookie_bar; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
112 add_header X-Upstream-Cookie-Bazz $upstream_cookie_bazz; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
113 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
114 proxy_pass http://127.0.0.1:8080/backend; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
115 } |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
116 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
117 location /backend { |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
118 add_header Set-Cookie foo=1; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
119 add_header Set-Cookie bar=2; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
120 add_header Set-Cookie bazz=3; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
121 add_header Bar foo; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
122 add_header Bar bar; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
123 add_header Bar bazz; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
124 return 204; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
125 } |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
126 } |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
127 } |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
128 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
129 EOF |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
130 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
131 $t->run(); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
132 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
133 ############################################################################### |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
134 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
135 # combining multiple headers: |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
136 # |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
137 # $http_cookie, $http_x_forwarded_for, $sent_http_cache_control, |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
138 # and $sent_http_link with special handling, other headers with |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
139 # general handling |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
140 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
141 # request headers, $http_* |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
142 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
143 like(get('/', map { "X-Forwarded-For: $_" } qw/ foo bar bazz /), |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
144 qr/X-Forwarded-For: foo, bar, bazz/, 'multi $http_x_forwarded_for'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
145 like(get('/', 'Cookie: foo=1', 'Cookie: bar=2', 'Cookie: bazz=3'), |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
146 qr/X-Cookie: foo=1; bar=2; bazz=3/, 'multi $http_cookie'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
147 like(get('/', 'Foo: foo', 'Foo: bar', 'Foo: bazz'), |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
148 qr/X-Foo: foo, bar, bazz/, 'multi $http_foo'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
149 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
150 # request cookies, $cookie_* |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
151 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
152 my $r = get('/', 'Cookie: foo=1', 'Cookie: bar=2', 'Cookie: bazz=3'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
153 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
154 like($r, qr/X-Cookie-Foo: 1/, '$cookie_foo'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
155 like($r, qr/X-Cookie-Bar: 2/, '$cookie_bar'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
156 like($r, qr/X-Cookie-Bazz: 3/, '$cookie_bazz'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
157 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
158 # response headers, $http_* |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
159 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
160 $r = get('/s'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
161 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
162 like($r, qr/X-Sent-CC: foo, bar, bazz/, 'multi $sent_http_cache_control'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
163 like($r, qr/X-Sent-Link: foo, bar, bazz/, 'multi $sent_http_link'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
164 like($r, qr/X-Sent-Foo: foo, bar, bazz/, 'multi $sent_http_foo'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
165 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
166 # upstream response headers, $upstream_http_* |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
167 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
168 $r = get('/u'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
169 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
170 like($r, qr/X-Upstream-Set-Cookie: foo=1, bar=2, bazz=3/, |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
171 'multi $upstream_http_set_cookie'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
172 like($r, qr/X-Upstream-Bar: foo, bar, bazz/, 'multi $upstream_http_bar'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
173 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
174 # upstream response cookies, $upstream_cookie_* |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
175 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
176 like($r, qr/X-Upstream-Cookie-Foo: 1/, '$upstream_cookie_foo'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
177 like($r, qr/X-Upstream-Cookie-Bar: 2/, '$upstream_cookie_bar'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
178 like($r, qr/X-Upstream-Cookie-Bazz: 3/, '$upstream_cookie_bazz'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
179 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
180 # response trailers, $sent_trailer_* |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
181 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
182 like(get('/t'), qr/X-Sent-Trailer-Foo: foo, bar, bazz/, |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
183 'multi $sent_trailer_foo'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
184 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
185 # various variables for request headers: |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
186 # |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
187 # $http_host, $http_user_agent, $http_referer |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
188 # multiple Host, User-Agent, Referer headers are invalid, but we currently |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
189 # reject only requests with multiple Host headers |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
190 # |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
191 # $http_via, $http_x_forwarded_for, $http_cookie |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
192 # multiple headers are valid |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
193 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
194 like(get('/v'), qr/X-HTTP-Host: localhost/, '$http_host'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
195 like(get('/v', 'Host: foo', 'Host: bar'), |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
196 qr/400 Bad/, 'duplicate host rejected'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
197 like(get('/v', 'User-Agent: foo', 'User-Agent: bar'), |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
198 qr/X-User-Agent: foo, bar/, 'multi $http_user_agent (invalid)'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
199 like(get('/v', 'Referer: foo', 'Referer: bar'), |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
200 qr/X-Referer: foo, bar/, 'multi $http_referer (invalid)'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
201 like(get('/v', 'Via: foo', 'Via: bar', 'Via: bazz'), |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
202 qr/X-Via: foo, bar, bazz/, 'multi $http_via'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
203 like(get('/v', 'Cookie: foo', 'Cookie: bar', 'Cookie: bazz'), |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
204 qr/X-Cookie: foo; bar; bazz/, 'multi $http_cookie'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
205 like(get('/v', 'X-Forwarded-For: foo', 'X-Forwarded-For: bar', |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
206 'X-Forwarded-For: bazz'), |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
207 qr/X-Forwarded-For: foo, bar, bazz/, 'multi $http_x_forwarded_for'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
208 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
209 # other variables related to request headers: |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
210 # |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
211 # $content_length, $content_type, $host, $remote_user |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
212 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
213 like(get('/v', 'Content-Length: 0'), |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
214 qr/X-Content-Length: 0/, '$content_length'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
215 like(get('/v', 'Content-Length: 0', 'Content-Length: 0'), |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
216 qr/400 Bad/, 'duplicate Content-Length rejected'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
217 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
218 like(get('/v', 'Content-Type: foo'), |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
219 qr/X-Content-Type: foo/, '$content_type'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
220 like(get('/v', 'Content-Type: foo', 'Content-Type: bar'), |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
221 qr/X-Content-Type: foo, bar/, 'multi $content_type (invalid)'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
222 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
223 like(http("GET /v HTTP/1.0" . CRLF . CRLF), |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
224 qr/X-Host: localhost/, '$host from server_name'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
225 like(http("GET /v HTTP/1.0" . CRLF . "Host: foo" . CRLF . CRLF), |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
226 qr/X-Host: foo/, '$host'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
227 like(http("GET /v HTTP/1.0" . CRLF . "Host: foo" . CRLF . |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
228 "Host: bar" . CRLF . CRLF), |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
229 qr/400 Bad/, 'duplicate host rejected'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
230 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
231 like(get('/v', 'Authorization: Basic dXNlcjpzZWNyZXQ='), |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
232 qr/X-Remote-User: user/, '$remote_user'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
233 like(get('/v', 'Authorization: Basic dXNlcjpzZWNyZXQ=', |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
234 'Authorization: Basic dXNlcjpzZWNyZXQ='), |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
235 qr/400 Bad/, 'duplicate authorization rejected'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
236 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
237 # request headers required to be unique: |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
238 # |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
239 # Host, If-Modified-Since, If-Unmodified-Since, If-Match, If-None-Match, |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
240 # Content-Length, Content-Range, If-Range, Transfer-Encoding, Expect, |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
241 # Authorization |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
242 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
243 like(get('/d', 'Host: foo', 'Host: bar'), |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
244 qr/400 Bad/, 'duplicate Host rejected'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
245 like(get('/d', 'If-Modified-Since: foo', 'If-Modified-Since: bar'), |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
246 qr/400 Bad/, 'duplicate If-Modified-Since rejected'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
247 like(get('/d', 'If-Unmodified-Since: foo', 'If-Unmodified-Since: bar'), |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
248 qr/400 Bad/, 'duplicate If-Unmodified-Since rejected'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
249 like(get('/d', 'If-Match: foo', 'If-Match: bar'), |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
250 qr/400 Bad/, 'duplicate If-Match rejected'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
251 like(get('/d', 'If-None-Match: foo', 'If-None-Match: bar'), |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
252 qr/400 Bad/, 'duplicate If-None-Match rejected'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
253 like(get('/d', 'Content-Length: 0', 'Content-Length: 0'), |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
254 qr/400 Bad/, 'duplicate Content-Length rejected'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
255 like(get('/d', 'Content-Range: foo', 'Content-Range: bar'), |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
256 qr/400 Bad/, 'duplicate Content-Range rejected'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
257 like(get('/d', 'If-Range: foo', 'If-Range: bar'), |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
258 qr/400 Bad/, 'duplicate If-Range rejected'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
259 like(get('/d', 'Transfer-Encoding: foo', 'Transfer-Encoding: bar'), |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
260 qr/400 Bad/, 'duplicate Transfer-Encoding rejected'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
261 like(get('/d', 'Expect: foo', 'Expect: bar'), |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
262 qr/400 Bad/, 'duplicate Expect rejected'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
263 like(get('/d', 'Authorization: foo', 'Authorization: bar'), |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
264 qr/400 Bad/, 'duplicate Authorization rejected'); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
265 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
266 ############################################################################### |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
267 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
268 sub get { |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
269 my ($url, @headers) = @_; |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
270 return http( |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
271 "GET $url HTTP/1.1" . CRLF . |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
272 'Host: localhost' . CRLF . |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
273 'Connection: close' . CRLF . |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
274 join(CRLF, @headers) . CRLF . CRLF |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
275 ); |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
276 } |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
277 |
a2572de6e840
Tests: tests for various http header variables.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
278 ############################################################################### |