comparison src/http/ngx_http_upstream.c @ 424:9da1d9d94d18 NGINX_0_7_24

nginx 0.7.24 *) Feature: the "if_modified_since" directive. *) Bugfix: nginx did not process a FastCGI server response, if the server send too many messages to stderr before response. *) Bugfix: the "$cookie_..." variables did not work in the SSI and the perl module.
author Igor Sysoev <http://sysoev.ru>
date Mon, 01 Dec 2008 00:00:00 +0300
parents ad0a34a8efa6
children e7dbea1ee115
comparison
equal deleted inserted replaced
423:ca440bb56eca 424:9da1d9d94d18
1112 u->buffer.last = u->buffer.pos; 1112 u->buffer.last = u->buffer.pos;
1113 } 1113 }
1114 #endif 1114 #endif
1115 } 1115 }
1116 1116
1117 n = c->recv(c, u->buffer.last, u->buffer.end - u->buffer.last); 1117 for ( ;; ) {
1118 1118
1119 if (n == NGX_AGAIN) { 1119 n = c->recv(c, u->buffer.last, u->buffer.end - u->buffer.last);
1120
1121 if (n == NGX_AGAIN) {
1120 #if 0 1122 #if 0
1121 ngx_add_timer(rev, u->read_timeout); 1123 ngx_add_timer(rev, u->read_timeout);
1122 #endif 1124 #endif
1123 1125
1124 if (ngx_handle_read_event(rev, 0) == NGX_ERROR) { 1126 if (ngx_handle_read_event(rev, 0) == NGX_ERROR) {
1125 ngx_http_upstream_finalize_request(r, u, 1127 ngx_http_upstream_finalize_request(r, u,
1126 NGX_HTTP_INTERNAL_SERVER_ERROR); 1128 NGX_HTTP_INTERNAL_SERVER_ERROR);
1127 return; 1129 return;
1128 } 1130 }
1129 1131
1130 return; 1132 return;
1131 } 1133 }
1132 1134
1133 if (n == 0) { 1135 if (n == 0) {
1134 ngx_log_error(NGX_LOG_ERR, rev->log, 0, 1136 ngx_log_error(NGX_LOG_ERR, rev->log, 0,
1135 "upstream prematurely closed connection"); 1137 "upstream prematurely closed connection");
1136 } 1138 }
1137 1139
1138 if (n == NGX_ERROR || n == 0) { 1140 if (n == NGX_ERROR || n == 0) {
1139 ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_ERROR); 1141 ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_ERROR);
1140 return; 1142 return;
1141 } 1143 }
1142 1144
1143 u->buffer.last += n; 1145 u->buffer.last += n;
1144 1146
1145 #if 0 1147 #if 0
1146 u->valid_header_in = 0; 1148 u->valid_header_in = 0;
1147 1149
1148 u->peer.cached = 0; 1150 u->peer.cached = 0;
1149 #endif 1151 #endif
1150 1152
1151 rc = u->process_header(r); 1153 rc = u->process_header(r);
1152 1154
1153 if (rc == NGX_AGAIN) { 1155 if (rc == NGX_AGAIN) {
1154 #if 0 1156
1155 ngx_add_timer(rev, u->read_timeout); 1157 if (u->buffer.pos == u->buffer.end) {
1156 #endif 1158 ngx_log_error(NGX_LOG_ERR, rev->log, 0,
1157 1159 "upstream sent too big header");
1158 if (u->buffer.pos == u->buffer.end) { 1160
1159 ngx_log_error(NGX_LOG_ERR, rev->log, 0, 1161 ngx_http_upstream_next(r, u,
1160 "upstream sent too big header"); 1162 NGX_HTTP_UPSTREAM_FT_INVALID_HEADER);
1161 1163 return;
1162 ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_INVALID_HEADER); 1164 }
1163 return; 1165
1164 } 1166 continue;
1165 1167 }
1166 if (ngx_handle_read_event(rev, 0) == NGX_ERROR) { 1168
1167 ngx_http_upstream_finalize_request(r, u, 1169 break;
1168 NGX_HTTP_INTERNAL_SERVER_ERROR);
1169 return;
1170 }
1171
1172 return;
1173 } 1170 }
1174 1171
1175 if (rc == NGX_HTTP_UPSTREAM_INVALID_HEADER) { 1172 if (rc == NGX_HTTP_UPSTREAM_INVALID_HEADER) {
1176 ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_INVALID_HEADER); 1173 ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_INVALID_HEADER);
1177 return; 1174 return;