]> granicus.if.org Git - curl/commitdiff
FILE: Fixed sending of data would always return CURLE_WRITE_ERROR
authorSteve Holme <steve_holme@hotmail.com>
Fri, 27 Dec 2013 10:55:01 +0000 (10:55 +0000)
committerSteve Holme <steve_holme@hotmail.com>
Fri, 27 Dec 2013 10:58:31 +0000 (10:58 +0000)
Introduced in commit 2a4ee0d2215556 sending of data via the FILE
protocol would always return CURLE_WRITE_ERROR regardless of whether
CURL_WRITEFUNC_PAUSE was returned from the callback function or not.

lib/sendf.c

index 8ffd43f474570ff4f3b9770d0a06e07444a3eb28..d508dfd3e687584fb24a8dd1b79ff5099f2795dc 100644 (file)
@@ -444,17 +444,17 @@ CURLcode Curl_client_write(struct connectdata *conn,
       wrote = len;
     }
 
-    if(conn->handler->flags & PROTOPT_NONETWORK) {
-      /* protocols that work without network cannot be paused. This is
-         actually only FILE:// just now, and it can't pause since the transfer
-         isn't done using the "normal" procedure. */
-      failf(data, "Write callback asked for PAUSE when not supported!");
-      return CURLE_WRITE_ERROR;
+    if(CURL_WRITEFUNC_PAUSE == wrote) {
+      if(conn->handler->flags & PROTOPT_NONETWORK) {
+        /* protocols that work without network cannot be paused. This is
+           actually only FILE:// just now, and it can't pause since the transfer
+           isn't done using the "normal" procedure. */
+        failf(data, "Write callback asked for PAUSE when not supported!");
+        return CURLE_WRITE_ERROR;
+      }
+      else
+        return pausewrite(data, type, ptr, len);
     }
-
-    else if(CURL_WRITEFUNC_PAUSE == wrote)
-      return pausewrite(data, type, ptr, len);
-
     else if(wrote != len) {
       failf(data, "Failed writing body (%zu != %zu)", wrote, len);
       return CURLE_WRITE_ERROR;