File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / lighttpd / tests / mod-setenv.t
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Oct 14 10:32:47 2013 UTC (10 years, 9 months ago) by misho
Branches: lighttpd, MAIN
CVS tags: v1_4_41p8, v1_4_35p0, v1_4_35, v1_4_33, HEAD
1.4.33

    1: #!/usr/bin/env perl
    2: BEGIN {
    3: 	# add current source dir to the include-path
    4: 	# we need this for make distcheck
    5: 	(my $srcdir = $0) =~ s,/[^/]+$,/,;
    6: 	unshift @INC, $srcdir;
    7: }
    8: 
    9: use strict;
   10: use IO::Socket;
   11: use Test::More tests => 6;
   12: use LightyTest;
   13: 
   14: my $tf = LightyTest->new();
   15: my $t;
   16: 
   17: ok($tf->start_proc == 0, "Starting lighttpd") or die();
   18: 
   19: $t->{REQUEST} = ( <<EOF
   20: GET /get-header.pl?TRAC_ENV HTTP/1.0
   21: Host: www.example.org
   22: EOF
   23:  );
   24: $t->{RESPONSE}  = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'tracenv' } ];
   25: ok($tf->handle_http($t) == 0, 'query first setenv');
   26: 
   27: $t->{REQUEST}  = ( <<EOF
   28: GET /get-header.pl?SETENV HTTP/1.0
   29: Host: www.example.org
   30: EOF
   31:  );
   32: $t->{RESPONSE}  = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'setenv' } ];
   33: ok($tf->handle_http($t) == 0, 'query second setenv');
   34: 
   35: $t->{REQUEST}  = ( <<EOF
   36: GET /get-header.pl?HTTP_FOO HTTP/1.0
   37: Host: www.example.org
   38: EOF
   39:  );
   40: $t->{RESPONSE}  = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'foo' } ];
   41: ok($tf->handle_http($t) == 0, 'query add-request-header');
   42: 
   43: $t->{REQUEST} = ( <<EOF
   44: GET /index.html HTTP/1.0
   45: Host: www.example.org
   46: EOF
   47:  );
   48: $t->{RESPONSE}  = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'BAR' => 'foo' } ];
   49: ok($tf->handle_http($t) == 0, 'query add-response-header');
   50: 
   51: ok($tf->stop_proc == 0, "Stopping lighttpd");
   52: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>