Author: rhuijben
Date: Sat Nov 14 10:36:15 2015
New Revision: 1714299

URL: http://svn.apache.org/viewvc?rev=1714299&view=rev
Log:
* buckets/http2_frame_buckets.c
  (serf__bucket_http2_unframe_read_info): Diagnose one specific kind of
    frame size error as a protocol error. This is most likely the error
    you get when you use h2direct against a not http/2 server.

Modified:
    serf/trunk/buckets/http2_frame_buckets.c

Modified: serf/trunk/buckets/http2_frame_buckets.c
URL: 
http://svn.apache.org/viewvc/serf/trunk/buckets/http2_frame_buckets.c?rev=1714299&r1=1714298&r2=1714299&view=diff
==============================================================================
--- serf/trunk/buckets/http2_frame_buckets.c (original)
+++ serf/trunk/buckets/http2_frame_buckets.c Sat Nov 14 10:36:15 2015
@@ -149,7 +149,23 @@ serf__bucket_http2_unframe_read_info(ser
             mandatory frame data.
           */
           if (ctx->max_payload_size < payload_length)
+            {
+              if (payload_length == 0x485454 && ctx->frame_type == 0x50
+                  && ctx->flags == 0x2F)
+                {
+                  /* We found "HTTP/" instead of an actual frame. This
+                     is clearly above the initial max payload size of 16384,
+                     which applies before we negotiate a bigger size.
+
+                     We found a HTTP/1.1 server that didn't understand our
+                     HTTP2 prefix "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"
+                   */
+
+                  return SERF_ERROR_HTTP2_PROTOCOL_ERROR;
+                }
+
               return SERF_ERROR_HTTP2_FRAME_SIZE_ERROR;
+            }
 
           status = (ctx->payload_remaining == 0) ? APR_EOF
                                                  : APR_SUCCESS;


Reply via email to