diff options
Diffstat (limited to 'src/http/modules/proxy')
-rw-r--r-- | src/http/modules/proxy/ngx_http_proxy_cache.c | 2 | ||||
-rw-r--r-- | src/http/modules/proxy/ngx_http_proxy_handler.c | 17 | ||||
-rw-r--r-- | src/http/modules/proxy/ngx_http_proxy_upstream.c | 13 |
3 files changed, 21 insertions, 11 deletions
diff --git a/src/http/modules/proxy/ngx_http_proxy_cache.c b/src/http/modules/proxy/ngx_http_proxy_cache.c index 3c4f5cad3..a8c9d7754 100644 --- a/src/http/modules/proxy/ngx_http_proxy_cache.c +++ b/src/http/modules/proxy/ngx_http_proxy_cache.c @@ -288,6 +288,8 @@ void ngx_http_proxy_cache_busy_lock(ngx_http_proxy_ctx_t *p) return; } + ngx_http_busy_unlock(p->lcf->busy_lock, &p->busy_lock); + if (rc == NGX_DONE) { ft_type = NGX_HTTP_PROXY_FT_BUSY_LOCK; diff --git a/src/http/modules/proxy/ngx_http_proxy_handler.c b/src/http/modules/proxy/ngx_http_proxy_handler.c index ad719ca11..ecfe65831 100644 --- a/src/http/modules/proxy/ngx_http_proxy_handler.c +++ b/src/http/modules/proxy/ngx_http_proxy_handler.c @@ -503,7 +503,7 @@ static char *ngx_http_proxy_log_proxy_state(ngx_http_request_t *r, char *buf, { ngx_http_proxy_ctx_t *p; - p = ngx_http_get_module_ctx(r, ngx_http_proxy_module); + p = ngx_http_get_module_err_ctx(r, ngx_http_proxy_module); if (p == NULL) { *buf = '-'; @@ -520,11 +520,15 @@ static char *ngx_http_proxy_log_proxy_state(ngx_http_request_t *r, char *buf, *buf++ = '/'; - *buf++ = 'X'; + *buf++ = '_'; + + *buf++ = '/'; + + *buf++ = '_'; *buf++ = '/'; - *buf++ = 'X'; + *buf++ = '_'; *buf++ = ' '; @@ -554,6 +558,9 @@ static char *ngx_http_proxy_log_proxy_state(ngx_http_request_t *r, char *buf, buf += ngx_snprintf(buf, NGX_TIME_LEN, TIME_FMT, p->state->expires); } + *buf++ = ' '; + *buf++ = '_'; + return buf; } @@ -563,7 +570,7 @@ static char *ngx_http_proxy_log_cache_state(ngx_http_request_t *r, char *buf, { ngx_http_proxy_ctx_t *p; - p = ngx_http_get_module_ctx(r, ngx_http_proxy_module); + p = ngx_http_get_module_err_ctx(r, ngx_http_proxy_module); if (p == NULL || p->state->cache_state == 0) { *buf = '-'; @@ -580,7 +587,7 @@ static char *ngx_http_proxy_log_reason(ngx_http_request_t *r, char *buf, { ngx_http_proxy_ctx_t *p; - p = ngx_http_get_module_ctx(r, ngx_http_proxy_module); + p = ngx_http_get_module_err_ctx(r, ngx_http_proxy_module); if (p == NULL || p->state->reason == 0) { *buf = '-'; diff --git a/src/http/modules/proxy/ngx_http_proxy_upstream.c b/src/http/modules/proxy/ngx_http_proxy_upstream.c index d4049935d..0a5ecd2fc 100644 --- a/src/http/modules/proxy/ngx_http_proxy_upstream.c +++ b/src/http/modules/proxy/ngx_http_proxy_upstream.c @@ -337,6 +337,8 @@ void ngx_http_proxy_upstream_busy_lock(ngx_http_proxy_ctx_t *p) return; } + ngx_http_busy_unlock(p->lcf->busy_lock, &p->busy_lock); + if (rc == NGX_DONE) { ft_type = NGX_HTTP_PROXY_FT_BUSY_LOCK; @@ -1053,27 +1055,24 @@ static void ngx_http_proxy_process_body(ngx_event_t *ev) if (p->upstream->peer.connection) { if (ep->upstream_done && p->cachable) { if (ngx_http_proxy_update_cache(p) == NGX_ERROR) { - ngx_http_busy_unlock_cachable(p->lcf->busy_lock, &p->busy_lock); + ngx_http_busy_unlock(p->lcf->busy_lock, &p->busy_lock); ngx_http_proxy_finalize_request(p, 0); return; } - ngx_http_busy_unlock_cachable(p->lcf->busy_lock, &p->busy_lock); - } else if (ep->upstream_eof && p->cachable) { /* TODO: check length & update cache */ if (ngx_http_proxy_update_cache(p) == NGX_ERROR) { - ngx_http_busy_unlock_cachable(p->lcf->busy_lock, &p->busy_lock); + ngx_http_busy_unlock(p->lcf->busy_lock, &p->busy_lock); ngx_http_proxy_finalize_request(p, 0); return; } - - ngx_http_busy_unlock_cachable(p->lcf->busy_lock, &p->busy_lock); } if (ep->upstream_done || ep->upstream_eof || ep->upstream_error) { + ngx_http_busy_unlock(p->lcf->busy_lock, &p->busy_lock); ngx_http_proxy_close_connection(p); } } @@ -1104,6 +1103,8 @@ static void ngx_http_proxy_next_upstream(ngx_http_proxy_ctx_t *p, int ft_type) ngx_log_debug(p->request->connection->log, "next upstream: %d" _ ft_type); + ngx_http_busy_unlock(p->lcf->busy_lock, &p->busy_lock); + if (ft_type != NGX_HTTP_PROXY_FT_HTTP_404) { ngx_event_connect_peer_failed(&p->upstream->peer); } |