Blob Blame Raw
diff -up cups-1.4.8/cups/request.c.upgrade cups-1.4.8/cups/request.c
--- cups-1.4.8/cups/request.c.upgrade	2012-02-16 17:01:09.529206191 +0000
+++ cups-1.4.8/cups/request.c	2012-02-16 17:08:53.228161464 +0000
@@ -247,16 +247,9 @@ cupsDoIORequest(http_t     *http,	/* I -
 
       while ((bytes = (int)read(infile, buffer, sizeof(buffer))) > 0)
       {
-	if (httpCheck(http))
-	{
-	  _httpUpdate(http, &status);
-
-	  if (status >= HTTP_MULTIPLE_CHOICES)
-	    break;
-        }
-
-  	if (httpWrite2(http, buffer, bytes) < bytes)
-          break;
+	if ((status = cupsWriteRequestData(http, buffer, bytes))
+                != HTTP_CONTINUE)
+	  break;
       }
     }
 
@@ -264,13 +257,11 @@ cupsDoIORequest(http_t     *http,	/* I -
     * Get the server's response...
     */
 
-    if (status == HTTP_CONTINUE || status == HTTP_OK)
+    if (status != HTTP_ERROR)
     {
       response = cupsGetResponse(http, resource);
-      status   = http->status;
+      status   = httpGetStatus(http);
     }
-    else
-      httpFlush(http);
 
     DEBUG_printf(("2cupsDoIORequest: status=%d", status));
 
@@ -707,7 +698,17 @@ cupsSendRequest(http_t     *http,	/* I -
     */
 
     if (status >= HTTP_MULTIPLE_CHOICES)
+    {
+      _cupsSetHTTPError(status);
+
+      do
+      {
+        status = httpUpdate(http);
+      }
+      while (status != HTTP_ERROR && http->state == HTTP_POST_RECV);
+
       httpFlush(http);
+    }
 
     switch (status)
     {
@@ -837,7 +838,17 @@ cupsWriteRequestData(
 
       _httpUpdate(http, &status);
       if (status >= HTTP_MULTIPLE_CHOICES)
+      {
+        _cupsSetHTTPError(status);
+
+        do
+        {
+          status = httpUpdate(http);
+        }
+        while (status != HTTP_ERROR && http->status == HTTP_POST_RECV);
+
         httpFlush(http);
+      }
 
       return (status);
     }