]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
url: make sure pushed streams get an allocated download buffer
authorDaniel Stenberg <daniel@haxx.se>
Tue, 23 Jun 2020 12:02:54 +0000 (14:02 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 23 Jun 2020 13:13:27 +0000 (15:13 +0200)
Follow-up to c4e6968127e876b0

When a new transfer is created, as a resuly of an acknowledged push,
that transfer needs a download buffer allocated.

Closes #5590

lib/multi.c
lib/multiif.h
lib/url.c

index 121a4459344a0b06bd456c79a431dde5f3afb344..b106c949514cb2747ce6d86c7fb9ebed7f6d7461 100644 (file)
@@ -1642,10 +1642,11 @@ static CURLcode protocol_connect(struct connectdata *conn,
 }
 
 /*
- * preconnect() is called immediately before a connect starts. When a redirect
- * is followed, this is then called multiple times during a single transfer.
+ * Curl_preconnect() is called immediately before a connect starts. When a
+ * redirect is followed, this is then called multiple times during a single
+ * transfer.
  */
-static CURLcode preconnect(struct Curl_easy *data)
+CURLcode Curl_preconnect(struct Curl_easy *data)
 {
   if(!data->state.buffer) {
     data->state.buffer = malloc(data->set.buffer_size + 1);
@@ -1763,7 +1764,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
     case CURLM_STATE_CONNECT:
       /* Connect. We want to get a connection identifier filled in. */
       /* init this transfer. */
-      result = preconnect(data);
+      result = Curl_preconnect(data);
       if(result)
         break;
 
index c07587baf24f4bc4d0f10894e21bca6081859d9b..7d574df9241f09f7847b00da8ff846c94f3e4e7e 100644 (file)
@@ -37,6 +37,7 @@ void Curl_detach_connnection(struct Curl_easy *data);
 bool Curl_multiplex_wanted(const struct Curl_multi *multi);
 void Curl_set_in_callback(struct Curl_easy *data, bool value);
 bool Curl_is_in_callback(struct Curl_easy *easy);
+CURLcode Curl_preconnect(struct Curl_easy *data);
 
 /* Internal version of curl_multi_init() accepts size parameters for the
    socket and connection hashes */
index 4021c5d782d70572b985a7c774df7ecf9a5f7659..8225e617a812a119b0e8bdc51cd57bd72bd1c176 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -3981,6 +3981,11 @@ CURLcode Curl_init_do(struct Curl_easy *data, struct connectdata *conn)
 {
   struct SingleRequest *k = &data->req;
 
+  /* if this is a pushed stream, we need this: */
+  CURLcode result = Curl_preconnect(data);
+  if(result)
+    return result;
+
   if(conn) {
     conn->bits.do_more = FALSE; /* by default there's no curl_do_more() to
                                    use */