comparison src/http/ngx_http_spdy.c @ 5692:ed5fb7d22d46

SPDY: set log action for PROXY protocol only while parsing it. Handling of PROXY protocol for SPDY connection is currently implemented as a SPDY state. And while nginx waiting for PROXY protocol data it continues to process SPDY connection: initializes zlib context, sends control frames.
author Valentin Bartenev <vbart@nginx.com>
date Thu, 15 May 2014 19:22:06 +0400
parents 31349361558e
children 701d6e17e42c
comparison
equal deleted inserted replaced
5691:31349361558e 5692:ed5fb7d22d46
422 sc->send_window = NGX_SPDY_CONNECTION_WINDOW; 422 sc->send_window = NGX_SPDY_CONNECTION_WINDOW;
423 sc->recv_window = NGX_SPDY_CONNECTION_WINDOW; 423 sc->recv_window = NGX_SPDY_CONNECTION_WINDOW;
424 424
425 sc->init_window = NGX_SPDY_INIT_STREAM_WINDOW; 425 sc->init_window = NGX_SPDY_INIT_STREAM_WINDOW;
426 426
427 sc->handler = ngx_http_spdy_state_head; 427 sc->handler = hc->proxy_protocol ? ngx_http_spdy_proxy_protocol
428 428 : ngx_http_spdy_state_head;
429 if (hc->proxy_protocol) {
430 c->log->action = "reading PROXY protocol";
431 sc->handler = ngx_http_spdy_proxy_protocol;
432 }
433 429
434 sc->zstream_in.zalloc = ngx_http_spdy_zalloc; 430 sc->zstream_in.zalloc = ngx_http_spdy_zalloc;
435 sc->zstream_in.zfree = ngx_http_spdy_zfree; 431 sc->zstream_in.zfree = ngx_http_spdy_zfree;
436 sc->zstream_in.opaque = sc; 432 sc->zstream_in.opaque = sc;
437 433
821 817
822 static u_char * 818 static u_char *
823 ngx_http_spdy_proxy_protocol(ngx_http_spdy_connection_t *sc, u_char *pos, 819 ngx_http_spdy_proxy_protocol(ngx_http_spdy_connection_t *sc, u_char *pos,
824 u_char *end) 820 u_char *end)
825 { 821 {
822 ngx_log_t *log;
823
824 log = sc->connection->log;
825 log->action = "reading PROXY protocol";
826
826 pos = ngx_proxy_protocol_parse(sc->connection, pos, end); 827 pos = ngx_proxy_protocol_parse(sc->connection, pos, end);
828
829 log->action = "processing SPDY";
827 830
828 if (pos == NULL) { 831 if (pos == NULL) {
829 return ngx_http_spdy_state_protocol_error(sc); 832 return ngx_http_spdy_state_protocol_error(sc);
830 } 833 }
831
832 sc->connection->log->action = "processing SPDY";
833 834
834 return ngx_http_spdy_state_complete(sc, pos, end); 835 return ngx_http_spdy_state_complete(sc, pos, end);
835 } 836 }
836 837
837 838