ngx_http_upstream_process_non_buffered_request recv question

Maxim Dounin mdounin at mdounin.ru
Thu Jul 14 13:00:28 UTC 2016


Hello!

On Wed, Jul 13, 2016 at 11:09:47PM -0400, gaoyan09 wrote:

> size = b->end - b->last;
> 
>         if (size && upstream->read->ready) {
> 
>             n = upstream->recv(upstream, b->last, size);
> 
>             if (n == NGX_AGAIN) {
>                 break;
>             }
> 
>             if (n > 0) {
>                 u->state->response_length += n;
> 
>                 if (u->input_filter(u->input_filter_ctx, n) == NGX_ERROR) {
>                     ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
>                     return;
>                 }
>             }
> 
>             do_write = 1;
> 
>             continue;
>         }
> 
> Why not consider n==0 or n==NGX_ERROR as ngx_http_upstream_process_upgraded
> How handle it if upstream connection failed?

The upstream->read->eof and upstream->read->error flags are 
checked separately in the do_write code path, if there are no 
buffers to send downstream.

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx mailing list