]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/http.c
Load cups into easysw/current.
[thirdparty/cups.git] / cups / http.c
index 84e20462007ff203d46ecc974858b09135f7dda6..504be39cfeff245e80d194413c48a7cd4bb50af9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: http.c 5753 2006-07-18 19:53:24Z mike $"
+ * "$Id: http.c 5889 2006-08-24 21:44:35Z mike $"
  *
  *   HTTP routines for the Common UNIX Printing System (CUPS).
  *
@@ -1100,15 +1100,20 @@ httpPrintf(http_t     *http,            /* I - HTTP connection */
 
   DEBUG_printf(("httpPrintf: %s", buf));
 
-  if (http->wused)
+  if (http->data_encoding == HTTP_ENCODE_FIELDS)
+    return (httpWrite2(http, buf, bytes));
+  else
   {
-    DEBUG_puts("    flushing existing data...");
+    if (http->wused)
+    {
+      DEBUG_puts("    flushing existing data...");
 
-    if (httpFlushWrite(http) < 0)
-      return (-1);
-  }
+      if (httpFlushWrite(http) < 0)
+       return (-1);
+    }
 
-  return (http_write(http, buf, bytes));
+    return (http_write(http, buf, bytes));
+  }
 }
 
 
@@ -1888,7 +1893,7 @@ httpWrite2(http_t     *http,              /* I - HTTP connection */
       httpFlushWrite(http);
     }
 
-    if ((length + http->wused) <= sizeof(http->wbuffer))
+    if ((length + http->wused) < sizeof(http->wbuffer))
     {
      /*
       * Write to buffer...
@@ -2154,11 +2159,20 @@ http_send(http_t       *http,   /* I - HTTP connection */
     if (httpReconnect(http))
       return (-1);
 
+ /*
+  * Flush any written data that is pending...
+  */
+
+  if (http->wused)
+    httpFlushWrite(http);
+
  /*
   * Send the request header...
   */
 
-  http->state = request;
+  http->state         = request;
+  http->data_encoding = HTTP_ENCODE_FIELDS;
+
   if (request == HTTP_POST || request == HTTP_PUT)
     http->state ++;
 
@@ -2211,6 +2225,7 @@ http_send(http_t       *http,     /* I - HTTP connection */
     return (-1);
   }
 
+  httpFlushWrite(http);
   httpGetLength2(http);
   httpClearFields(http);
 
@@ -2811,5 +2826,5 @@ http_write_ssl(http_t     *http,  /* I - HTTP connection */
 
 
 /*
- * End of "$Id: http.c 5753 2006-07-18 19:53:24Z mike $".
+ * End of "$Id: http.c 5889 2006-08-24 21:44:35Z mike $".
  */