@@ -24,7 +24,7 @@ select STDOUT; $| = 1;
24
24
eval { require SCGI; };
25
25
plan(skip_all => ' SCGI not installed' ) if $@ ;
26
26
27
- my $t = Test::Nginx-> new()-> has(qw/ http scgi/ )-> plan(7 )
27
+ my $t = Test::Nginx-> new()-> has(qw/ http scgi/ )-> plan(10 )
28
28
-> write_file_expand(' nginx.conf' , <<'EOF' );
29
29
30
30
%%TEST_GLOBALS%%
@@ -81,6 +81,33 @@ like(http_get('/var?b=127.0.0.1:' . port(8081)), qr/SEE-THIS/,
81
81
' scgi with variables' );
82
82
like(http_get(' /var?b=u' ), qr / SEE-THIS/ , ' scgi with variables to upstream' );
83
83
84
+ TODO: {
85
+ local $TODO = ' not yet' unless $t -> has_version(' 1.23.0' );
86
+
87
+ my $r = http(<<EOF );
88
+ GET / HTTP/1.0
89
+ Host: localhost
90
+ X-Forwarded-For: foo
91
+ X-Forwarded-For: bar
92
+ X-Forwarded-For: bazz
93
+ Cookie: foo
94
+ Cookie: bar
95
+ Cookie: bazz
96
+ Foo: foo
97
+ Foo: bar
98
+ Foo: bazz
99
+
100
+ EOF
101
+
102
+ like($r , qr / X-Forwarded-For: foo, bar, bazz/ ,
103
+ ' scgi with multiple X-Forwarded-For headers' );
104
+ like($r , qr / X-Cookie: foo; bar; bazz/ ,
105
+ ' scgi with multiple Cookie headers' );
106
+ like($r , qr / X-Foo: foo, bar, bazz/ ,
107
+ ' scgi with multiple unknown headers' );
108
+
109
+ }
110
+
84
111
# ##############################################################################
85
112
86
113
sub http_get_headers {
@@ -131,9 +158,16 @@ sub scgi_daemon {
131
158
132
159
$count ++;
133
160
161
+ my $xfwd = $request -> env-> {HTTP_X_FORWARDED_FOR } || ' ' ;
162
+ my $cookie = $request -> env-> {HTTP_COOKIE } || ' ' ;
163
+ my $foo = $request -> env-> {HTTP_FOO } || ' ' ;
164
+
134
165
$request -> connection()-> print (<<EOF );
135
166
Location: http://localhost/redirect
136
167
Content-Type: text/html
168
+ X-Forwarded-For: $xfwd
169
+ X-Cookie: $cookie
170
+ X-Foo: $foo
137
171
138
172
SEE-THIS
139
173
$count
0 commit comments