]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
<rdar://problem/14290628> cups.org: cupsGetNamedDest returns the wrong default printe...
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Mon, 8 Jul 2013 11:20:33 +0000 (11:20 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Mon, 8 Jul 2013 11:20:33 +0000 (11:20 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@11101 a1ca3aef-8c08-0410-bb20-df032aa958be

CHANGES-1.6.txt
berkeley/lpq.c
berkeley/lpr.c
cups/dest.c
systemv/lp.c
systemv/lpstat.c

index 80775a79770e9f85ceb94106b9c6b757de8aed6d..e564c9d9301e4cd5c0fce1daa1c240f2fb9d87d6 100644 (file)
@@ -5,12 +5,14 @@ CHANGES IN CUPS V1.6.3
 
        - The configure script now prefers Clang over GCC.
        - Fixed a compile problem on AIX (STR #4307)
-       - httpStatus(HTTP_ERROR) did not return a useful error message
-         (<rdar://problem/14217326>)
+       - The lp, lpq, lpr, and lpstat now display an error message advising the
+         use of the /version=1.1 ServerName option (<rdar://problem/14290628>)
        - Added documentation about the /version=1.1 option to ServerName in
          client.conf (<rdar://problem/14216262>)
-       - The lp and lpr commands incorrectly ignored the default printer set
-         in the lpoptions file (<rdar://problem/14216472>)
+       - httpStatus(HTTP_ERROR) did not return a useful error message
+         (<rdar://problem/14217326>)
+       - The lp, lpq, lpr, and lpstat commands incorrectly ignored the default
+         printer set in the lpoptions file (<rdar://problem/14216472>)
        - Fixed a URI encoding issue for hostnames containing the ` (backquote)
          character (<rdar://problem/14243133>)
        - Added support for RFC 6874's IPv6 link local address format in URIs
index dcce2c0ed952edd8c78be16ea9c58432b8e07983..7e8d8baaa07373598081784a604e4e8e01a4e906 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   "lpq" command for CUPS.
  *
- *   Copyright 2007-2012 by Apple Inc.
+ *   Copyright 2007-2013 by Apple Inc.
  *   Copyright 1997-2006 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -60,8 +60,7 @@ main(int  argc,                               /* I - Number of command-line arguments */
                all,                    /* All printers */
                interval,               /* Reporting interval */
                longstatus;             /* Show file details */
-  int          num_dests;              /* Number of destinations */
-  cups_dest_t  *dests;                 /* Destinations */
+  cups_dest_t  *named_dest;            /* Named destination */
 
 
   _cupsSetLocale(argv);
@@ -77,8 +76,6 @@ main(int  argc,                               /* I - Number of command-line arguments */
   interval   = 0;
   longstatus = 0;
   all        = 0;
-  num_dests  = 0;
-  dests      = NULL;
 
   for (i = 1; i < argc; i ++)
     if (argv[i][0] == '+')
@@ -127,7 +124,6 @@ main(int  argc,                             /* I - Number of command-line arguments */
              if (i >= argc)
              {
                httpClose(http);
-               cupsFreeDests(num_dests, dests);
 
                usage();
              }
@@ -140,12 +136,14 @@ main(int  argc,                           /* I - Number of command-line arguments */
 
             http = connect_server(argv[0], http);
 
-            if (num_dests == 0)
-              num_dests = cupsGetDests2(http, &dests);
-
-            if (cupsGetDest(dest, instance, num_dests, dests) == NULL)
+            if ((named_dest = cupsGetNamedDest(http, dest, instance)) == NULL)
            {
-             if (instance)
+             if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+                 cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
+               _cupsLangPrintf(stderr,
+                               _("%s: Error - add '/version=1.1' to server "
+                                 "name."), argv[0]);
+             else if (instance)
                _cupsLangPrintf(stderr,
                                _("%s: Error - unknown destination \"%s/%s\"."),
                                argv[0], dest, instance);
@@ -155,6 +153,8 @@ main(int  argc,                             /* I - Number of command-line arguments */
 
              return (1);
            }
+
+           cupsFreeDests(1, named_dest);
            break;
 
        case 'a' : /* All printers */
@@ -192,7 +192,6 @@ main(int  argc,                             /* I - Number of command-line arguments */
 
        default :
            httpClose(http);
-           cupsFreeDests(num_dests, dests);
 
            usage();
            break;
@@ -207,15 +206,17 @@ main(int  argc,                           /* I - Number of command-line arguments */
 
   if (dest == NULL && !all)
   {
-    if (num_dests == 0)
-      num_dests = cupsGetDests2(http, &dests);
-
-    for (i = 0; i < num_dests; i ++)
-      if (dests[i].is_default)
-       dest = dests[i].name;
-
-    if (dest == NULL)
+    if ((named_dest = cupsGetNamedDest(http, NULL, NULL)) == NULL)
     {
+      if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+          cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
+      {
+       _cupsLangPrintf(stderr,
+                       _("%s: Error - add '/version=1.1' to server name."),
+                       argv[0]);
+        return (1);
+      }
+
       val = NULL;
 
       if ((dest = getenv("LPDEST")) == NULL)
@@ -231,7 +232,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
       else
        val = "LPDEST";
 
-      if (dest && !cupsGetDest(dest, NULL, num_dests, dests))
+      if (dest && val)
        _cupsLangPrintf(stderr,
                        _("%s: Error - %s environment variable names "
                          "non-existent destination \"%s\"."), argv[0], val,
@@ -241,9 +242,10 @@ main(int  argc,                            /* I - Number of command-line arguments */
                        _("%s: Error - no default destination available."),
                        argv[0]);
       httpClose(http);
-      cupsFreeDests(num_dests, dests);
       return (1);
     }
+
+    dest = named_dest->name;
   }
 
  /*
@@ -270,7 +272,6 @@ main(int  argc,                             /* I - Number of command-line arguments */
   * Close the connection to the server and return...
   */
 
-  cupsFreeDests(num_dests, dests);
   httpClose(http);
 
   return (0);
index 6e36beed7f2841ef3e10c99037e349218b8f9d0c..4b8957ffe1d172f2851c95c255c0a8e4ce7fd9a5 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   "lpr" command for CUPS.
  *
- *   Copyright 2007-2012 by Apple Inc.
+ *   Copyright 2007-2013 by Apple Inc.
  *   Copyright 1997-2007 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -61,6 +61,7 @@ main(int  argc,                               /* I - Number of command-line arguments */
 
   for (i = 1; i < argc; i ++)
     if (argv[i][0] == '-')
+    {
       switch (ch = argv[i][1])
       {
         case 'E' : /* Encrypt */
@@ -226,6 +227,14 @@ main(int  argc,                            /* I - Number of command-line arguments */
                                              dest->options[j].value,
                                              num_options, &options);
            }
+           else if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+                    cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
+           {
+             _cupsLangPrintf(stderr,
+                             _("%s: Error - add '/version=1.1' to server "
+                               "name."), argv[0]);
+             return (1);
+           }
            break;
 
        case '#' : /* Number of copies */
@@ -275,6 +284,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
                            argv[i][1]);
            return (1);
       }
+    }
     else if (num_files < 1000)
     {
      /*
@@ -320,6 +330,14 @@ main(int  argc,                            /* I - Number of command-line arguments */
                                      dest->options[j].value,
                                      num_options, &options);
     }
+    else if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+            cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
+    {
+      _cupsLangPrintf(stderr,
+                     _("%s: Error - add '/version=1.1' to server "
+                       "name."), argv[0]);
+      return (1);
+    }
   }
 
   if (printer == NULL)
index 2579d16a3a8d5be7c9468c7101792bd1a4f7b8f0..36481f80824815746fd94c44bcc20cc23bb3f39e 100644 (file)
@@ -1907,18 +1907,7 @@ cupsGetNamedDest(http_t     *http,       /* I - Connection to server or @code CUPS_HTT
   */
 
   if (!_cupsGetDests(http, op, name, &dest, 0, 0))
-  {
-    if (op == IPP_OP_CUPS_GET_DEFAULT || (name && !set_as_default))
-      return (NULL);
-
-   /*
-    * The default printer from environment variables or from a
-    * configuration file does not exist.  Find out the real default.
-    */
-
-    if (!_cupsGetDests(http, IPP_OP_CUPS_GET_DEFAULT, NULL, &dest, 0, 0))
-      return (NULL);
-  }
+    return (NULL);
 
   if (instance)
     dest->instance = _cupsStrAlloc(instance);
index 96728b26eaa8cd4992d51313a6686e2f62877b04..8f95966b4ff22b4b6abc3dac7166db5e609b77c4 100644 (file)
@@ -146,7 +146,8 @@ main(int  argc,                             /* I - Number of command-line arguments */
             if ((instance = strrchr(printer, '/')) != NULL)
              *instance++ = '\0';
 
-            if ((dest = cupsGetNamedDest(NULL, printer, instance)) != NULL)
+            if ((dest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, printer,
+                                         instance)) != NULL)
            {
              for (j = 0; j < dest->num_options; j ++)
                if (cupsGetOption(dest->options[j].name, num_options,
@@ -155,6 +156,14 @@ main(int  argc,                            /* I - Number of command-line arguments */
                                              dest->options[j].value,
                                              num_options, &options);
            }
+           else if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+                    cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
+           {
+             _cupsLangPrintf(stderr,
+                             _("%s: Error - add '/version=1.1' to server "
+                               "name."), argv[0]);
+             return (1);
+           }
            break;
 
         case 'f' : /* Form */
@@ -567,6 +576,14 @@ main(int  argc,                            /* I - Number of command-line arguments */
                                      dest->options[j].value,
                                      num_options, &options);
     }
+    else if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+            cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
+    {
+      _cupsLangPrintf(stderr,
+                     _("%s: Error - add '/version=1.1' to server "
+                       "name."), argv[0]);
+      return (1);
+    }
   }
 
   if (printer == NULL)
@@ -679,7 +696,15 @@ restart_job(const char *command,   /* I - Command name */
 
   ippDelete(cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/jobs"));
 
-  if (cupsLastError() > IPP_OK_CONFLICT)
+  if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+      cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
+  {
+    _cupsLangPrintf(stderr,
+                   _("%s: Error - add '/version=1.1' to server "
+                     "name."), command);
+    return (1);
+  }
+  else if (cupsLastError() > IPP_OK_CONFLICT)
   {
     _cupsLangPrintf(stderr, "%s: %s", command, cupsLastErrorString());
     return (1);
@@ -720,7 +745,15 @@ set_job_attrs(const char    *command,      /* I - Command name */
 
   ippDelete(cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/jobs"));
 
-  if (cupsLastError() > IPP_OK_CONFLICT)
+  if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+      cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
+  {
+    _cupsLangPrintf(stderr,
+                   _("%s: Error - add '/version=1.1' to server "
+                     "name."), command);
+    return (1);
+  }
+  else if (cupsLastError() > IPP_OK_CONFLICT)
   {
     _cupsLangPrintf(stderr, "%s: %s", command, cupsLastErrorString());
     return (1);
index 4d6495637f7b5eaf464079a5f0f3d3ea4b3e7abd..8ead3f143f8b0c42260ba173258c4643641e9132 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   "lpstat" command for CUPS.
  *
- *   Copyright 2007-2011 by Apple Inc.
+ *   Copyright 2007-2013 by Apple Inc.
  *   Copyright 1997-2006 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -199,6 +199,16 @@ main(int  argc,                            /* I - Number of command-line arguments */
              {
                cupsFreeDests(num_dests, dests);
                num_dests = cupsGetDests(&dests);
+
+               if (num_dests == 0 &&
+                   (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+                    cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED))
+               {
+                 _cupsLangPrintf(stderr,
+                                 _("%s: Error - add '/version=1.1' to server "
+                                   "name."), argv[0]);
+                 return (1);
+               }
              }
 
              status |= show_accepting(NULL, num_dests, dests);
@@ -235,6 +245,16 @@ main(int  argc,                            /* I - Number of command-line arguments */
 
              dests     = cupsGetNamedDest(CUPS_HTTP_DEFAULT, NULL, NULL);
              num_dests = dests ? 1 : 0;
+
+             if (num_dests == 0 &&
+                 (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+                  cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED))
+             {
+               _cupsLangPrintf(stderr,
+                               _("%s: Error - add '/version=1.1' to server "
+                                 "name."), argv[0]);
+               return (1);
+             }
            }
 
             show_default(dests);
@@ -316,6 +336,16 @@ main(int  argc,                            /* I - Number of command-line arguments */
              {
                cupsFreeDests(num_dests, dests);
                num_dests = cupsGetDests(&dests);
+
+               if (num_dests == 0 &&
+                   (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+                    cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED))
+               {
+                 _cupsLangPrintf(stderr,
+                                 _("%s: Error - add '/version=1.1' to server "
+                                   "name."), argv[0]);
+                 return (1);
+               }
              }
 
              status |= show_printers(NULL, num_dests, dests, long_status);
@@ -335,6 +365,16 @@ main(int  argc,                            /* I - Number of command-line arguments */
            {
              cupsFreeDests(num_dests, dests);
              num_dests = cupsGetDests(&dests);
+
+             if (num_dests == 0 &&
+                 (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+                  cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED))
+             {
+               _cupsLangPrintf(stderr,
+                               _("%s: Error - add '/version=1.1' to server "
+                                 "name."), argv[0]);
+               return (1);
+             }
            }
 
            show_default(cupsGetDest(NULL, NULL, num_dests, dests));
@@ -349,6 +389,16 @@ main(int  argc,                            /* I - Number of command-line arguments */
            {
              cupsFreeDests(num_dests, dests);
              num_dests = cupsGetDests(&dests);
+
+             if (num_dests == 0 &&
+                 (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+                  cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED))
+             {
+               _cupsLangPrintf(stderr,
+                               _("%s: Error - add '/version=1.1' to server "
+                                 "name."), argv[0]);
+               return (1);
+             }
            }
 
            show_scheduler();
@@ -398,6 +448,16 @@ main(int  argc,                            /* I - Number of command-line arguments */
              {
                cupsFreeDests(num_dests, dests);
                num_dests = cupsGetDests(&dests);
+
+               if (num_dests == 0 &&
+                   (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+                    cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED))
+               {
+                 _cupsLangPrintf(stderr,
+                                 _("%s: Error - add '/version=1.1' to server "
+                                   "name."), argv[0]);
+                 return (1);
+               }
              }
 
              status |= show_devices(NULL, num_dests, dests);
@@ -457,9 +517,16 @@ check_dest(const char  *command,   /* I  - Command name */
 
       if ((*dests = cupsGetNamedDest(CUPS_HTTP_DEFAULT, printer, pptr)) == NULL)
       {
-        _cupsLangPrintf(stderr,
-                       _("%s: Invalid destination name in list \"%s\"."),
-                       command, name);
+       if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+           cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
+         _cupsLangPrintf(stderr,
+                         _("%s: Error - add '/version=1.1' to server name."),
+                         command);
+       else
+         _cupsLangPrintf(stderr,
+                         _("%s: Invalid destination name in list \"%s\"."),
+                         command, name);
+
         exit(1);
       }
       else
@@ -511,8 +578,15 @@ check_dest(const char  *command,   /* I  - Command name */
 
     if (!cupsGetDest(printer, NULL, *num_dests, *dests))
     {
-      _cupsLangPrintf(stderr,
-                      _("%s: Unknown destination \"%s\"."), command, printer);
+      if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+          cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
+       _cupsLangPrintf(stderr,
+                       _("%s: Error - add '/version=1.1' to server name."),
+                       command);
+      else
+       _cupsLangPrintf(stderr,
+                       _("%s: Unknown destination \"%s\"."), command, printer);
+
       exit(1);
     }
   }
@@ -627,16 +701,27 @@ show_accepting(const char  *printers,     /* I - Destinations */
   * Do the request and get back a response...
   */
 
-  if ((response = cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/")) != NULL)
+  response = cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/");
+
+  if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+      cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
   {
-    DEBUG_puts("show_accepting: request succeeded...");
+    _cupsLangPrintf(stderr,
+                   _("%s: Error - add '/version=1.1' to server name."),
+                   "lpstat");
+    ippDelete(response);
+    return (1);
+  }
+  else if (cupsLastError() > IPP_STATUS_OK_CONFLICTING)
+  {
+    _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
+    ippDelete(response);
+    return (1);
+  }
 
-    if (response->request.status.status_code > IPP_OK_CONFLICT)
-    {
-      _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
-      ippDelete(response);
-      return (1);
-    }
+  if (response)
+  {
+    DEBUG_puts("show_accepting: request succeeded...");
 
    /*
     * Loop through the printers returned in the list and display
@@ -739,11 +824,6 @@ show_accepting(const char  *printers,      /* I - Destinations */
 
     ippDelete(response);
   }
-  else
-  {
-    _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
-    return (1);
-  }
 
   return (0);
 }
@@ -806,7 +886,25 @@ show_classes(const char *dests)            /* I - Destinations */
   * Do the request and get back a response...
   */
 
-  if ((response = cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/")) != NULL)
+  response = cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/");
+
+  if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+      cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
+  {
+    _cupsLangPrintf(stderr,
+                   _("%s: Error - add '/version=1.1' to server name."),
+                   "lpstat");
+    ippDelete(response);
+    return (1);
+  }
+  else if (cupsLastError() > IPP_STATUS_OK_CONFLICTING)
+  {
+    _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
+    ippDelete(response);
+    return (1);
+  }
+
+  if (response)
   {
     DEBUG_puts("show_classes: request succeeded...");
 
@@ -944,11 +1042,6 @@ show_classes(const char *dests)           /* I - Destinations */
 
     ippDelete(response);
   }
-  else
-  {
-    _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
-    return (1);
-  }
 
   return (0);
 }
@@ -1054,16 +1147,27 @@ show_devices(const char  *printers,     /* I - Destinations */
   * Do the request and get back a response...
   */
 
-  if ((response = cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/")) != NULL)
+  response = cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/");
+
+  if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+      cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
   {
-    DEBUG_puts("show_devices: request succeeded...");
+    _cupsLangPrintf(stderr,
+                   _("%s: Error - add '/version=1.1' to server name."),
+                   "lpstat");
+    ippDelete(response);
+    return (1);
+  }
+  else if (cupsLastError() > IPP_STATUS_OK_CONFLICTING)
+  {
+    _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
+    ippDelete(response);
+    return (1);
+  }
 
-    if (response->request.status.status_code > IPP_OK_CONFLICT)
-    {
-      _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
-      ippDelete(response);
-      return (1);
-    }
+  if (response)
+  {
+    DEBUG_puts("show_devices: request succeeded...");
 
    /*
     * Loop through the printers returned in the list and display
@@ -1203,11 +1307,6 @@ show_devices(const char  *printers,      /* I - Destinations */
 
     ippDelete(response);
   }
-  else
-  {
-    _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
-    return (1);
-  }
 
   return (0);
 }
@@ -1291,19 +1390,30 @@ show_jobs(const char *dests,            /* I - Destinations */
   * Do the request and get back a response...
   */
 
-  if ((response = cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/")) != NULL)
+  response = cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/");
+
+  if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+      cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
+  {
+    _cupsLangPrintf(stderr,
+                   _("%s: Error - add '/version=1.1' to server name."),
+                   "lpstat");
+    ippDelete(response);
+    return (1);
+  }
+  else if (cupsLastError() > IPP_STATUS_OK_CONFLICTING)
+  {
+    _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
+    ippDelete(response);
+    return (1);
+  }
+
+  if (response)
   {
    /*
     * Loop through the job list and display them...
     */
 
-    if (response->request.status.status_code > IPP_OK_CONFLICT)
-    {
-      _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
-      ippDelete(response);
-      return (1);
-    }
-
     rank = -1;
 
     for (attr = response->attrs; attr != NULL; attr = attr->next)
@@ -1449,11 +1559,6 @@ show_jobs(const char *dests,             /* I - Destinations */
 
     ippDelete(response);
   }
-  else
-  {
-    _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
-    return (1);
-  }
 
   return (0);
 }
@@ -1544,16 +1649,27 @@ show_printers(const char  *printers,    /* I - Destinations */
   * Do the request and get back a response...
   */
 
-  if ((response = cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/")) != NULL)
+  response = cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/");
+
+  if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+      cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
   {
-    DEBUG_puts("show_printers: request succeeded...");
+    _cupsLangPrintf(stderr,
+                   _("%s: Error - add '/version=1.1' to server name."),
+                   "lpstat");
+    ippDelete(response);
+    return (1);
+  }
+  else if (cupsLastError() > IPP_STATUS_OK_CONFLICTING)
+  {
+    _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
+    ippDelete(response);
+    return (1);
+  }
 
-    if (response->request.status.status_code > IPP_OK_CONFLICT)
-    {
-      _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
-      ippDelete(response);
-      return (1);
-    }
+  if (response)
+  {
+    DEBUG_puts("show_printers: request succeeded...");
 
    /*
     * Loop through the printers returned in the list and display
@@ -1975,11 +2091,6 @@ show_printers(const char  *printers,     /* I - Destinations */
 
     ippDelete(response);
   }
-  else
-  {
-    _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
-    return (1);
-  }
 
   return (0);
 }