]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Mirror 1.1.x changes.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Fri, 9 May 2003 18:35:38 +0000 (18:35 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Fri, 9 May 2003 18:35:38 +0000 (18:35 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/branches/branch-1.2@3700 7a7537e8-13f0-0310-91df-b6672ffda945

cups/http.c
cups/http.h

index 44740e375fdba01f803f29e04fe727d30d97c6af..863614e50147f17d3134c8dc69113955a4e0c174 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: http.c,v 1.82.2.32 2003/05/09 16:06:43 mike Exp $"
+ * "$Id: http.c,v 1.82.2.33 2003/05/09 18:35:37 mike Exp $"
  *
  *   HTTP routines for the Common UNIX Printing System (CUPS).
  *
@@ -899,14 +899,14 @@ httpRead(http_t *http,                    /* I - HTTP data */
     * Buffer small reads for better performance...
     */
 
+    if (!http->blocking && !httpWait(http, 1000))
+      return (0);
+
     if (http->data_remaining > sizeof(http->buffer))
       bytes = sizeof(http->buffer);
     else
       bytes = http->data_remaining;
 
-      if (!http->blocking && !httpWait(http, 1000))
-        return (0);
-
 #ifdef HAVE_SSL
     if (http->tls)
       bytes = http_read_ssl(http, http->buffer, bytes);
@@ -937,7 +937,7 @@ httpRead(http_t *http,                      /* I - HTTP data */
       }
 #endif /* WIN32 */
     }
-    else if (bytes == 0)
+    else
     {
       http->error = EPIPE;
       return (0);
@@ -961,16 +961,13 @@ httpRead(http_t *http,                    /* I - HTTP data */
   }
 #ifdef HAVE_SSL
   else if (http->tls)
-  {
-    if (!http->blocking && !httpWait(http, 1000))
-      return (0);
     bytes = http_read_ssl(http, buffer, length);
-  }
 #endif /* HAVE_SSL */
   else
   {
     if (!http->blocking && !httpWait(http, 1000))
       return (0);
+
     DEBUG_printf(("httpRead: reading %d bytes from socket...\n", length));
     bytes = recv(http->fd, buffer, length, 0);
     DEBUG_printf(("httpRead: read %d bytes from socket...\n", bytes));
@@ -989,10 +986,10 @@ httpRead(http_t *http,                    /* I - HTTP data */
       http->error = errno;
 #endif /* WIN32 */
   }
-  else if (bytes == 0)
+  else
   {
     http->error = EPIPE;
-    return 0;
+    return (0);
   }
 
   if (http->data_remaining == 0)
@@ -1325,15 +1322,15 @@ httpGets(char   *line,                  /* I - Line to read into */
       * No newline; see if there is more data to be read...
       */
 
-      if (!http->blocking && !httpWait(http, 1000))
-        return (NULL);
-
 #ifdef HAVE_SSL
       if (http->tls)
        bytes = http_read_ssl(http, bufend, HTTP_MAX_BUFFER - http->used);
       else
 #endif /* HAVE_SSL */
-      bytes = recv(http->fd, bufend, HTTP_MAX_BUFFER - http->used, 0);
+      if (!http->blocking && !httpWait(http, 1000))
+        return (NULL);
+      else
+        bytes = recv(http->fd, bufend, HTTP_MAX_BUFFER - http->used, 0);
 
       if (bytes < 0)
       {
@@ -1365,7 +1362,7 @@ httpGets(char   *line,                    /* I - Line to read into */
       }
       else if (bytes == 0)
       {
-         http->error = EPIPE;
+       http->error = EPIPE;
 
         return (NULL);
       }
@@ -2407,5 +2404,5 @@ CDSAWriteFunc(SSLConnectionRef connection,        /* I  - SSL/TLS connection */
 
 
 /*
- * End of "$Id: http.c,v 1.82.2.32 2003/05/09 16:06:43 mike Exp $".
+ * End of "$Id: http.c,v 1.82.2.33 2003/05/09 18:35:37 mike Exp $".
  */
index 362e23086def7709bdab2358b58843c8ab63f771..0c3d77518575d83f4eef294243e91f35d9e70731 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: http.h,v 1.33.2.17 2003/03/13 05:45:29 mike Exp $"
+ * "$Id: http.h,v 1.33.2.18 2003/05/09 18:35:38 mike Exp $"
  *
  *   Hyper-Text Transport Protocol definitions for the Common UNIX Printing
  *   System (CUPS).
@@ -371,7 +371,6 @@ extern void         httpSetField(http_t *http, http_field_t field,
 extern const char      *httpStatus(http_status_t status);
 extern int             httpTrace(http_t *http, const char *uri);
 extern http_status_t   httpUpdate(http_t *http);
-extern int             httpWait(http_t *http, int msec);
 extern int             httpWrite(http_t *http, const char *buffer, int length);
 extern char            *httpEncode64(char *out, const char *in);
 extern char            *httpDecode64(char *out, const char *in);
@@ -386,6 +385,7 @@ extern char         *httpMD5String(const md5_byte_t *, char [33]);
 extern void            httpClearCookie(http_t *http);
 #define httpGetCookie(http) ((http)->cookie)
 extern void            httpSetCookie(http_t *http, const char *cookie);
+extern int             httpWait(http_t *http, int msec);
 
 /**** New in CUPS 1.2 ****/
 extern int             httpAddrEqual(const http_addr_t *addr1,
@@ -409,5 +409,5 @@ extern char         *httpAddrString(const http_addr_t *addr,
 #endif /* !_IPP_HTTP_H_ */
 
 /*
- * End of "$Id: http.h,v 1.33.2.17 2003/03/13 05:45:29 mike Exp $".
+ * End of "$Id: http.h,v 1.33.2.18 2003/05/09 18:35:38 mike Exp $".
  */