]> granicus.if.org Git - curl/commitdiff
http2: move state-init from creation to pre-transfer
authorDaniel Stenberg <daniel@haxx.se>
Mon, 30 Sep 2019 07:30:58 +0000 (09:30 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 3 Oct 2019 20:55:42 +0000 (22:55 +0200)
To make sure that the HTTP/2 state is initialized correctly for
duplicated handles. It would otherwise easily generate "spurious"
PRIORITY frames to get sent over HTTP/2 connections when duplicated easy
handles were used.

Reported-by: Daniel Silverstone
Fixes #4303
Closes #4442

lib/http2.c
lib/transfer.c
lib/url.c

index d2f5da17a9de0734efb8067125fa4fb0c7393801..b5b831b56a7cad36b4b7080679cb4514dba6cacd 100644 (file)
@@ -1537,6 +1537,7 @@ static int h2_session_send(struct Curl_easy *data,
 
     H2BUGF(infof(data, "Queuing PRIORITY on stream %u (easy %p)\n",
                  stream->stream_id, data));
+    DEBUGASSERT(stream->stream_id != -1);
     rv = nghttp2_submit_priority(h2, NGHTTP2_FLAG_NONE, stream->stream_id,
                                  &pri_spec);
     if(rv)
index 421c8d2d0ec6ac7950ac0018fee054e009a67947..d0d4aeb500bb8ae42acf0fdd06d71d39e19c96a3 100644 (file)
@@ -1510,6 +1510,7 @@ CURLcode Curl_pretransfer(struct Curl_easy *data)
       }
     }
 #endif
+    Curl_http2_init_state(&data->state);
   }
 
   return result;
index 031f8f0c4297c90fe40b3b5066de770b2086921c..8538d24dd7f0153b0c57d9d28075ccfd780209a0 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -619,8 +619,6 @@ CURLcode Curl_open(struct Curl_easy **curl)
 
       data->progress.flags |= PGRS_HIDE;
       data->state.current_speed = -1; /* init to negative == impossible */
-
-      Curl_http2_init_state(&data->state);
     }
   }