]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/request.c
Merge changes from CUPS 1.6svn-r9968.
[thirdparty/cups.git] / cups / request.c
index e8b1425126a072bcc40a6838999096b80519e406..a38ec19604917975398dc40571fea4fbb48f0210 100644 (file)
@@ -283,26 +283,24 @@ cupsDoIORequest(http_t     *http, /* I - Connection to server or @code CUPS_HTTP
       break;
     }
 
-    if (response)
+    if (response && outfile >= 0)
     {
-      if (outfile >= 0)
-      {
-       /*
-        * Write trailing data to file...
-       */
+     /*
+      * Write trailing data to file...
+      */
 
-       while ((bytes = (int)httpRead2(http, buffer, sizeof(buffer))) > 0)
-         if (write(outfile, buffer, bytes) < bytes)
-           break;
-      }
-      else
-      {
-       /*
-        * Flush any remaining data...
-        */
+      while ((bytes = (int)httpRead2(http, buffer, sizeof(buffer))) > 0)
+       if (write(outfile, buffer, bytes) < bytes)
+         break;
+    }
 
-        httpFlush(http);
-      }
+    if (http->state != HTTP_WAITING)
+    {
+     /*
+      * Flush any remaining data...
+      */
+
+      httpFlush(http);
     }
   }