@@ -1,4595 +0,0 @@
-# HG changeset patch
-# User Weibin Yao <yaoweibin@gmail.com>
-# Date 1387716217 -28800
-# Sun Dec 22 20:43:37 2013 +0800
-# Node ID 53a3d5ba3ad95f01ed917832080ba9620b66bdc7
-# Parent a297b7ad6f941cd8a179e36f6f2eba833b1257a5
-Support SPDY v3
-* Upgrade protocol from SPDY v2 to SPDY v3
-* Flow control(upload and download)
-* Switch option between SPDY v2 and v3
-
-This patch were developed by Liangbing Li And Xiaochen Wang
-
-diff -r a297b7ad6f94 -r 53a3d5ba3ad9 auto/sources
---- a/auto/sources Fri Dec 20 16:18:25 2013 +0400
-+++ b/auto/sources Sun Dec 22 20:43:37 2013 +0800
-@@ -330,7 +330,8 @@
- src/http/ngx_http_spdy_module.h"
- HTTP_SPDY_SRCS="src/http/ngx_http_spdy.c \
- src/http/ngx_http_spdy_module.c \
-- src/http/ngx_http_spdy_filter_module.c"
-+ src/http/ngx_http_spdy_filter_module.c \
-+ src/http/ngx_http_spdy_v3.c"
-
-
- HTTP_CHARSET_FILTER_MODULE=ngx_http_charset_filter_module
-diff -r a297b7ad6f94 -r 53a3d5ba3ad9 src/http/modules/ngx_http_ssl_module.c
---- a/src/http/modules/ngx_http_ssl_module.c Fri Dec 20 16:18:25 2013 +0400
-+++ b/src/http/modules/ngx_http_ssl_module.c Sun Dec 22 20:43:37 2013 +0800
-@@ -9,6 +9,9 @@
- #include <ngx_core.h>
- #include <ngx_http.h>
-
-+#if NGX_HTTP_SPDY
-+#include <ngx_http_spdy_module.h>
-+#endif
-
- typedef ngx_int_t (*ngx_ssl_variable_handler_pt)(ngx_connection_t *c,
- ngx_pool_t *pool, ngx_str_t *s);
-@@ -298,13 +301,20 @@
-
- #if (NGX_HTTP_SPDY)
- {
-- ngx_http_connection_t *hc;
-+ ngx_http_connection_t *hc;
-+ ngx_http_spdy_srv_conf_t *sscf;
-
- hc = c->data;
-+ sscf = ngx_http_get_module_srv_conf(hc->conf_ctx, ngx_http_spdy_module);
-
- if (hc->addr_conf->spdy) {
-- *out = (unsigned char *) NGX_SPDY_NPN_ADVERTISE NGX_HTTP_NPN_ADVERTISE;
-- *outlen = sizeof(NGX_SPDY_NPN_ADVERTISE NGX_HTTP_NPN_ADVERTISE) - 1;
-+ if (sscf->version == NGX_SPDY_VERSION_V3) {
-+ *out = (unsigned char *) NGX_SPDY_V3_NPN_ADVERTISE NGX_HTTP_NPN_ADVERTISE;
-+ *outlen = sizeof(NGX_SPDY_V3_NPN_ADVERTISE NGX_HTTP_NPN_ADVERTISE) - 1;
-+ } else {
-+ *out = (unsigned char *) NGX_SPDY_NPN_ADVERTISE NGX_HTTP_NPN_ADVERTISE;
-+ *outlen = sizeof(NGX_SPDY_NPN_ADVERTISE NGX_HTTP_NPN_ADVERTISE) - 1;
-+ }
-
- return SSL_TLSEXT_ERR_OK;
- }
-diff -r a297b7ad6f94 -r 53a3d5ba3ad9 src/http/ngx_http_request.c
---- a/src/http/ngx_http_request.c Fri Dec 20 16:18:25 2013 +0400
-+++ b/src/http/ngx_http_request.c Sun Dec 22 20:43:37 2013 +0800
-@@ -9,6 +9,10 @@
- #include <ngx_core.h>
- #include <ngx_http.h>
-
-+#if (NGX_HTTP_SPDY && defined TLSEXT_TYPE_next_proto_neg)
-+#include <ngx_http_spdy_module.h>
-+#endif
-+
-
- static void ngx_http_wait_request_handler(ngx_event_t *ev);
- static void ngx_http_process_request_line(ngx_event_t *rev);
-@@ -730,9 +734,20 @@
-
- #if (NGX_HTTP_SPDY && defined TLSEXT_TYPE_next_proto_neg)
- {
-- unsigned int len;
-- const unsigned char *data;
-- static const ngx_str_t spdy = ngx_string(NGX_SPDY_NPN_NEGOTIATED);
-+ ngx_http_connection_t *hc;
-+ ngx_http_spdy_srv_conf_t *sscf;
-+ unsigned int len;
-+ const unsigned char *data;
-+ ngx_str_t spdy;
-+
-+ hc = c->data;
-+ sscf = ngx_http_get_module_srv_conf(hc->conf_ctx, ngx_http_spdy_module);
-+
-+ if (sscf->version == NGX_SPDY_VERSION_V3) {
-+ ngx_str_set(&spdy, NGX_SPDY_V3_NPN_NEGOTIATED);
-+ } else {
-+ ngx_str_set(&spdy, NGX_SPDY_NPN_NEGOTIATED);
-+ }
-
- SSL_get0_next_proto_negotiated(c->ssl->connection, &data, &len);
-
-diff -r a297b7ad6f94 -r 53a3d5ba3ad9 src/http/ngx_http_spdy.c
---- a/src/http/ngx_http_spdy.c Fri Dec 20 16:18:25 2013 +0400
-+++ b/src/http/ngx_http_spdy.c Sun Dec 22 20:43:37 2013 +0800
-@@ -145,8 +145,6 @@
- static void ngx_http_spdy_run_request(ngx_http_request_t *r);
- static ngx_int_t ngx_http_spdy_init_request_body(ngx_http_request_t *r);
-
--static void ngx_http_spdy_close_stream_handler(ngx_event_t *ev);
--
- static void ngx_http_spdy_handle_connection_handler(ngx_event_t *rev);
- static void ngx_http_spdy_keepalive_handler(ngx_event_t *rev);
- static void ngx_http_spdy_finalize_connection(ngx_http_spdy_connection_t *sc,
-@@ -210,6 +208,12 @@
-
- c = rev->data;
- hc = c->data;
-+ sscf = ngx_http_get_module_srv_conf(hc->conf_ctx, ngx_http_spdy_module);
-+
-+ if (sscf->version == NGX_SPDY_VERSION_V3) {
-+ ngx_http_spdy_v3_init(rev);
-+ return;
-+ }
-
- ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0,
- "init spdy request");
-@@ -234,6 +238,7 @@
-
- sc->connection = c;
- sc->http_connection = hc;
-+ sc->version = sscf->version;
-
- sc->handler = ngx_http_spdy_state_detect_settings;
-
-@@ -253,8 +258,6 @@
- sc->zstream_out.zfree = ngx_http_spdy_zfree;
- sc->zstream_out.opaque = sc;
-
-- sscf = ngx_http_get_module_srv_conf(hc->conf_ctx, ngx_http_spdy_module);
--
- rc = deflateInit2(&sc->zstream_out, (int) sscf->headers_comp,
- Z_DEFLATED, 11, 4, Z_DEFAULT_STRATEGY);
-
-@@ -522,7 +525,11 @@
- for ( /* void */ ; out; out = out->next) {
- if (out->handler(sc, out) != NGX_OK) {
- out->blocked = 1;
-- out->priority = NGX_SPDY_HIGHEST_PRIORITY;
-+ if (sc->version == NGX_SPDY_VERSION_V3) {
-+ out->priority = NGX_SPDY_V3_HIGHEST_PRIORITY;
-+ } else {
-+ out->priority = NGX_SPDY_HIGHEST_PRIORITY;
-+ }
- break;
- }
-
-@@ -2617,7 +2624,7 @@
- }
-
-
--static void
-+void
- ngx_http_spdy_close_stream_handler(ngx_event_t *ev)
- {
- ngx_connection_t *fc;
-@@ -2643,6 +2650,10 @@
- ngx_http_spdy_connection_t *sc;
-
- sc = stream->connection;
-+ if (sc->version == NGX_SPDY_VERSION_V3) {
-+ ngx_http_spdy_v3_close_stream(stream, rc);
-+ return;
-+ }
-
- ngx_log_debug2(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0,
- "spdy close stream %ui, processing %ui",
-diff -r a297b7ad6f94 -r 53a3d5ba3ad9 src/http/ngx_http_spdy.h
---- a/src/http/ngx_http_spdy.h Fri Dec 20 16:18:25 2013 +0400
-+++ b/src/http/ngx_http_spdy.h Sun Dec 22 20:43:37 2013 +0800
-@@ -15,11 +15,17 @@
- #include <zlib.h>
-
-
--#define NGX_SPDY_VERSION 2
-+#define NGX_SPDY_VERSION 2 /* default version */
-+#define NGX_SPDY_VERSION_V2 2
-+#define NGX_SPDY_VERSION_V3 3
-+#define NGX_SPDY_VERSION_V31 31 /* reserved */
-+#define NGX_SPDY_VERSION_V4 4 /* reserved */
-
- #ifdef TLSEXT_TYPE_next_proto_neg
- #define NGX_SPDY_NPN_ADVERTISE "\x06spdy/2"
- #define NGX_SPDY_NPN_NEGOTIATED "spdy/2"
-+#define NGX_SPDY_V3_NPN_ADVERTISE "\x06spdy/3"
-+#define NGX_SPDY_V3_NPN_NEGOTIATED "spdy/3"
- #endif
-
- #define NGX_SPDY_STATE_BUFFER_SIZE 16
-@@ -30,10 +36,11 @@
|