Permalink
Browse files

bugfix: more_set_input_headers did not handle the Accept-Encoding req…

…uest headers properly. thanks 天街夜色.
  • Loading branch information...
1 parent 6cd7ae8 commit ffdda453515f0495308382b304e6b0dbffbafaf9 @agentzh agentzh committed Dec 16, 2011
Showing with 30 additions and 3 deletions.
  1. +8 −1 src/ngx_http_headers_more_headers_in.c
  2. +22 −2 t/input.t
@@ -1,7 +1,8 @@
/* Copyright (C) agentzh */
+#ifndef DDEBUG
#define DDEBUG 0
-
+#endif
#include "ddebug.h"
#include "ngx_http_headers_more_headers_in.h"
@@ -45,6 +46,12 @@ static ngx_int_t ngx_http_set_host_header(ngx_http_request_t *r,
static ngx_http_headers_more_set_header_t ngx_http_headers_more_set_handlers[]
= {
+#if (NGX_HTTP_GZIP)
+ { ngx_string("Accept-Encoding"),
+ offsetof(ngx_http_headers_in_t, accept_encoding),
+ ngx_http_set_builtin_header },
+#endif
+
{ ngx_string("Host"),
offsetof(ngx_http_headers_in_t, host),
ngx_http_set_host_header },
View
@@ -1,11 +1,11 @@
-# vi:filetype=perl
+# vi:filetype=
use lib 'lib';
use Test::Nginx::Socket; # 'no_plan';
repeat_each(2);
-plan tests => 50 * repeat_each();
+plan tests => 53 * repeat_each();
no_long_string();
#no_diff;
@@ -425,3 +425,23 @@ X-Foo18: 18\r
"
--- skip_nginx: 3: < 0.7.46
+
+=== TEST 18: Accept-Encoding
+--- config
+ location /bar {
+ default_type 'text/plain';
+ more_set_input_headers 'Accept-Encoding: gzip';
+ gzip on;
+ gzip_min_length 1;
+ gzip_buffers 4 8k;
+ gzip_types text/plain;
+ }
+--- user_files
+">>> bar
+" . ("hello" x 512)
+--- request
+GET /bar
+--- response_headers
+Content-Encoding: gzip
+--- response_body_like: .
+

0 comments on commit ffdda45

Please sign in to comment.