diff options
author | Igor Sysoev <igor@sysoev.ru> | 2003-11-04 22:12:39 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2003-11-04 22:12:39 +0000 |
commit | 9cc1acef18220cfc3b66d0a761f1f7c39e0b5c29 (patch) | |
tree | 8c40a56b42bd6d0071bdd3f683cf1b520fd502a8 /src/http/modules/proxy/ngx_http_proxy_handler.c | |
parent | f60b1a5cd9f6e509caf4513f1b28ae33cb3dae4e (diff) | |
download | nginx-9cc1acef18220cfc3b66d0a761f1f7c39e0b5c29.tar.gz nginx-9cc1acef18220cfc3b66d0a761f1f7c39e0b5c29.zip |
nginx-0.0.1-2003-11-05-01:12:39 import
Diffstat (limited to 'src/http/modules/proxy/ngx_http_proxy_handler.c')
-rw-r--r-- | src/http/modules/proxy/ngx_http_proxy_handler.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/http/modules/proxy/ngx_http_proxy_handler.c b/src/http/modules/proxy/ngx_http_proxy_handler.c index 8aa6e6823..860ba7ac7 100644 --- a/src/http/modules/proxy/ngx_http_proxy_handler.c +++ b/src/http/modules/proxy/ngx_http_proxy_handler.c @@ -131,6 +131,14 @@ static ngx_command_t ngx_http_proxy_commands[] = { NULL }, + { ngx_string("proxy_busy_lock"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE3, + ngx_http_set_busy_lock_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_proxy_loc_conf_t, busy_lock), + NULL }, + + { ngx_string("proxy_pass_server"), NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, ngx_conf_set_flag_slot, @@ -255,6 +263,8 @@ static int ngx_http_proxy_handler(ngx_http_request_t *r) return NGX_HTTP_INTERNAL_SERVER_ERROR; } + ngx_memzero(p->state, sizeof(ngx_http_proxy_state_t)); + if (!p->lcf->cache) { p->state->cache = NGX_HTTP_PROXY_CACHE_PASS; @@ -280,6 +290,8 @@ static int ngx_http_proxy_handler(ngx_http_request_t *r) rc = ngx_http_proxy_get_cached_response(p); + p->valid_header_in = 1; + if (rc == NGX_OK) { return ngx_http_proxy_send_cached_response(p); } @@ -406,6 +418,8 @@ static void *ngx_http_proxy_create_loc_conf(ngx_conf_t *cf) conf->cache_path = NULL; conf->temp_path = NULL; + conf->busy_lock = NULL; + */ conf->request_buffer_size = NGX_CONF_UNSET; @@ -482,6 +496,26 @@ static char *ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, ngx_conf_merge_value(conf->cache, prev->cache, 0); + + /* conf->cache must be merged */ + + if (conf->busy_lock == NULL) { + conf->busy_lock = prev->busy_lock; + } + + if (conf->busy_lock && conf->cache && conf->busy_lock->busy == NULL) { + + /* 16 bytes are 128 bits of the md5 */ + + /* ngx_alloc_shared() */ + conf->busy_lock->busy = ngx_palloc(cf->pool, + 16 * conf->busy_lock->max_conn); + if (conf->busy_lock->busy == NULL) { + return NGX_CONF_ERROR; + } + } + + ngx_conf_merge_value(conf->pass_server, prev->pass_server, 0); ngx_conf_merge_value(conf->pass_x_accel_expires, prev->pass_x_accel_expires, 0); |