comparison src/http/modules/proxy/ngx_http_proxy_upstream.c @ 195:8dee38ea9117

nginx-0.0.1-2003-11-25-23:44:56 import
author Igor Sysoev <igor@sysoev.ru>
date Tue, 25 Nov 2003 20:44:56 +0000
parents 2357fa41738a
children 70e1c7d2b83d
comparison
equal deleted inserted replaced
194:2357fa41738a 195:8dee38ea9117
1015 ep->hunk_to_file->pos = p->header_in->start; 1015 ep->hunk_to_file->pos = p->header_in->start;
1016 ep->hunk_to_file->last = p->header_in->pos; 1016 ep->hunk_to_file->last = p->header_in->pos;
1017 ep->hunk_to_file->type = NGX_HUNK_IN_MEMORY|NGX_HUNK_TEMP; 1017 ep->hunk_to_file->type = NGX_HUNK_IN_MEMORY|NGX_HUNK_TEMP;
1018 1018
1019 if (ngx_event_flags & NGX_USE_AIO_EVENT) { 1019 if (ngx_event_flags & NGX_USE_AIO_EVENT) {
1020 1020 /* the posted aio operation can currupt a shadow buffer */
1021 /* the posted aio operation can currupt shadow buf */
1022 ep->single_buf = 1; 1021 ep->single_buf = 1;
1023 } 1022 }
1024 1023
1025 /* TODO: ep->free_bufs = 0 if use ngx_create_chain_of_hunks() */ 1024 /* TODO: ep->free_bufs = 0 if use ngx_create_chain_of_hunks() */
1026 ep->free_bufs = 1; 1025 ep->free_bufs = 1;
1124 return; 1123 return;
1125 } 1124 }
1126 } 1125 }
1127 1126
1128 if (ep->upstream_done || ep->upstream_eof || ep->upstream_error) { 1127 if (ep->upstream_done || ep->upstream_eof || ep->upstream_error) {
1128 ngx_log_debug(ev->log, "http proxy upstream exit");
1129 ngx_http_busy_unlock(p->lcf->busy_lock, &p->busy_lock); 1129 ngx_http_busy_unlock(p->lcf->busy_lock, &p->busy_lock);
1130 ngx_http_proxy_close_connection(p); 1130 ngx_http_proxy_finalize_request(p, 0);
1131 } 1131 return;
1132 } 1132 }
1133 1133 }
1134
1135 if (ep->downstream_error) {
1136 ngx_log_debug(ev->log, "http proxy downstream error");
1137 if (!p->cachable && p->upstream->peer.connection) {
1138 ngx_http_proxy_finalize_request(p, 0);
1139 }
1140 }
1141
1142 #if 0
1134 if (ep->downstream_done) { 1143 if (ep->downstream_done) {
1135 ngx_log_debug(ev->log, "http proxy downstream done"); 1144 ngx_log_debug(ev->log, "http proxy downstream done");
1136 ngx_http_proxy_finalize_request(p, r->main ? 0 : ngx_http_send_last(r)); 1145 ngx_http_proxy_finalize_request(p, 0);
1137 return; 1146 return;
1138 } 1147 }
1139 1148
1140 if (ep->downstream_error) { 1149 if (ep->downstream_error) {
1150 ngx_log_debug(ev->log, "http proxy downstream error");
1141 if (!p->cachable && p->upstream->peer.connection) { 1151 if (!p->cachable && p->upstream->peer.connection) {
1142 ngx_http_proxy_close_connection(p); 1152 ngx_http_proxy_close_connection(p);
1143 } 1153 }
1144 1154
1145 if (p->upstream->peer.connection == NULL) { 1155 if (p->upstream->peer.connection == NULL) {
1146 ngx_http_close_connection(r->connection); 1156 ngx_http_close_request(r);
1147 } 1157 }
1148 } 1158 }
1159 #endif
1149 } 1160 }
1150 1161
1151 1162
1152 static void ngx_http_proxy_next_upstream(ngx_http_proxy_ctx_t *p, int ft_type) 1163 static void ngx_http_proxy_next_upstream(ngx_http_proxy_ctx_t *p, int ft_type)
1153 { 1164 {