]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
The IPP backend did not detect all cases where a job should be retried using
authorMichael R Sweet <michael.r.sweet@gmail.com>
Mon, 7 Oct 2019 19:05:30 +0000 (15:05 -0400)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Mon, 7 Oct 2019 19:05:30 +0000 (15:05 -0400)
a raster format (rdar://56021091)

- Look for document-xxx reasons and client-error-document-xxx status codes from
  Send-Document and Print-Job requests.

CHANGES.md
backend/ipp.c

index ba78c244ac7711286c249dfec9906fdfa82607bb..0c9b7df239ff44ab6ce26c315101e53b5244962f 100644 (file)
@@ -10,6 +10,8 @@ Changes in CUPS v2.2.13
 - Fixed the default common name for TLS certificates used by `ippserver`.
 - The libusb-based USB backend now reports an error when the distribution
   permissions are wrong (Issue #5658)
+- The IPP backend did not detect all cases where a job should be retried using
+  a raster format (rdar://56021091)
 
 
 Changes in CUPS v2.2.12
index c364e19788db35ec7c253b90ab14e9c72163749c..23a46a7675320d945c14ae10eb264cf8eafc9ada 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * IPP backend for CUPS.
  *
- * Copyright 2007-2018 by Apple Inc.
+ * Copyright 2007-2019 by Apple Inc.
  * Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  * These coded instructions, statements, and computer programs are the
@@ -1459,6 +1459,8 @@ main(int  argc,                           /* I - Number of command-line args */
   monitor.printer_state = IPP_PSTATE_IDLE;
   monitor.retryable     = argc == 6 && document_format && strcmp(document_format, "image/pwg-raster") && strcmp(document_format, "image/urf");
 
+  fprintf(stderr, "DEBUG: retryable=%d\n", monitor.retryable);
+
   if (create_job)
   {
     monitor.job_name = argv[3];
@@ -1852,21 +1854,29 @@ main(int  argc,                         /* I - Number of command-line args */
        response = cupsGetResponse(http, resource);
        ippDelete(request);
 
-       fprintf(stderr, "DEBUG: Send-Document: %s (%s)\n",
-               ippErrorString(cupsLastError()), cupsLastErrorString());
+       fprintf(stderr, "DEBUG: Send-Document: %s (%s)\n", ippErrorString(cupsLastError()), cupsLastErrorString());
         debug_attributes(response);
-        ippDelete(response);
 
        if (cupsLastError() > IPP_STATUS_OK_CONFLICTING && !job_canceled)
        {
+         ipp_attribute_t *reasons = ippFindAttribute(response, "job-state-reasons", IPP_TAG_KEYWORD);
+                                       /* job-state-reasons values */
+
          ipp_status = cupsLastError();
 
-         _cupsLangPrintFilter(stderr, "ERROR",
-                              _("Unable to add document to print job."));
+          if (ippContainsString(reasons, "document-format-error"))
+            ipp_status = IPP_STATUS_ERROR_DOCUMENT_FORMAT_ERROR;
+          else if (ippContainsString(reasons, "document-unprintable"))
+            ipp_status = IPP_STATUS_ERROR_DOCUMENT_UNPRINTABLE;
+
+         ippDelete(response);
+         _cupsLangPrintFilter(stderr, "ERROR", _("Unable to add document to print job."));
          break;
        }
        else
        {
+         ippDelete(response);
+
          password_tries = 0;
 
          if (num_files == 0 || fd < 0)
@@ -1883,7 +1893,7 @@ main(int  argc,                           /* I - Number of command-line args */
       fprintf(stderr, "PAGE: 1 %d\n", copies_sup ? atoi(argv[4]) : 1);
       copies_remaining --;
     }
-    else if ((ipp_status == IPP_STATUS_ERROR_DOCUMENT_FORMAT_NOT_SUPPORTED || ipp_status == IPP_STATUS_ERROR_DOCUMENT_UNPRINTABLE) &&
+    else if ((ipp_status == IPP_STATUS_ERROR_DOCUMENT_FORMAT_NOT_SUPPORTED || ipp_status == IPP_STATUS_ERROR_DOCUMENT_FORMAT_ERROR || ipp_status == IPP_STATUS_ERROR_DOCUMENT_UNPRINTABLE) &&
              argc == 6 &&
              document_format && strcmp(document_format, "image/pwg-raster") && strcmp(document_format, "image/urf"))
     {