[PATCH] RFC: ngx_http_upstream_process_upgraded: Allocate buffers also for data from upstream

Maxim Dounin mdounin at mdounin.ru
Mon Mar 17 02:39:28 UTC 2014


On Sat, Mar 15, 2014 at 11:11:51PM +0100, Thomas Glanzmann wrote:

> While using the ugprade funcationality of nginx to tunnel propiertary
> HTTP commands I noticed that data were only passing through from
> upstream to downstream but not the other way around. The reason for that
> was that no receive buffers for downstream were allocated. Normally the
> receiver buffers for upstream are allocated in
> ngx_http_upstream_process_header. In my case they were not because I
> upgrade the connection before exchanging any data. Maybe you consider
> this for upstream.

The u->buffer is allocated by ngx_http_upstream_process_header(), 
and ngx_http_upstream_upgrade() cannot be called bypassing 

That is, the change you suggest isn't needed in vanilla nginx 
(even with custom modules).

Maxim Dounin

More information about the nginx mailing list