xref: /unit/test/perl/variables/psgi.pl (revision 674:092a1befab12)
1544Szelenkov@nginx.commy $app = sub {
2544Szelenkov@nginx.com    my ($environ) = @_;
3544Szelenkov@nginx.com
4544Szelenkov@nginx.com    my $len = int($environ->{'CONTENT_LENGTH'});
5544Szelenkov@nginx.com    $environ->{'psgi.input'}->read(my $body, $len);
6544Szelenkov@nginx.com
7581Szelenkov@nginx.com    my $version = join('', @{$environ->{'psgi.version'}});
8581Szelenkov@nginx.com
9544Szelenkov@nginx.com    return ['200', [
10544Szelenkov@nginx.com        'Content-Type' => $environ->{'CONTENT_TYPE'},
11544Szelenkov@nginx.com        'Content-Length' => $len,
12544Szelenkov@nginx.com        'Request-Method' => $environ->{'REQUEST_METHOD'},
13544Szelenkov@nginx.com        'Request-Uri' => $environ->{'REQUEST_URI'},
14544Szelenkov@nginx.com        'Http-Host' => $environ->{'HTTP_HOST'},
15544Szelenkov@nginx.com        'Server-Protocol' => $environ->{'SERVER_PROTOCOL'},
16*674Szelenkov@nginx.com        'Server-Software' => $environ->{'SERVER_SOFTWARE'},
17581Szelenkov@nginx.com        'Custom-Header' => $environ->{'HTTP_CUSTOM_HEADER'},
18581Szelenkov@nginx.com        'Psgi-Version' => $version,
19581Szelenkov@nginx.com        'Psgi-Url-Scheme' => $environ->{'psgi.url_scheme'},
20581Szelenkov@nginx.com        'Psgi-Multithread' => $environ->{'psgi.multithread'},
21581Szelenkov@nginx.com        'Psgi-Multiprocess' => $environ->{'psgi.multiprocess'},
22581Szelenkov@nginx.com        'Psgi-Run-Once' => $environ->{'psgi.run_once'},
23581Szelenkov@nginx.com        'Psgi-Nonblocking' => $environ->{'psgi.nonblocking'},
24581Szelenkov@nginx.com        'Psgi-Streaming' => $environ->{'psgi.streaming'}
25544Szelenkov@nginx.com    ], [$body]];
26544Szelenkov@nginx.com};
27