]> granicus.if.org Git - apache/commitdiff
fix for detecting direct mode on a TLS connections
authorStefan Eissing <icing@apache.org>
Fri, 17 Jul 2015 14:52:11 +0000 (14:52 +0000)
committerStefan Eissing <icing@apache.org>
Fri, 17 Jul 2015 14:52:11 +0000 (14:52 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1691582 13f79535-47bb-0310-9956-ffa450edef68

modules/http2/h2_config.h
modules/http2/h2_h2.c

index e51fd276a612478ae2135483767374f4740ded0e..1ed0e58478de9ee78614ea35e20c9ec78e181956 100644 (file)
@@ -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 */  
index 8bc4383f3a9b938c945d2888903dd13c751e5bec..5c36f3fb109097f29ec17d8cbb7232be8d71c3a1 100644 (file)
@@ -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);
     }