]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fix a missing state change bug in httpWrite2().
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Thu, 31 Jan 2013 15:48:00 +0000 (15:48 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Thu, 31 Jan 2013 15:48:00 +0000 (15:48 +0000)
Add a deflate compression test file.

Add .pwg to the list of recognized extensions for PWG Raster.

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

cups/http.c
test/Makefile
test/ipp-everywhere.test
test/ippserver.c
test/ipptool.c
test/print-job-deflate.test [new file with mode: 0644]
tools/makeipptoolpkg

index c437a50ce6ae123865aadad997eab289e95e653f..e2d12c34bee3a7a2fc3c61da8ee101a725d7aeb1 100644 (file)
@@ -976,8 +976,19 @@ httpFlushWrite(http_t *http)               /* I - Connection to server */
   if (http->data_encoding == HTTP_ENCODING_CHUNKED)
     bytes = http_write_chunk(http, http->wbuffer, http->wused);
   else
+  {
     bytes = http_write(http, http->wbuffer, http->wused);
 
+    if (bytes > 0 && http->data_encoding == HTTP_ENCODING_LENGTH)
+    {
+      http->data_remaining -= bytes;
+
+      if (http->data_remaining <= 0)
+      {
+      }
+    }
+  }
+
   http->wused = 0;
 
   DEBUG_printf(("1httpFlushWrite: Returning %d, errno=%d.", bytes, errno));
@@ -3677,6 +3688,11 @@ httpWrite2(http_t     *http,             /* I - Connection to server */
     * data, go idle...
     */
 
+#ifdef HAVE_LIBZ
+    if (http->coding)
+      http_content_coding_finish(http);
+#endif /* HAVE_LIBZ */
+
     if (http->wused)
     {
       if (httpFlushWrite(http) < 0)
@@ -3700,17 +3716,12 @@ 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 ++;
+    else
+      http->state = HTTP_STATE_WAITING;
 
-      DEBUG_printf(("2httpWrite2: Changed state to %s.",
-                   http_states[http->state + 1]));
-    }
+    DEBUG_printf(("2httpWrite2: Changed state to %s.",
+                 http_states[http->state + 1]));
   }
 
   DEBUG_printf(("1httpWrite2: Returning " CUPS_LLFMT ".", CUPS_LLCAST bytes));
index 8f592290ec4f6b108288a115df12e25722433d67..b9375d76ae1fa86c4fbd8104fa27603f61938398 100644 (file)
@@ -48,6 +48,7 @@ TESTFILES     =       \
                        ipp-2.2.test \
                        ipp-everywhere.test \
                        print-job.test \
+                       print-job-deflate.test \
                        print-job-gzip.test
 OBJS           =       \
                        ippserver.o \
index 5ba8a9df2bb4bcf22af99ce95537190f3efd5554..4260cd815b836abeb8d1db018f85e6d79fd630d2 100644 (file)
@@ -18,7 +18,7 @@
 #
 
 # Do all of the IPP/1.1 and IPP/2.0 tests
-#INCLUDE "ipp-2.0.test"
+INCLUDE "ipp-2.0.test"
 
 
 # Test required printer description attribute support.
index ba4df8b86400f7d55f2a1c4827113cebc8b8054b..f1824771844e5b75fed2a8619230fefa10765537 100644 (file)
@@ -3824,7 +3824,8 @@ process_http(_ipp_client_t *client)       /* I - Client connection */
     if (httpError(client->http) == EPIPE)
       fprintf(stderr, "%s Client closed connection.\n", client->hostname);
     else
-      fprintf(stderr, "%s Bad request line.\n", client->hostname);
+      fprintf(stderr, "%s Bad request line (%s).\n", client->hostname,
+              strerror(httpError(client->http)));
 
     return (0);
   }
index 6dce7649635ce0ae43db8296862e6db4409cc4b5..99f3b5236abd07769c61f0e02e9d6e5b9d01f2b4 100644 (file)
@@ -478,7 +478,9 @@ main(int  argc,                             /* I - Number of command-line args */
                 else if (!_cups_strcasecmp(ext, ".ps") ||
                          !_cups_strcasecmp(ext, ".ps.gz"))
                   set_variable(&vars, "filetype", "application/postscript");
-                else if (!_cups_strcasecmp(ext, ".ras") ||
+                else if (!_cups_strcasecmp(ext, ".pwg") ||
+                         !_cups_strcasecmp(ext, ".pwg.gz") ||
+                         !_cups_strcasecmp(ext, ".ras") ||
                          !_cups_strcasecmp(ext, ".ras.gz"))
                   set_variable(&vars, "filetype", "image/pwg-raster");
                 else if (!_cups_strcasecmp(ext, ".txt") ||
diff --git a/test/print-job-deflate.test b/test/print-job-deflate.test
new file mode 100644 (file)
index 0000000..e54028d
--- /dev/null
@@ -0,0 +1,31 @@
+# Print a test page using print-job and compression=gzip
+{
+       # The name of the test...
+       NAME "Print file using Print-Job and compression=deflate"
+
+       # The operation to use
+       OPERATION Print-Job
+
+       # Attributes, starting in the operation group...
+       GROUP operation-attributes-tag
+       ATTR charset attributes-charset utf-8
+       ATTR language attributes-natural-language en
+       ATTR uri printer-uri $uri
+       ATTR name requesting-user-name $user
+       ATTR mimeMediaType document-format $filetype
+       ATTR keyword compression deflate
+
+       GROUP job-attributes-tag
+       ATTR integer copies 1
+
+       COMPRESSION deflate
+       FILE $filename
+
+       # What statuses are OK?
+       STATUS successful-ok
+       STATUS successful-ok-ignored-or-substituted-attributes
+
+       # What attributes do we expect?
+       EXPECT job-id
+       EXPECT job-uri
+}
index 1c2721a3c619410ec46ae6d6a661dfbd938158f1..f6552a85f873473f7e09d6085dba49dafc1a737a 100755 (executable)
@@ -66,6 +66,7 @@ cp test/ipptool-static $pkgdir/ipptool
 cp test/onepage-*.pdf $pkgdir
 cp test/onepage-*.ps $pkgdir
 cp test/print-job.test $pkgdir
+cp test/print-job-deflate.test $pkgdir
 cp test/print-job-gzip.test $pkgdir
 cp test/testfile.* $pkgdir