Skip to content

Commit

Permalink
Retry Validate-Job operation as needed (OpenPrinting #132)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed Apr 9, 2021
1 parent 1ab278c commit aebc6d3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ Changes in CUPS v2.3.5
- `httpUpdate` did not reset the socket file descriptor when the TLS
negotiation failed (Apple #5915)
- The `ippeveprinter` tool now automatically uses an available port.
- The IPP backend now retries Validate-Job requests (OpenPrinting #132)
- Removed support for the (long deprecated and unused) `KeepAliveTimeout`
directive in `cupsd.conf` (Issue #5733)

Expand Down
14 changes: 13 additions & 1 deletion backend/ipp.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/*
* IPP backend for CUPS.
*
* Copyright © 2007-2019 by Apple Inc.
* Copyright © 2021 by OpenPrinting
* Copyright © 2007-2021 by Apple Inc.
* Copyright © 1997-2007 by Easy Software Products, all rights reserved.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more
Expand Down Expand Up @@ -256,6 +257,7 @@ main(int argc, /* I - Number of command-line args */
get_job_attrs = 0, /* Does printer support Get-Job-Attributes? */
send_document = 0, /* Does printer support Send-Document? */
validate_job = 0, /* Does printer support Validate-Job? */
validate_retried = 0, /* Was Validate-Job request retried? */
copies, /* Number of copies for job */
copies_remaining; /* Number of copies remaining */
const char *content_type, /* CONTENT_TYPE environment variable */
Expand Down Expand Up @@ -1559,7 +1561,17 @@ main(int argc, /* I - Number of command-line args */
ipp_status == IPP_STATUS_ERROR_BAD_REQUEST)
break;
else if (job_auth == NULL && ipp_status > IPP_STATUS_ERROR_BAD_REQUEST)
{
if (!validate_retried)
{
// Retry Validate-Job operation once, to work around known printer bug...
validate_retried = 1;
sleep(10);
continue;
}

goto cleanup;
}
}

/*
Expand Down

0 comments on commit aebc6d3

Please sign in to comment.