359 | 359 |
ngx_conf_bitmask_t ngx_http_upstream_ignore_headers_masks[] = {
|
360 | 360 |
{ ngx_string("X-Accel-Redirect"), NGX_HTTP_UPSTREAM_IGN_XA_REDIRECT },
|
361 | 361 |
{ 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 },
|
362 | 365 |
{ ngx_string("Expires"), NGX_HTTP_UPSTREAM_IGN_EXPIRES },
|
363 | 366 |
{ ngx_string("Cache-Control"), NGX_HTTP_UPSTREAM_IGN_CACHE_CONTROL },
|
364 | 367 |
{ ngx_string("Set-Cookie"), NGX_HTTP_UPSTREAM_IGN_SET_COOKIE },
|
|
3267 | 3270 |
ngx_http_upstream_process_limit_rate(ngx_http_request_t *r, ngx_table_elt_t *h,
|
3268 | 3271 |
ngx_uint_t offset)
|
3269 | 3272 |
{
|
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 |
}
|
3273 | 3282 |
|
3274 | 3283 |
n = ngx_atoi(h->value.data, h->value.len);
|
3275 | 3284 |
|
|
3285 | 3294 |
ngx_http_upstream_process_buffering(ngx_http_request_t *r, ngx_table_elt_t *h,
|
3286 | 3295 |
ngx_uint_t offset)
|
3287 | 3296 |
{
|
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) {
|
3291 | 3307 |
|
3292 | 3308 |
if (h->value.len == 2) {
|
3293 | 3309 |
c0 = ngx_tolower(h->value.data[0]);
|
3294 | 3310 |
c1 = ngx_tolower(h->value.data[1]);
|
3295 | 3311 |
|
3296 | 3312 |
if (c0 == 'n' && c1 == 'o') {
|
3297 | |
r->upstream->buffering = 0;
|
|
3313 |
u->buffering = 0;
|
3298 | 3314 |
}
|
3299 | 3315 |
|
3300 | 3316 |
} else if (h->value.len == 3) {
|
|
3303 | 3319 |
c2 = ngx_tolower(h->value.data[2]);
|
3304 | 3320 |
|
3305 | 3321 |
if (c0 == 'y' && c1 == 'e' && c2 == 's') {
|
3306 | |
r->upstream->buffering = 1;
|
|
3322 |
u->buffering = 1;
|
3307 | 3323 |
}
|
3308 | 3324 |
}
|
3309 | 3325 |
}
|
|
3316 | 3332 |
ngx_http_upstream_process_charset(ngx_http_request_t *r, ngx_table_elt_t *h,
|
3317 | 3333 |
ngx_uint_t offset)
|
3318 | 3334 |
{
|
|
3335 |
if (r->upstream->conf->ignore_headers & NGX_HTTP_UPSTREAM_IGN_XA_CHARSET) {
|
|
3336 |
return NGX_OK;
|
|
3337 |
}
|
|
3338 |
|
3319 | 3339 |
r->headers_out.override_charset = &h->value;
|
3320 | 3340 |
|
3321 | 3341 |
return NGX_OK;
|