annotate proxy_unix.t @ 1961:fe6f22da53ec default tip

Tests: tests for usage of discarded body. The client_max_body_size limit should be ignored when the request body is already discarded. In HTTP/1.x, this is done by checking the r->discard_body flag when the body is being discarded, and because r->headers_in.content_length_n is 0 when it's already discarded. This, however, does not happen with HTTP/2 and HTTP/3, and therefore "error_page 413" does not work without relaxing the limit. Further, with proxy_pass, r->headers_in.content_length_n is used to determine length of the request body, and therefore is not correct if discarding of the request body isn't yet complete. While discarding the request body, r->headers_in.content_length_n contains the rest of the body to discard (or, in case of chunked request body, the rest of the current chunk to discard). Similarly, the $content_length variable uses r->headers_in.content_length if available, and also incorrect. The $content_length variable is used when proxying with fastcgi_pass, grpc_pass, and uwsgi_pass (scgi_pass uses the value calculated based on the actual request body buffers, and therefore works correctly).
author Maxim Dounin <mdounin@mdounin.ru>
date Sat, 27 Apr 2024 18:55:50 +0300
parents 882267679006
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
798
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1 #!/usr/bin/perl
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3 # (C) Maxim Dounin
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4 # (C) Sergey Kandaurov
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
5 # (C) Nginx, Inc.
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
6
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
7 # Tests for http proxy module with unix socket.
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
8
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
9 ###############################################################################
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
10
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
11 use warnings;
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
12 use strict;
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
13
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
14 use Test::More;
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
15
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
16 BEGIN { use FindBin; chdir($FindBin::Bin); }
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
17
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
18 use lib 'lib';
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
19 use Test::Nginx;
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
20
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
21 ###############################################################################
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
22
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
23 select STDERR; $| = 1;
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
24 select STDOUT; $| = 1;
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
25
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
26 eval { require IO::Socket::UNIX; };
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
27 plan(skip_all => 'IO::Socket::UNIX not installed') if $@;
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
28
838
ef6466f77e7c Tests: added proxy test with implicit upstream over unix socket.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 804
diff changeset
29 my $t = Test::Nginx->new()->has(qw/http proxy unix/)->plan(5);
798
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
30
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
31 $t->write_file_expand('nginx.conf', <<'EOF');
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
32
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
33 %%TEST_GLOBALS%%
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
34
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
35 daemon off;
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
36
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
37 events {
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
38 }
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
39
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
40 http {
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
41 %%TEST_GLOBALS_HTTP%%
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
42
838
ef6466f77e7c Tests: added proxy test with implicit upstream over unix socket.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 804
diff changeset
43 upstream u {
ef6466f77e7c Tests: added proxy test with implicit upstream over unix socket.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 804
diff changeset
44 server unix:%%TESTDIR%%/unix.sock;
ef6466f77e7c Tests: added proxy test with implicit upstream over unix socket.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 804
diff changeset
45 }
ef6466f77e7c Tests: added proxy test with implicit upstream over unix socket.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 804
diff changeset
46
798
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
47 server {
974
882267679006 Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 952
diff changeset
48 listen 127.0.0.1:8080;
798
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
49 server_name localhost;
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
50
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
51 location / {
804
6b2512f859a0 Tests: style.
Sergey Kandaurov <pluknet@nginx.com>
parents: 800
diff changeset
52 proxy_pass http://unix:%%TESTDIR%%/unix.sock;
798
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
53 proxy_read_timeout 1s;
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
54 proxy_connect_timeout 2s;
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
55 }
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
56
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
57 location /var {
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
58 proxy_pass http://$arg_b;
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
59 proxy_read_timeout 1s;
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
60 }
838
ef6466f77e7c Tests: added proxy test with implicit upstream over unix socket.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 804
diff changeset
61
ef6466f77e7c Tests: added proxy test with implicit upstream over unix socket.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 804
diff changeset
62 location /u {
ef6466f77e7c Tests: added proxy test with implicit upstream over unix socket.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 804
diff changeset
63 proxy_pass http://u;
ef6466f77e7c Tests: added proxy test with implicit upstream over unix socket.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 804
diff changeset
64 proxy_read_timeout 1s;
ef6466f77e7c Tests: added proxy test with implicit upstream over unix socket.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 804
diff changeset
65 }
798
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
66 }
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
67 }
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
68
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
69 EOF
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
70
804
6b2512f859a0 Tests: style.
Sergey Kandaurov <pluknet@nginx.com>
parents: 800
diff changeset
71 my $path = $t->testdir() . '/unix.sock';
798
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
72
804
6b2512f859a0 Tests: style.
Sergey Kandaurov <pluknet@nginx.com>
parents: 800
diff changeset
73 $t->run_daemon(\&http_daemon, $path);
798
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
74 $t->run();
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
75
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
76 # wait for unix socket to appear
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
77
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
78 for (1 .. 50) {
804
6b2512f859a0 Tests: style.
Sergey Kandaurov <pluknet@nginx.com>
parents: 800
diff changeset
79 last if -S $path;
798
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
80 select undef, undef, undef, 0.1;
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
81 }
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
82
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
83 ###############################################################################
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
84
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
85 like(http_get('/'), qr/SEE-THIS/, 'proxy request');
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
86 like(http_get('/multi'), qr/AND-THIS/, 'proxy request with multiple packets');
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
87
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
88 unlike(http_head('/'), qr/SEE-THIS/, 'proxy head request');
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
89
804
6b2512f859a0 Tests: style.
Sergey Kandaurov <pluknet@nginx.com>
parents: 800
diff changeset
90 like(http_get("/var?b=unix:$path:/"), qr/SEE-THIS/, 'proxy with variables');
798
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
91
838
ef6466f77e7c Tests: added proxy test with implicit upstream over unix socket.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 804
diff changeset
92 like(http_get('/u'), qr/SEE-THIS/, 'proxy implicit upstream');
ef6466f77e7c Tests: added proxy test with implicit upstream over unix socket.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 804
diff changeset
93
798
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
94 ###############################################################################
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
95
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
96 sub http_daemon {
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
97 my $server = IO::Socket::UNIX->new(
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
98 Proto => 'tcp',
804
6b2512f859a0 Tests: style.
Sergey Kandaurov <pluknet@nginx.com>
parents: 800
diff changeset
99 Local => shift,
798
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
100 Listen => 5,
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
101 Reuse => 1
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
102 )
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
103 or die "Can't create listening socket: $!\n";
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
104
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
105 local $SIG{PIPE} = 'IGNORE';
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
106
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
107 while (my $client = $server->accept()) {
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
108 $client->autoflush(1);
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
109
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
110 my $headers = '';
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
111 my $uri = '';
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
112
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
113 while (<$client>) {
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
114 $headers .= $_;
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
115 last if (/^\x0d?\x0a?$/);
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
116 }
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
117
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
118 $uri = $1 if $headers =~ /^\S+\s+([^ ]+)\s+HTTP/i;
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
119
838
ef6466f77e7c Tests: added proxy test with implicit upstream over unix socket.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 804
diff changeset
120 if (grep { $uri eq $_ } ('/', '/u')) {
798
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
121 print $client <<'EOF';
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
122 HTTP/1.1 200 OK
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
123 Connection: close
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
124
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
125 EOF
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
126 print $client "TEST-OK-IF-YOU-SEE-THIS"
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
127 unless $headers =~ /^HEAD/i;
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
128
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
129 } elsif ($uri eq '/multi') {
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
130
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
131 print $client <<"EOF";
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
132 HTTP/1.1 200 OK
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
133 Connection: close
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
134
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
135 TEST-OK-IF-YOU-SEE-THIS
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
136 EOF
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
137
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
138 select undef, undef, undef, 0.1;
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
139 print $client 'AND-THIS';
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
140
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
141 } else {
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
142
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
143 print $client <<"EOF";
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
144 HTTP/1.1 404 Not Found
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
145 Connection: close
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
146
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
147 Oops, '$uri' not found
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
148 EOF
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
149 }
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
150
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
151 close $client;
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
152 }
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
153 }
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
154
faf2e460b951 Tests: basic proxy tests with unix socket.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
155 ###############################################################################