diff options
author | Michael R Sweet <michael.r.sweet@gmail.com> | 2019-10-07 15:03:54 -0400 |
---|---|---|
committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2019-10-07 15:03:54 -0400 |
commit | 5b835597f35bce14f9b6018164ac2da2b4024e6d (patch) | |
tree | 7c9153ee601a36d84f6fc5c1e268eedced238c42 /backend | |
parent | 99c3e9f3f2a18d76fa080f6460bafed74a21bf6c (diff) | |
download | cups-5b835597f35bce14f9b6018164ac2da2b4024e6d.tar.gz |
The IPP backend did not detect all cases where a job should be retried using
a raster format (rdar://56021091)
- Look for document-xxx reason keywords and client-error-document-xxx status
codes after a Send-Document or Print-Job request.
Diffstat (limited to 'backend')
-rw-r--r-- | backend/ipp.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/backend/ipp.c b/backend/ipp.c index 8226acc7b..b2b22065e 100644 --- a/backend/ipp.c +++ b/backend/ipp.c @@ -1450,6 +1450,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]; @@ -1867,21 +1869,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) @@ -1898,7 +1908,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")) { |