<div dir="ltr">Sorry for the typo.<div><br></div><div><div style="font-size:12.8px">diff -r 5e05118678af src/http/modules/ngx_http_ssl_<wbr>module.c</div><div style="font-size:12.8px">--- a/src/http/modules/ngx_http_<wbr>ssl_module.c<span class="gmail-m_9021655350707375599gmail-Apple-tab-span" style="white-space:pre-wrap">       </span>Mon May 29 23:33:38 2017 +0300</div><div style="font-size:12.8px">+++ b/src/http/modules/ngx_http_<wbr>ssl_module.c<span class="gmail-m_9021655350707375599gmail-Apple-tab-span" style="white-space:pre-wrap">       </span>Wed Jun 07 12:17:34 2017 -0400</div><div style="font-size:12.8px">@@ -234,6 +234,13 @@</div><div style="font-size:12.8px">       offsetof(ngx_http_ssl_srv_<wbr>conf_t, stapling_verify),</div><div style="font-size:12.8px">       NULL },</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">+    { ngx_string("ssl_h2"),</div><div style="font-size:12.8px">+      NGX_HTTP_MAIN_CONF|NGX_HTTP_<wbr>SRV_CONF|NGX_CONF_FLAG,</div><div style="font-size:12.8px">+      ngx_conf_set_flag_slot,</div><div style="font-size:12.8px">+      NGX_HTTP_SRV_CONF_OFFSET,</div><div style="font-size:12.8px">+      offsetof(ngx_http_ssl_srv_<wbr>conf_t, h2),</div><div style="font-size:12.8px">+      NULL },</div><div style="font-size:12.8px">+</div><div style="font-size:12.8px">       ngx_null_command</div><div style="font-size:12.8px"> };</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">@@ -343,16 +350,17 @@</div><div style="font-size:12.8px">     unsigned char *outlen, const unsigned char *in, unsigned int inlen,</div><div style="font-size:12.8px">     void *arg)</div><div style="font-size:12.8px"> {</div><div style="font-size:12.8px">-    unsigned int            srvlen;</div><div style="font-size:12.8px">-    unsigned char          *srv;</div><div style="font-size:12.8px">+    unsigned int               srvlen;</div><div style="font-size:12.8px">+    unsigned char             *srv;</div><div style="font-size:12.8px"> #if (NGX_DEBUG)</div><div style="font-size:12.8px">-    unsigned int            i;</div><div style="font-size:12.8px">+    unsigned int               i;</div><div style="font-size:12.8px"> #endif</div><div style="font-size:12.8px"> #if (NGX_HTTP_V2)</div><div style="font-size:12.8px">-    ngx_http_connection_t  *hc;</div><div style="font-size:12.8px">+    ngx_http_connection_t     *hc;</div><div style="font-size:12.8px">+    ngx_http_ssl_srv_conf_t   *sscf;</div><div style="font-size:12.8px"> #endif</div><div style="font-size:12.8px"> #if (NGX_HTTP_V2 || NGX_DEBUG)</div><div style="font-size:12.8px">-    ngx_connection_t       *c;</div><div style="font-size:12.8px">+    ngx_connection_t          *c;</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">     c = ngx_ssl_get_connection(ssl_<wbr>conn);</div><div style="font-size:12.8px"> #endif</div><div style="font-size:12.8px">@@ -367,8 +375,9 @@</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"> #if (NGX_HTTP_V2)</div><div style="font-size:12.8px">     hc = c->data;</div><div style="font-size:12.8px">+    sscf = ngx_http_get_module_srv_conf(<wbr>hc->conf_ctx, ngx_http_ssl_module);</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">-    if (hc->addr_conf->http2) {</div><div style="font-size:12.8px">+    if (hc->addr_conf->http2 && sscf->h2) {</div><div style="font-size:12.8px">         srv =</div><div style="font-size:12.8px">            (unsigned char *) NGX_HTTP_V2_ALPN_ADVERTISE NGX_HTTP_NPN_ADVERTISE;</div><div style="font-size:12.8px">         srvlen = sizeof(NGX_HTTP_V2_ALPN_<wbr>ADVERTISE NGX_HTTP_NPN_ADVERTISE) - 1;</div><div style="font-size:12.8px">@@ -411,11 +420,13 @@</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"> #if (NGX_HTTP_V2)</div><div style="font-size:12.8px">     {</div><div style="font-size:12.8px">-    ngx_http_connection_t  *hc;</div><div style="font-size:12.8px">+    ngx_http_connection_t     *hc;</div><div style="font-size:12.8px">+    ngx_http_ssl_srv_conf_t   *sscf;</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">     hc = c->data;</div><div style="font-size:12.8px">+    sscf = ngx_http_get_module_srv_conf(<wbr>hc->conf_ctx, ngx_http_ssl_module);</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">-    if (hc->addr_conf->http2) {</div><div style="font-size:12.8px">+    if (hc->addr_conf->http2 && sscf->h2) {</div><div style="font-size:12.8px">         *out =</div><div style="font-size:12.8px">             (unsigned char *) NGX_HTTP_V2_NPN_ADVERTISE NGX_HTTP_NPN_ADVERTISE;</div><div style="font-size:12.8px">         *outlen = sizeof(NGX_HTTP_V2_NPN_<wbr>ADVERTISE NGX_HTTP_NPN_ADVERTISE) - 1;</div><div style="font-size:12.8px">@@ -555,6 +566,7 @@</div><div style="font-size:12.8px">     sscf->session_ticket_keys = NGX_CONF_UNSET_PTR;</div><div style="font-size:12.8px">     sscf->stapling = NGX_CONF_UNSET;</div><div style="font-size:12.8px">     sscf->stapling_verify = NGX_CONF_UNSET;</div><div style="font-size:12.8px">+    sscf->h2 = NGX_CONF_UNSET;</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">     return sscf;</div><div style="font-size:12.8px"> }</div><div style="font-size:12.8px">@@ -620,6 +632,8 @@</div><div style="font-size:12.8px">     ngx_conf_merge_str_value(<wbr>conf->stapling_responder,</div><div style="font-size:12.8px">                          prev->stapling_responder, "");</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">+    ngx_conf_merge_value(conf-><wbr>h2, prev->h2, 0);</div><div style="font-size:12.8px">+</div><div style="font-size:12.8px">     conf->ssl.log = cf->log;</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">     if (conf->enable) {</div><div style="font-size:12.8px">diff -r 5e05118678af src/http/modules/ngx_http_ssl_<wbr>module.h</div><div style="font-size:12.8px">--- a/src/http/modules/ngx_http_<wbr>ssl_module.h<span class="gmail-m_9021655350707375599gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>Mon May 29 23:33:38 2017 +0300</div><div style="font-size:12.8px">+++ b/src/http/modules/ngx_http_<wbr>ssl_module.h<span class="gmail-m_9021655350707375599gmail-Apple-tab-span" style="white-space:pre-wrap">       </span>Wed Jun 07 12:17:34 2017 -0400</div><div style="font-size:12.8px">@@ -57,6 +57,8 @@</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">     u_char                         *file;</div><div style="font-size:12.8px">     ngx_uint_t                      line;</div><div style="font-size:12.8px">+</div><div style="font-size:12.8px">+    ngx_flag_t                      h2;</div><div style="font-size:12.8px"> } ngx_http_ssl_srv_conf_t;</div></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 8, 2017 at 12:07 PM, 洪志道 <span dir="ltr"><<a href="mailto:hongzhidao@gmail.com" target="_blank">hongzhidao@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><h1 id="m_9021655350707375599gmail-trac-ticket-title" class="m_9021655350707375599gmail-searchable" style="font-family:Arial,Verdana,"Bitstream Vera Sans",Helvetica,sans-serif;letter-spacing:-0.018em;margin:0.4em 0px 0.5em;clear:right;color:rgb(0,0,0)"><font size="2"><span style="font-weight:normal">Hi!</span></font></h1><div><span class="m_9021655350707375599gmail-summary">Now, http2 is enabled globally for 'listen' directive with ip:port.</span></div><div><span class="m_9021655350707375599gmail-summary">It seems it's possible to enable by server with sni, alpn, npn.</span></div><div>Take a look, please.</div><div><span class="m_9021655350707375599gmail-summary"><br></span></div><div><span class="m_9021655350707375599gmail-summary"><div>diff -r 5e05118678af src/http/modules/ngx_http_ssl_<wbr>module.c</div><div>--- a/src/http/modules/ngx_http_<wbr>ssl_module.c<span class="m_9021655350707375599gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>Mon May 29 23:33:38 2017 +0300</div><div>+++ b/src/http/modules/ngx_http_<wbr>ssl_module.c<span class="m_9021655350707375599gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>Wed Jun 07 12:17:34 2017 -0400</div><div>@@ -234,6 +234,13 @@</div><div>       offsetof(ngx_http_ssl_srv_<wbr>conf_t, stapling_verify),</div><div>       NULL },</div><div><br></div><div>+    { ngx_string("ssl_h2"),</div><div>+      NGX_HTTP_MAIN_CONF|NGX_HTTP_<wbr>SRV_CONF|NGX_CONF_FLAG,</div><div>+      ngx_http_ssl_enable,</div><div>+      NGX_HTTP_SRV_CONF_OFFSET,</div><div>+      offsetof(ngx_http_ssl_srv_<wbr>conf_t, h2),</div><div>+      NULL },</div><div>+</div><div>       ngx_null_command</div><div> };</div><div><br></div><div>@@ -343,16 +350,17 @@</div><div>     unsigned char *outlen, const unsigned char *in, unsigned int inlen,</div><div>     void *arg)</div><div> {</div><div>-    unsigned int            srvlen;</div><div>-    unsigned char          *srv;</div><div>+    unsigned int               srvlen;</div><div>+    unsigned char             *srv;</div><div> #if (NGX_DEBUG)</div><div>-    unsigned int            i;</div><div>+    unsigned int               i;</div><div> #endif</div><div> #if (NGX_HTTP_V2)</div><div>-    ngx_http_connection_t  *hc;</div><div>+    ngx_http_connection_t     *hc;</div><div>+    ngx_http_ssl_srv_conf_t   *sscf;</div><div> #endif</div><div> #if (NGX_HTTP_V2 || NGX_DEBUG)</div><div>-    ngx_connection_t       *c;</div><div>+    ngx_connection_t          *c;</div><div><br></div><div>     c = ngx_ssl_get_connection(ssl_<wbr>conn);</div><div> #endif</div><div>@@ -367,8 +375,9 @@</div><div><br></div><div> #if (NGX_HTTP_V2)</div><div>     hc = c->data;</div><div>+    sscf = ngx_http_get_module_srv_conf(<wbr>hc->conf_ctx, ngx_http_ssl_module);</div><div><br></div><div>-    if (hc->addr_conf->http2) {</div><div>+    if (hc->addr_conf->http2 && sscf->h2) {</div><div>         srv =</div><div>            (unsigned char *) NGX_HTTP_V2_ALPN_ADVERTISE NGX_HTTP_NPN_ADVERTISE;</div><div>         srvlen = sizeof(NGX_HTTP_V2_ALPN_<wbr>ADVERTISE NGX_HTTP_NPN_ADVERTISE) - 1;</div><div>@@ -411,11 +420,13 @@</div><div><br></div><div> #if (NGX_HTTP_V2)</div><div>     {</div><div>-    ngx_http_connection_t  *hc;</div><div>+    ngx_http_connection_t     *hc;</div><div>+    ngx_http_ssl_srv_conf_t   *sscf;</div><div><br></div><div>     hc = c->data;</div><div>+    sscf = ngx_http_get_module_srv_conf(<wbr>hc->conf_ctx, ngx_http_ssl_module);</div><div><br></div><div>-    if (hc->addr_conf->http2) {</div><div>+    if (hc->addr_conf->http2 && sscf->h2) {</div><div>         *out =</div><div>             (unsigned char *) NGX_HTTP_V2_NPN_ADVERTISE NGX_HTTP_NPN_ADVERTISE;</div><div>         *outlen = sizeof(NGX_HTTP_V2_NPN_<wbr>ADVERTISE NGX_HTTP_NPN_ADVERTISE) - 1;</div><div>@@ -555,6 +566,7 @@</div><div>     sscf->session_ticket_keys = NGX_CONF_UNSET_PTR;</div><div>     sscf->stapling = NGX_CONF_UNSET;</div><div>     sscf->stapling_verify = NGX_CONF_UNSET;</div><div>+    sscf->h2 = NGX_CONF_UNSET;</div><div><br></div><div>     return sscf;</div><div> }</div><div>@@ -620,6 +632,8 @@</div><div>     ngx_conf_merge_str_value(<wbr>conf->stapling_responder,</div><div>                          prev->stapling_responder, "");</div><div><br></div><div>+    ngx_conf_merge_value(conf-><wbr>h2, prev->h2, 0);</div><div>+</div><div>     conf->ssl.log = cf->log;</div><div><br></div><div>     if (conf->enable) {</div><div>diff -r 5e05118678af src/http/modules/ngx_http_ssl_<wbr>module.h</div><div>--- a/src/http/modules/ngx_http_<wbr>ssl_module.h<span class="m_9021655350707375599gmail-Apple-tab-span" style="white-space:pre-wrap">  </span>Mon May 29 23:33:38 2017 +0300</div><div>+++ b/src/http/modules/ngx_http_<wbr>ssl_module.h<span class="m_9021655350707375599gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>Wed Jun 07 12:17:34 2017 -0400</div><div>@@ -57,6 +57,8 @@</div><div><br></div><div>     u_char                         *file;</div><div>     ngx_uint_t                      line;</div><div>+</div><div>+    ngx_flag_t                      h2;</div><div> } ngx_http_ssl_srv_conf_t;</div><div><br></div><div>Thanks.</div><div>B.R.</div></span></div><div><span class="m_9021655350707375599gmail-summary"><br></span></div></div>
</blockquote></div><br></div>