]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Remove old private API.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Fri, 16 Nov 2012 19:33:55 +0000 (19:33 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Fri, 16 Nov 2012 19:33:55 +0000 (19:33 +0000)
Make sure we enable compression for Print-Job, too.

Update doco file.

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@10708 7a7537e8-13f0-0310-91df-b6672ffda945

backend/ipp.c
cups/http-addr.c
cups/http-private.h
cups/http.c
doc/help/man-ipptoolfile.html

index dcc60f8d1fa3180524c3f0e060a407ee460e551f..05843eadc902f891a2b7d853e85a6493862d2d3a 100644 (file)
@@ -1500,6 +1500,9 @@ main(int  argc,                           /* I - Number of command-line args */
       http_status = cupsSendRequest(http, request, resource, length);
       if (http_status == HTTP_CONTINUE && request->state == IPP_DATA)
       {
+       if (compression && strcmp(compression, "none"))
+         httpSetField(http, HTTP_FIELD_CONTENT_ENCODING, compression);
+
         if (num_files == 1)
         {
          if ((fd = open(files[0], O_RDONLY)) < 0)
@@ -1537,7 +1540,8 @@ main(int  argc,                           /* I - Number of command-line args */
             {
              fprintf(stderr, "DEBUG: Read %d bytes...\n", (int)bytes);
 
-             if (cupsWriteRequestData(http, buffer, bytes) != HTTP_CONTINUE)
+             if ((http_status = cupsWriteRequestData(http, buffer, bytes))
+                     != HTTP_CONTINUE)
                break;
            }
            else if (bytes == 0 || (errno != EINTR && errno != EAGAIN))
@@ -1545,6 +1549,10 @@ main(int  argc,                          /* I - Number of command-line args */
          }
        }
 
+       if (http_status == HTTP_ERROR)
+         fprintf(stderr, "DEBUG: Error writing document data for "
+                         "Print-Job: %s\n", strerror(httpError(http)));
+
         if (num_files == 1)
          close(fd);
       }
@@ -1737,6 +1745,10 @@ main(int  argc,                          /* I - Number of command-line args */
            close(fd);
        }
 
+        if (http_status == HTTP_ERROR)
+          fprintf(stderr, "DEBUG: Error writing document data for "
+                          "Send-Document: %s\n", strerror(httpError(http)));
+
        ippDelete(cupsGetResponse(http, resource));
        ippDelete(request);
 
index 60c202a9aee5ed7b754014c6f5166d6197a9f9a4..4513ff8185da3b6dac4a2c3ffbcc528a8b8a6efb 100644 (file)
@@ -382,13 +382,6 @@ httpAddrPort(http_addr_t *addr)            /* I - Address */
     return (ippPort());
 }
 
-int                                    /* O - Port number */
-_httpAddrPort(http_addr_t *addr)       /* I - Address */
-{
- /* TODO: Remove in CUPS 1.8 */
-  return (httpAddrPort(addr));
-}
-
 
 /*
  * '_httpAddrSetPort()' - Set the port number associated with an address.
index af6b3a47ad725365c6234704307892974b2ffa48..dd33fecb40b2a4138f35ec836daf293f6fcf7a99 100644 (file)
@@ -403,9 +403,6 @@ extern void _cups_freeifaddrs(struct ifaddrs *addrs);
  */
 
 #define                        _httpAddrFamily(addrp) (addrp)->addr.sa_family
-extern int             _httpAddrPort(http_addr_t *addr)
-                                     _CUPS_DEPRECATED_MSG("Use httpAddrPort "
-                                                          "instead.");
 extern void            _httpAddrSetPort(http_addr_t *addr, int port);
 extern char            *_httpAssembleUUID(const char *server, int port,
                                           const char *name, int number,
@@ -422,8 +419,6 @@ extern void         _httpDisconnect(http_t *http);
 extern char            *_httpEncodeURI(char *dst, const char *src,
                                        size_t dstsize);
 extern void            _httpFreeCredentials(http_tls_credentials_t credentials);
-extern ssize_t         _httpPeek(http_t *http, char *buffer, size_t length)
-                                 _CUPS_DEPRECATED_MSG("Use httpPeek instead.");
 extern const char      *_httpResolveURI(const char *uri, char *resolved_uri,
                                         size_t resolved_size, int options,
                                         int (*cb)(void *context),
index c8b5f09a0881608b9fcf9addf06d3e7af6d8c161..0c5ad99b88b8f16ce080e7461879e7dd1c55f509 100644 (file)
@@ -996,6 +996,11 @@ httpFlush(http_t *http)                    /* I - Connection to server */
     * Didn't get the data back, so close the current connection.
     */
 
+#ifdef HAVE_LIBZ
+    if (http->coding)
+      http_content_coding_finish(http);
+#endif /* HAVE_LIBZ */
+
     DEBUG_puts("1httpFlush: Setting state to HTTP_STATE_WAITING and closing.");
 
     http->state = HTTP_STATE_WAITING;
@@ -1955,6 +1960,11 @@ httpPeek(http_t *http,                   /* I - Connection to server */
     if (http->data_encoding == HTTP_ENCODING_CHUNKED)
       httpGets(len, sizeof(len), http);
 
+#ifdef HAVE_LIBZ
+    if (http->coding)
+      http_content_coding_finish(http);
+#endif /* HAVE_LIBZ */
+
     if (http->state == HTTP_STATE_POST_RECV)
       http->state ++;
     else
@@ -2101,15 +2111,6 @@ httpPeek(http_t *http,                   /* I - Connection to server */
   return (bytes);
 }
 
-ssize_t                                        /* O - Number of bytes copied */
-_httpPeek(http_t *http,                        /* I - Connection to server */
-          char   *buffer,              /* I - Buffer for data */
-         size_t length)                /* I - Maximum number of bytes */
-{
- /* TODO: Remove in CUPS 1.8 */
-  return (httpPeek(http, buffer, length));
-}
-
 
 /*
  * 'httpPost()' - Send a POST request to the server.
@@ -2226,20 +2227,33 @@ httpRead2(http_t *http,                 /* I - Connection to server */
   if (http->data_encoding == HTTP_ENCODING_CHUNKED &&
       http->data_remaining <= 0)
   {
-    DEBUG_puts("2httpRead2: Getting chunk length...");
-
-    if (httpGets(len, sizeof(len), http) == NULL)
+    if (!httpGets(len, sizeof(len), http))
     {
-      DEBUG_puts("1httpRead2: Could not get length!");
+      DEBUG_puts("1httpRead2: Could not get chunk length.");
       return (0);
     }
 
+    if (!len[0])
+    {
+      DEBUG_puts("1httpRead2: Blank chunk length, trying again...");
+      if (!httpGets(len, sizeof(len), http))
+      {
+       DEBUG_puts("1httpRead2: Could not get chunk length.");
+       return (0);
+      }
+    }
+
     http->data_remaining = strtoll(len, NULL, 16);
+
     if (http->data_remaining < 0)
     {
-      DEBUG_puts("1httpRead2: Negative chunk length!");
+      DEBUG_printf(("1httpRead2: Negative chunk length \"%s\" (" CUPS_LLFMT ")",
+                    len, CUPS_LLCAST http->data_remaining));
       return (0);
     }
+
+    DEBUG_printf(("2httpRead2: Got chunk length \"%s\" (" CUPS_LLFMT ")", len,
+                  CUPS_LLCAST http->data_remaining));
   }
 
   DEBUG_printf(("2httpRead2: data_remaining=" CUPS_LLFMT ", used=%d",
@@ -2553,10 +2567,13 @@ httpRead2(http_t *http,                 /* I - Connection to server */
     return (0);
   }
 
-  if (http->data_remaining == 0)
+  if (http->data_remaining <= 0)
   {
     if (http->data_encoding == HTTP_ENCODING_CHUNKED)
+    {
+      DEBUG_puts("1httpRead2: Reading trailing line for chunk.");
       httpGets(len, sizeof(len), http);
+    }
     else
     {
 #ifdef HAVE_LIBZ
@@ -3885,6 +3902,11 @@ httpWrite2(http_t     *http,             /* I - Connection to server */
 
     if (http->state == HTTP_STATE_POST_RECV)
     {
+#ifdef HAVE_LIBZ
+      if (http->coding)
+        http_content_coding_finish(http);
+#endif /* HAVE_LIBZ */
+
       http->state ++;
 
       DEBUG_printf(("2httpWrite2: Changed state to %s.",
index 645fd4a1f6a8113e142604cefb1a88bb3b66acd7..4029f42888e81d1f880d6c01f30fa67e951f6707 100644 (file)
@@ -171,6 +171,18 @@ character - escape commas using the "" character.
 same syntax as regular attributes and can themselves be nested collections.
 Multiple collection values can be supplied as needed.
 </dd>
+<dt>COMPRESSION deflate
+</dt>
+<dd></dd>
+<dt>COMPRESSION gzip
+</dt>
+<dd></dd>
+<dt>COMPRESSION none
+</dt>
+<dd></dd>
+<dd>Uses the specified compression on the document data following the attributes in
+a Print-Job or Send-Document request.
+</dd>
 <dt>DELAY seconds
 </dt>
 <dd>Specifies a delay before this test will be run.