]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Add -R option to repeat on server-error-busy (Issue #153)
authorMichael R Sweet <michael.r.sweet@gmail.com>
Thu, 1 Apr 2021 17:12:22 +0000 (13:12 -0400)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Thu, 1 Apr 2021 17:12:22 +0000 (13:12 -0400)
CHANGES.md
tools/ipptool.c

index 0081a727ccc040236a6f8daeb36b0921b67927c9..9bebc1b7e64838fdbc1f91bc080880ae550aef3c 100644 (file)
@@ -21,6 +21,7 @@ CUPS v2.4rc1 (Pending)
 - The USB backend now runs as root (Issue #121)
 - Added pkg-config file for libcups (Issue #122)
 - Fixed a PPD memory leak caused by emulator definitions (Issue #124)
+- Added several features and improvements to `ipptool` (Issue #153)
 - The scheduler now includes the `[Job N]` prefix for job log messages, even
   when using syslog logging (Issue #154)
 - Added support for locales using the GB18030 character set (Issue #159)
index 084ebc8c4150371167814f6d45b4cbf8deae2fbe..6820fd460c9df616e524967ba8fd91df478cffb6 100644 (file)
@@ -106,6 +106,7 @@ typedef struct ipptool_test_s               /**** Test Data ****/
   http_encryption_t encryption;                /* Encryption for connection */
   int          family;                 /* Address family */
   ipptool_output_t output;             /* Output mode */
+  int          repeat_on_busy;         /* Repeat tests on server-error-busy */
   int          stop_after_include_error;
                                        /* Stop after include errors? */
   double       timeout;                /* Timeout for connection */
@@ -369,6 +370,10 @@ main(int  argc,                            /* I - Number of command-line args */
              }
               break;
 
+          case 'R' : /* Repeat on server-error-busy */
+              data.repeat_on_busy = 1;
+              break;
+
          case 'S' : /* Encrypt with SSL */
 #ifdef HAVE_TLS
              data.encryption = HTTP_ENCRYPT_ALWAYS;
@@ -1633,6 +1638,13 @@ do_test(_ipp_file_t    *f,               /* I - IPP data file */
       * values...
       */
 
+      if (ippGetStatusCode(response) == IPP_STATUS_ERROR_BUSY && data->repeat_on_busy)
+      {
+        // Repeat on a server-error-busy status code...
+        status_ok   = 1;
+        repeat_test = 1;
+      }
+
       for (i = 0, status_ok = 0; i < data->num_statuses; i ++)
       {
        if (data->statuses[i].if_defined &&
@@ -5095,6 +5107,7 @@ usage(void)
   _cupsLangPuts(stderr, _("-I                      Ignore errors"));
   _cupsLangPuts(stderr, _("-L                      Send requests using content-length"));
   _cupsLangPuts(stderr, _("-P filename.plist       Produce XML plist to a file and test report to standard output"));
+  _cupsLangPuts(stderr, _("-R                      Repeat tests on server-error-busy"));
   _cupsLangPuts(stderr, _("-S                      Test with encryption using HTTPS"));
   _cupsLangPuts(stderr, _("-T seconds              Set the receive/send timeout in seconds"));
   _cupsLangPuts(stderr, _("-V version              Set default IPP version"));