annotate fastcgi_extra_data.t @ 1982:fb25cbe9d4ec default tip

Tests: explicit Valgrind support. Valgrind logging is done to a separate file, as it is not able to follow stderr redirection within nginx or append to a file without corrupting it. Further, Valgrind logging seems to interfere with error suppression in tests, and catches various startup errors and warnings, so the log is additionally filtered. Since startup under Valgrind can be really slow, timeout in waitforfile() was changed to 10 seconds. Prodded by Robert Mueller.
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 31 May 2024 06:23:00 +0300
parents 5ac6efbe5552
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1581
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
1 #!/usr/bin/perl
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
2
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
3 # (C) Maxim Dounin
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
4 # (C) Nginx, Inc.
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
5
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
6 # Test for fastcgi backend, responses with extra data or premature close.
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
7
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
8 ###############################################################################
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
9
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
10 use warnings;
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
11 use strict;
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
12
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
13 use Test::More;
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
14
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
15 BEGIN { use FindBin; chdir($FindBin::Bin); }
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
16
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
17 use lib 'lib';
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
18 use Test::Nginx;
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
19
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
20 ###############################################################################
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
21
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
22 select STDERR; $| = 1;
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
23 select STDOUT; $| = 1;
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
24
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
25 eval { require FCGI; };
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
26 plan(skip_all => 'FCGI not installed') if $@;
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
27 plan(skip_all => 'win32') if $^O eq 'MSWin32';
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
28
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
29 my $t = Test::Nginx->new()
1586
e145509cc6eb Tests: tests for "zero size buf" alerts in fastcgi (ticket #2018).
Maxim Dounin <mdounin@mdounin.ru>
parents: 1581
diff changeset
30 ->has(qw/http fastcgi cache rewrite addition/)->plan(22)
1581
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
31 ->write_file_expand('nginx.conf', <<'EOF');
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
32
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
33 %%TEST_GLOBALS%%
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
34
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
35 daemon off;
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
36
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
37 events {
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
38 }
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
39
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
40 http {
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
41 %%TEST_GLOBALS_HTTP%%
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
42
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
43 fastcgi_param REQUEST_URI $request_uri;
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
44 fastcgi_param REQUEST_METHOD $request_method;
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
45
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
46 fastcgi_cache_path cache keys_zone=one:1m;
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
47 fastcgi_cache_key $request_uri;
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
48 fastcgi_cache_valid any 1m;
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
49
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
50 server {
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
51 listen 127.0.0.1:8080;
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
52 server_name localhost;
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
53
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
54 location / {
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
55 fastcgi_pass 127.0.0.1:8081;
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
56 add_after_body /after;
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
57 }
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
58
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
59 location /unbuf/ {
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
60 fastcgi_pass 127.0.0.1:8081;
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
61 fastcgi_buffering off;
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
62 add_after_body /after;
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
63 }
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
64
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
65 location /head/ {
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
66 fastcgi_pass 127.0.0.1:8081;
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
67 fastcgi_cache one;
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
68 add_after_body /after;
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
69 }
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
70
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
71 location /after {
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
72 return 200 ":after\n";
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
73 }
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
74 }
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
75 }
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
76
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
77 EOF
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
78
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
79 $t->run_daemon(\&fastcgi_daemon);
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
80 $t->run()->waitforsocket('127.0.0.1:' . port(8081));
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
81
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
82 ###############################################################################
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
83
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
84 like(http_get('/'), qr/SEE-THIS(?!-BUT-NOT-THIS)/, 'response with extra data');
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
85 like(http_get('/short'), qr/SEE-THIS(?!.*:after)/s, 'too short response');
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
86 like(http_get('/empty'), qr/200 OK(?!.*:after)/s, 'empty too short response');
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
87
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
88 like(http_head('/'), qr/200 OK(?!.*SEE-THIS)/s, 'no data in HEAD');
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
89 like(http_head('/short'), qr/200 OK(?!.*SEE-THIS)/s, 'too short to HEAD');
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
90 like(http_head('/empty'), qr/200 OK/, 'empty response to HEAD');
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
91
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
92 # unbuffered responses
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
93
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
94 like(http_get('/unbuf/'), qr/SEE-THIS(?!-BUT-NOT-THIS)/,
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
95 'unbuffered with extra data');
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
96 like(http_get('/unbuf/short'), qr/SEE-THIS(?!.*:after)/s,
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
97 'unbuffered too short response');
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
98 like(http_get('/unbuf/empty'), qr/200 OK(?!.*:after)/s,
1693
5ac6efbe5552 Tests: removed TODO and try_run() checks for legacy versions.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1586
diff changeset
99 'unbuffered empty too short response');
1581
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
100
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
101 like(http_head('/unbuf/'), qr/200 OK(?!.*SEE-THIS)/s,
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
102 'unbuffered no data in HEAD');
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
103 like(http_head('/unbuf/short'), qr/200 OK(?!.*SEE-THIS)/s,
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
104 'unbuffered too short response to HEAD');
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
105 like(http_head('/unbuf/empty'), qr/200 OK/,
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
106 'unbuffered empty response to HEAD');
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
107
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
108 # caching of responsses to HEAD requests
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
109
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
110 like(http_head('/head/empty'), qr/200 OK(?!.*SEE-THIS)/s, 'head no body');
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
111 like(http_head('/head/matching'), qr/200 OK(?!.*SEE-THIS)/s, 'head matching');
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
112 like(http_head('/head/extra'), qr/200 OK(?!.*SEE-THIS)/s, 'head extra');
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
113 like(http_head('/head/short'), qr/200 OK(?!.*SEE-THIS)/s, 'head too short');
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
114
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
115 like(http_get('/head/empty'), qr/200 OK/, 'head no body cached');
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
116 like(http_get('/head/matching'), qr/SEE-THIS/, 'head matching cached');
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
117 like(http_get('/head/extra'), qr/SEE-THIS(?!-BUT-NOT-THIS)/s,
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
118 'head extra cached');
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
119 like(http_get('/head/short'), qr/SEE-THIS(?!.*:after)/s,
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
120 'head too short cached');
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
121
1586
e145509cc6eb Tests: tests for "zero size buf" alerts in fastcgi (ticket #2018).
Maxim Dounin <mdounin@mdounin.ru>
parents: 1581
diff changeset
122 # "zero size buf" alerts (ticket #2018)
e145509cc6eb Tests: tests for "zero size buf" alerts in fastcgi (ticket #2018).
Maxim Dounin <mdounin@mdounin.ru>
parents: 1581
diff changeset
123
e145509cc6eb Tests: tests for "zero size buf" alerts in fastcgi (ticket #2018).
Maxim Dounin <mdounin@mdounin.ru>
parents: 1581
diff changeset
124 like(http_get('/zero'), qr/200 OK(?!.*NOT-THIS)/s, 'zero size');
e145509cc6eb Tests: tests for "zero size buf" alerts in fastcgi (ticket #2018).
Maxim Dounin <mdounin@mdounin.ru>
parents: 1581
diff changeset
125 like(http_get('/unbuf/zero'), qr/200 OK(?!.*NOT-THIS)/s,
e145509cc6eb Tests: tests for "zero size buf" alerts in fastcgi (ticket #2018).
Maxim Dounin <mdounin@mdounin.ru>
parents: 1581
diff changeset
126 'unbuffered zero size');
e145509cc6eb Tests: tests for "zero size buf" alerts in fastcgi (ticket #2018).
Maxim Dounin <mdounin@mdounin.ru>
parents: 1581
diff changeset
127
1581
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
128 ###############################################################################
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
129
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
130 sub fastcgi_daemon {
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
131 my $socket = FCGI::OpenSocket('127.0.0.1:' . port(8081), 5);
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
132 my $request = FCGI::Request(\*STDIN, \*STDOUT, \*STDERR, \%ENV,
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
133 $socket);
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
134
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
135 my ($uri, $head);
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
136
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
137 while( $request->Accept() >= 0 ) {
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
138 $uri = $ENV{REQUEST_URI};
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
139 $uri =~ s!^/unbuf!!;
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
140
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
141 $head = $ENV{REQUEST_METHOD} eq 'HEAD';
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
142
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
143 if ($uri eq '/') {
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
144 print "Content-Type: text/html\n";
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
145 print "Content-Length: 8\n\n";
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
146 print "SEE-THIS-BUT-NOT-THIS\n";
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
147
1586
e145509cc6eb Tests: tests for "zero size buf" alerts in fastcgi (ticket #2018).
Maxim Dounin <mdounin@mdounin.ru>
parents: 1581
diff changeset
148 } elsif ($uri eq '/zero') {
e145509cc6eb Tests: tests for "zero size buf" alerts in fastcgi (ticket #2018).
Maxim Dounin <mdounin@mdounin.ru>
parents: 1581
diff changeset
149 print "Content-Type: text/html\n";
e145509cc6eb Tests: tests for "zero size buf" alerts in fastcgi (ticket #2018).
Maxim Dounin <mdounin@mdounin.ru>
parents: 1581
diff changeset
150 print "Content-Length: 0\n\n";
e145509cc6eb Tests: tests for "zero size buf" alerts in fastcgi (ticket #2018).
Maxim Dounin <mdounin@mdounin.ru>
parents: 1581
diff changeset
151 print "NOT-THIS\n";
e145509cc6eb Tests: tests for "zero size buf" alerts in fastcgi (ticket #2018).
Maxim Dounin <mdounin@mdounin.ru>
parents: 1581
diff changeset
152
1581
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
153 } elsif ($uri eq '/short') {
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
154 print "Content-Type: text/html\n";
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
155 print "Content-Length: 100\n\n";
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
156 print "SEE-THIS-TOO-SHORT-RESPONSE\n";
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
157
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
158 } elsif ($uri eq '/empty') {
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
159 print "Content-Type: text/html\n";
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
160 print "Content-Length: 100\n\n";
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
161
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
162 } elsif ($uri eq '/head/empty') {
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
163 print "Content-Type: text/html\n";
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
164 print "Content-Length: 8\n\n";
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
165 print "SEE-THIS" unless $head;
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
166
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
167 } elsif ($uri eq '/head/matching') {
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
168 print "Content-Type: text/html\n";
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
169 print "Content-Length: 8\n\n";
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
170 print "SEE-THIS";
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
171
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
172 } elsif ($uri eq '/head/extra') {
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
173 print "Content-Type: text/html\n";
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
174 print "Content-Length: 8\n\n";
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
175 print "SEE-THIS-BUT-NOT-THIS\n";
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
176
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
177 } elsif ($uri eq '/head/short') {
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
178 print "Content-Type: text/html\n";
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
179 print "Content-Length: 100\n\n";
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
180 print "SEE-THIS\n";
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
181 }
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
182 }
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
183
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
184 FCGI::CloseSocket($socket);
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
185 }
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
186
463d6863d360 Tests: tests for extra data and short responses.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
187 ###############################################################################