read and process upstream header in cycle,

this fixes the case when local FastCGI server sends many warnings in stderr
This commit is contained in:
Igor Sysoev 2008-12-01 14:08:00 +00:00
parent c6016b25cf
commit 15fbaa6612

View File

@ -1114,6 +1114,8 @@ ngx_http_upstream_process_header(ngx_event_t *rev)
#endif
}
for ( ;; ) {
n = c->recv(c, u->buffer.last, u->buffer.end - u->buffer.last);
if (n == NGX_AGAIN) {
@ -1151,25 +1153,20 @@ ngx_http_upstream_process_header(ngx_event_t *rev)
rc = u->process_header(r);
if (rc == NGX_AGAIN) {
#if 0
ngx_add_timer(rev, u->read_timeout);
#endif
if (u->buffer.pos == u->buffer.end) {
ngx_log_error(NGX_LOG_ERR, rev->log, 0,
"upstream sent too big header");
ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_INVALID_HEADER);
ngx_http_upstream_next(r, u,
NGX_HTTP_UPSTREAM_FT_INVALID_HEADER);
return;
}
if (ngx_handle_read_event(rev, 0) == NGX_ERROR) {
ngx_http_upstream_finalize_request(r, u,
NGX_HTTP_INTERNAL_SERVER_ERROR);
return;
continue;
}
return;
break;
}
if (rc == NGX_HTTP_UPSTREAM_INVALID_HEADER) {