You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ic...@apache.org on 2015/07/17 16:52:12 UTC

svn commit: r1691582 - in /httpd/httpd/trunk/modules/http2: h2_config.h h2_h2.c

Author: icing
Date: Fri Jul 17 14:52:11 2015
New Revision: 1691582

URL: http://svn.apache.org/r1691582
Log:
fix for detecting direct mode on a TLS connections

Modified:
    httpd/httpd/trunk/modules/http2/h2_config.h
    httpd/httpd/trunk/modules/http2/h2_h2.c

Modified: httpd/httpd/trunk/modules/http2/h2_config.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_config.h?rev=1691582&r1=1691581&r2=1691582&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_config.h (original)
+++ httpd/httpd/trunk/modules/http2/h2_config.h Fri Jul 17 14:52:11 2015
@@ -59,7 +59,7 @@ typedef struct h2_config {
                                      processing, better compatibility */
     int hack_mpm_event;           /* If mpm_event is detected, perform a hack
                                      on stream connections to make it work */
-    int h2_direct;                /* if mod_h2 is active on non-TLS directly */
+    int h2_direct;                /* if mod_h2 is active directly */
     int buffer_output;            /* if output buffering shall be used */  
     int buffer_size;              /* size of buffer for outgoing data */  
     int write_max;                /* max number of bytes for a write op */  

Modified: httpd/httpd/trunk/modules/http2/h2_h2.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_h2.c?rev=1691582&r1=1691581&r2=1691582&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_h2.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_h2.c Fri Jul 17 14:52:11 2015
@@ -160,7 +160,7 @@ int h2_h2_process_conn(conn_rec* c)
     if (h2_ctx_pnego_is_ongoing(ctx)) {
         temp = apr_brigade_create(c->pool, c->bucket_alloc);
         ap_get_brigade(c->input_filters, temp,
-                       AP_MODE_SPECULATIVE, APR_BLOCK_READ, 1);
+                       AP_MODE_SPECULATIVE, APR_BLOCK_READ, 24);
         apr_brigade_destroy(temp);
     }
 
@@ -172,15 +172,22 @@ int h2_h2_process_conn(conn_rec* c)
         apr_status_t status;
         temp = apr_brigade_create(c->pool, c->bucket_alloc);
         status = ap_get_brigade(c->input_filters, temp,
-                                AP_MODE_SPECULATIVE, APR_BLOCK_READ, 24);
+                                /*h2_h2_is_tls(c)? AP_MODE_READBYTES :*/ AP_MODE_SPECULATIVE, APR_BLOCK_READ, 24);
         if (status == APR_SUCCESS) {
             char *s = NULL;
             apr_size_t slen;
             
             apr_brigade_pflatten(temp, &s, &slen, c->pool);
-            if ((slen == 24) && !memcmp(H2_MAGIC_TOKEN, s, 24)) {
+            if ((slen >= 24) && !memcmp(H2_MAGIC_TOKEN, s, 24)) {
+                ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, c,
+                              "h2_h2, direct mode detected");
                 h2_ctx_pnego_set_done(ctx, "h2");
             }
+            else {
+                ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, c,
+                              "h2_h2, not detected, seeing %d bytes: %s", 
+                              (int)slen, s);
+            }
         }
         apr_brigade_destroy(temp);
     }