@@ -21,7 +21,7 @@ use Test::Nginx;
21
21
select STDERR ; $| = 1;
22
22
select STDOUT ; $| = 1;
23
23
24
- my $t = Test::Nginx-> new()-> has(qw/ http uwsgi/ )-> has_daemon(' uwsgi' )-> plan(5 )
24
+ my $t = Test::Nginx-> new()-> has(qw/ http uwsgi/ )-> has_daemon(' uwsgi' )-> plan(8 )
25
25
-> write_file_expand(' nginx.conf' , <<'EOF' );
26
26
27
27
%%TEST_GLOBALS%%
60
60
$t -> write_file(' uwsgi_test_app.py' , <<END );
61
61
62
62
def application(env, start_response):
63
- start_response('200 OK', [('Content-Type','text/plain')])
63
+ start_response('200 OK', [
64
+ ('Content-Type', 'text/plain'),
65
+ ('X-Forwarded-For', env.get('HTTP_X_FORWARDED_FOR', '')),
66
+ ('X-Cookie', env.get('HTTP_COOKIE', '')),
67
+ ('X-Foo', env.get('HTTP_FOO', ''))
68
+ ])
64
69
return b"SEE-THIS"
65
70
66
71
END
@@ -97,6 +102,33 @@ like(http_get('/var?b=127.0.0.1:' . port(8081)), qr/SEE-THIS/,
97
102
' uwsgi with variables' );
98
103
like(http_get(' /var?b=u' ), qr / SEE-THIS/ , ' uwsgi with variables to upstream' );
99
104
105
+ TODO: {
106
+ local $TODO = ' not yet' unless $t -> has_version(' 1.23.0' );
107
+
108
+ my $r = http(<<EOF );
109
+ GET / HTTP/1.0
110
+ Host: localhost
111
+ X-Forwarded-For: foo
112
+ X-Forwarded-For: bar
113
+ X-Forwarded-For: bazz
114
+ Cookie: foo
115
+ Cookie: bar
116
+ Cookie: bazz
117
+ Foo: foo
118
+ Foo: bar
119
+ Foo: bazz
120
+
121
+ EOF
122
+
123
+ like($r , qr / X-Forwarded-For: foo, bar, bazz/ ,
124
+ ' uwsgi with multiple X-Forwarded-For headers' );
125
+ like($r , qr / X-Cookie: foo; bar; bazz/ ,
126
+ ' uwsgi with multiple Cookie headers' );
127
+ like($r , qr / X-Foo: foo, bar, bazz/ ,
128
+ ' uwsgi with multiple unknown headers' );
129
+
130
+ }
131
+
100
132
# ##############################################################################
101
133
102
134
sub http_get_headers {
0 commit comments