]> granicus.if.org Git - curl/commitdiff
urldata: store POST size in state.infilesize too
authorDaniel Stenberg <daniel@haxx.se>
Sun, 7 Jun 2015 21:52:34 +0000 (23:52 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 14 Jun 2015 21:31:01 +0000 (23:31 +0200)
... to simplify checking when PUT _or_ POST have completed.

Reported-by: Frank Meier
Bug: http://curl.haxx.se/mail/lib-2015-06/0019.html

lib/http.c
lib/multi.c
lib/rtsp.c

index 8e422f0bf25809c55b83798a7154b024ebbe036e..7a5137e86cc37e14ea8e7fc34df83f6097c8d306 100644 (file)
@@ -424,8 +424,8 @@ static CURLcode http_perhapsrewind(struct connectdata *conn)
     /* figure out how much data we are expected to send */
     switch(data->set.httpreq) {
     case HTTPREQ_POST:
-      if(data->set.postfieldsize != -1)
-        expectsend = data->set.postfieldsize;
+      if(data->state.infilesize != -1)
+        expectsend = data->state.infilesize;
       else if(data->set.postfields)
         expectsend = (curl_off_t)strlen(data->set.postfields);
       break;
@@ -2572,8 +2572,8 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
       postsize = 0;
     else {
       /* figure out the size of the postfields */
-      postsize = (data->set.postfieldsize != -1)?
-        data->set.postfieldsize:
+      postsize = (data->state.infilesize != -1)?
+        data->state.infilesize:
         (data->set.postfields? (curl_off_t)strlen(data->set.postfields):-1);
     }
 
@@ -2696,7 +2696,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
           return result;
       }
 
-      else if(data->set.postfieldsize) {
+      else if(data->state.infilesize) {
         /* set the upload size to the progress meter */
         Curl_pgrsSetUploadSize(data, postsize?postsize:-1);
 
index 2956022e4a57a8a9fbcbdaf2b3e51d8e799b4685..b63f8bf70a6c1c716df2518142e23fc52c1e9cf8 100644 (file)
@@ -402,7 +402,10 @@ CURLMcode curl_multi_add_handle(CURLM *multi_handle,
   /* Point to the multi's connection cache */
   data->state.conn_cache = &multi->conn_cache;
 
-  data->state.infilesize = data->set.filesize;
+  if(data->set.httpreq == HTTPREQ_PUT)
+    data->state.infilesize = data->set.filesize;
+  else
+    data->state.infilesize = data->set.postfieldsize;
 
   /* This adds the new entry at the 'end' of the doubly-linked circular
      list of SessionHandle structs to try and maintain a FIFO queue so
index c5ca7572384f236874d219f704eda94d4e16d077..5d61c6fe2791e237f9e5dfc9b61b53dabf903a17 100644 (file)
@@ -495,8 +495,8 @@ static CURLcode rtsp_do(struct connectdata *conn, bool *done)
 
     }
     else {
-      postsize = (data->set.postfieldsize != -1)?
-        data->set.postfieldsize:
+      postsize = (data->state.infilesize != -1)?
+        data->state.infilesize:
         (data->set.postfields? (curl_off_t)strlen(data->set.postfields):0);
       data->set.httpreq = HTTPREQ_POST;
     }