From: mike Date: Fri, 21 Sep 2012 14:38:32 +0000 (+0000) Subject: Work around some broken IPP printers (STR #4190) X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a2387f4f83503a460523e430330e955afc980730;p=thirdparty%2Fcups.git Work around some broken IPP printers (STR #4190) Also catch late authentication issues so the backend doesn't just spin on a print request that will never succeed. git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@10612 7a7537e8-13f0-0310-91df-b6672ffda945 --- diff --git a/CHANGES-1.6.txt b/CHANGES-1.6.txt index c3b27101a7..32c6fe204e 100644 --- a/CHANGES-1.6.txt +++ b/CHANGES-1.6.txt @@ -4,6 +4,8 @@ CHANGES-1.6.txt CHANGES IN CUPS V1.6.2 - Documentation fixes + - The IPP backend now works around some conformance issues for broken + printers (STR #4190) - cupsBackendReport() now filters out all control characters from the reported 1284 device IDs (STR #4124) - The scheduler no longer allows job-name values that are not valid diff --git a/backend/ipp.c b/backend/ipp.c index 15905db62d..fcbf647d18 100644 --- a/backend/ipp.c +++ b/backend/ipp.c @@ -1278,6 +1278,16 @@ main(int argc, /* I - Number of command-line args */ compatsize = fileinfo.st_size; } + /* + * If the printer only claims to support IPP/1.0, or if the user specifically + * included version=1.0 in the URI, then do not try to use Create-Job or + * Send-Document. This is another dreaded compatibility hack, but unfortunately + * there are enough broken printers out there that we need this for now... + */ + + if (version == 10) + create_job = send_document = 0; + /* * Start monitoring the printer in the background... */ @@ -1494,10 +1504,9 @@ main(int argc, /* I - Number of command-line args */ goto cleanup; } } - else if (ipp_status == IPP_ERROR_JOB_CANCELED) + else if (ipp_status == IPP_ERROR_JOB_CANCELED || + ipp_status == IPP_NOT_AUTHORIZED) goto cleanup; - else if (ipp_status == IPP_NOT_AUTHORIZED) - continue; else { /* @@ -1678,14 +1687,35 @@ main(int argc, /* I - Number of command-line args */ ipp_status == IPP_NOT_POSSIBLE || ipp_status == IPP_PRINTER_BUSY) continue; - else if (ipp_status == IPP_REQUEST_VALUE) + else if (ipp_status == IPP_REQUEST_VALUE || + ipp_status == IPP_ERROR_JOB_CANCELED || + ipp_status == IPP_NOT_AUTHORIZED) { /* - * Print file is too large, abort this job... + * Print file is too large, job was canceled, or we need new + * authentication data... */ goto cleanup; } + else if (ipp_status == IPP_NOT_FOUND) + { + /* + * Printer does not actually implement support for Create-Job/ + * Send-Document, so log the conformance issue and stop the printer. + */ + + fputs("DEBUG: This printer claims to support Create-Job and " + "Send-Document, but those operations failed.\n", stderr); + fputs("DEBUG: Add '?version=1.0' to the device URI to use legacy " + "compatibility mode.\n", stderr); + update_reasons(NULL, "+cups-ipp-conformance-failure-report," + "cups-ipp-missing-send-document"); + + ipp_status = IPP_INTERNAL_ERROR; /* Force queue to stop */ + + goto cleanup; + } else copies_remaining --;