#if (NGX_EVENT_COPY_FILTER)
static int ngx_event_proxy_copy_input_filter(ngx_event_proxy_t *p,
- ngx_chain_t *chain);
+ ngx_chain_t *chain);
#endif
ngx_log_debug(p->log, "file hunk: %08X" _ chain->hunk _
chain->hunk->end - chain->hunk->last);
- /* if the hunks is not needed to be saved in a cache and
+ /* if the hunks are not needed to be saved in a cache and
a downstream is ready then write the hunks to a downstream */
} else if (p->cachable == 0 && p->downstream->write->ready) {
/* the copy input filter */
static int ngx_event_proxy_copy_input_filter(ngx_event_proxy_t *p,
- ngx_chain_t *chain)
+ ngx_chain_t *chain)
{
ngx_hunk_t *h;
ngx_chain_t *entry, *temp;
ngx_log_debug(rev->log, "http proxy process upstream body");
if (rev->timedout) {
- ngx_http_proxy_next_upstream(p);
+ ngx_http_proxy_close_connection(p->upstream.connection);
+ p->upstream.connection = NULL;
return;
}
ngx_event_proxy_read_upstream(p->event_proxy);
+ if (p->event_proxy->upstream_eof) {
+ ngx_http_proxy_close_connection(p->upstream.connection);
+ p->upstream.connection = NULL;
+ return;
+ }
+
+ if (p->event_proxy->upstream_error) {
+ ngx_http_proxy_close_connection(p->upstream.connection);
+ p->upstream.connection = NULL;
+ return;
+ }
+
return;
}
c->write->timer_set = 0;
}
+ /* TODO: move connection to the connection pool */
+
if (ngx_del_conn) {
ngx_del_conn(c);