Klaus Demo nginx / 9b3014e
Merging r4198: Additional headers for proxy/fastcgi/uwsgi/scgi_ignore_headers. Now the following headers may be ignored as well: X-Accel-Limit-Rate, X-Accel-Buffering, X-Accel-Charset. Igor Sysoev 10 years ago
2 changed file(s) with 31 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
359359 ngx_conf_bitmask_t ngx_http_upstream_ignore_headers_masks[] = {
360360 { ngx_string("X-Accel-Redirect"), NGX_HTTP_UPSTREAM_IGN_XA_REDIRECT },
361361 { ngx_string("X-Accel-Expires"), NGX_HTTP_UPSTREAM_IGN_XA_EXPIRES },
362 { ngx_string("X-Accel-Limit-Rate"), NGX_HTTP_UPSTREAM_IGN_XA_LIMIT_RATE },
363 { ngx_string("X-Accel-Buffering"), NGX_HTTP_UPSTREAM_IGN_XA_BUFFERING },
364 { ngx_string("X-Accel-Charset"), NGX_HTTP_UPSTREAM_IGN_XA_CHARSET },
362365 { ngx_string("Expires"), NGX_HTTP_UPSTREAM_IGN_EXPIRES },
363366 { ngx_string("Cache-Control"), NGX_HTTP_UPSTREAM_IGN_CACHE_CONTROL },
364367 { ngx_string("Set-Cookie"), NGX_HTTP_UPSTREAM_IGN_SET_COOKIE },
32673270 ngx_http_upstream_process_limit_rate(ngx_http_request_t *r, ngx_table_elt_t *h,
32683271 ngx_uint_t offset)
32693272 {
3270 ngx_int_t n;
3271
3272 r->upstream->headers_in.x_accel_limit_rate = h;
3273 ngx_int_t n;
3274 ngx_http_upstream_t *u;
3275
3276 u = r->upstream;
3277 u->headers_in.x_accel_limit_rate = h;
3278
3279 if (u->conf->ignore_headers & NGX_HTTP_UPSTREAM_IGN_XA_LIMIT_RATE) {
3280 return NGX_OK;
3281 }
32733282
32743283 n = ngx_atoi(h->value.data, h->value.len);
32753284
32853294 ngx_http_upstream_process_buffering(ngx_http_request_t *r, ngx_table_elt_t *h,
32863295 ngx_uint_t offset)
32873296 {
3288 u_char c0, c1, c2;
3289
3290 if (r->upstream->conf->change_buffering) {
3297 u_char c0, c1, c2;
3298 ngx_http_upstream_t *u;
3299
3300 u = r->upstream;
3301
3302 if (u->conf->ignore_headers & NGX_HTTP_UPSTREAM_IGN_XA_BUFFERING) {
3303 return NGX_OK;
3304 }
3305
3306 if (u->conf->change_buffering) {
32913307
32923308 if (h->value.len == 2) {
32933309 c0 = ngx_tolower(h->value.data[0]);
32943310 c1 = ngx_tolower(h->value.data[1]);
32953311
32963312 if (c0 == 'n' && c1 == 'o') {
3297 r->upstream->buffering = 0;
3313 u->buffering = 0;
32983314 }
32993315
33003316 } else if (h->value.len == 3) {
33033319 c2 = ngx_tolower(h->value.data[2]);
33043320
33053321 if (c0 == 'y' && c1 == 'e' && c2 == 's') {
3306 r->upstream->buffering = 1;
3322 u->buffering = 1;
33073323 }
33083324 }
33093325 }
33163332 ngx_http_upstream_process_charset(ngx_http_request_t *r, ngx_table_elt_t *h,
33173333 ngx_uint_t offset)
33183334 {
3335 if (r->upstream->conf->ignore_headers & NGX_HTTP_UPSTREAM_IGN_XA_CHARSET) {
3336 return NGX_OK;
3337 }
3338
33193339 r->headers_out.override_charset = &h->value;
33203340
33213341 return NGX_OK;
4343 #define NGX_HTTP_UPSTREAM_IGN_EXPIRES 0x00000008
4444 #define NGX_HTTP_UPSTREAM_IGN_CACHE_CONTROL 0x00000010
4545 #define NGX_HTTP_UPSTREAM_IGN_SET_COOKIE 0x00000020
46 #define NGX_HTTP_UPSTREAM_IGN_XA_LIMIT_RATE 0x00000040
47 #define NGX_HTTP_UPSTREAM_IGN_XA_BUFFERING 0x00000080
48 #define NGX_HTTP_UPSTREAM_IGN_XA_CHARSET 0x00000100
4649
4750
4851 typedef struct {