Index: berkeley/lpq.c
===================================================================
--- berkeley/lpq.c	(revision 11100)
+++ berkeley/lpq.c	(working copy)
@@ -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 @@
 		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 @@
   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 @@
 	      if (i >= argc)
 	      {
 		httpClose(http);
-		cupsFreeDests(num_dests, dests);

 	        usage();
 	      }
@@ -140,13 +136,15 @@

             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_BAD_REQUEST ||
+		  cupsLastError() == IPP_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);
               else
@@ -155,6 +153,8 @@

 	      return (1);
 	    }
+
+	    cupsFreeDests(1, named_dest);
 	    break;

 	case 'a' : /* All printers */
@@ -192,7 +192,6 @@

 	default :
 	    httpClose(http);
-	    cupsFreeDests(num_dests, dests);

 	    usage();
 	    break;
@@ -207,15 +206,17 @@

   if (dest == NULL && !all)
   {
-    if (num_dests == 0)
-      num_dests = cupsGetDests2(http, &dests);
+    if ((named_dest = cupsGetNamedDest(http, NULL, NULL)) == NULL)
+    {
+      if (cupsLastError() == IPP_BAD_REQUEST ||
+          cupsLastError() == IPP_VERSION_NOT_SUPPORTED)
+      {
+	_cupsLangPrintf(stderr,
+	                _("%s: Error - add '/version=1.1' to server name."),
+			argv[0]);
+        return (1);
+      }

-    for (i = 0; i < num_dests; i ++)
-      if (dests[i].is_default)
-	dest = dests[i].name;
-
-    if (dest == NULL)
-    {
       val = NULL;

       if ((dest = getenv("LPDEST")) == NULL)
@@ -231,7 +232,7 @@
       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 @@
 	                _("%s: Error - no default destination available."),
 			argv[0]);
       httpClose(http);
-      cupsFreeDests(num_dests, dests);
       return (1);
     }
+
+    dest = named_dest->name;
   }

  /*
@@ -270,7 +272,6 @@
   * Close the connection to the server and return...
   */

-  cupsFreeDests(num_dests, dests);
   httpClose(http);

   return (0);
Index: berkeley/lpr.c
===================================================================
--- berkeley/lpr.c	(revision 11100)
+++ berkeley/lpr.c	(working copy)
@@ -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 @@

   for (i = 1; i < argc; i ++)
     if (argv[i][0] == '-')
+    {
       switch (ch = argv[i][1])
       {
         case 'E' : /* Encrypt */
@@ -226,6 +227,14 @@
 		                              dest->options[j].value,
 					      num_options, &options);
 	    }
+	    else if (cupsLastError() == IPP_BAD_REQUEST ||
+		     cupsLastError() == IPP_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 @@
 			    argv[i][1]);
 	    return (1);
       }
+    }
     else if (num_files < 1000)
     {
      /*
@@ -320,6 +330,14 @@
 		                      dest->options[j].value,
 				      num_options, &options);
     }
+    else if (cupsLastError() == IPP_BAD_REQUEST ||
+	     cupsLastError() == IPP_VERSION_NOT_SUPPORTED)
+    {
+      _cupsLangPrintf(stderr,
+		      _("%s: Error - add '/version=1.1' to server "
+			"name."), argv[0]);
+      return (1);
+    }
   }

   if (printer == NULL)
Index: cups/dest.c
===================================================================
--- cups/dest.c	(revision 11100)
+++ cups/dest.c	(working copy)
@@ -1903,19 +1903,8 @@
   */

   if (!_cupsGetDests(http, op, name, &dest, 0, 0))
-  {
-    if (op == CUPS_GET_DEFAULT || (name && !set_as_default))
-      return (NULL);
+    return (NULL);

-   /*
-    * The default printer from environment variables or from a
-    * configuration file does not exist.  Find out the real default.
-    */
-
-    if (!_cupsGetDests(http, CUPS_GET_DEFAULT, NULL, &dest, 0, 0))
-      return (NULL);
-  }
-
   if (instance)
     dest->instance = _cupsStrAlloc(instance);

Index: systemv/lp.c
===================================================================
--- systemv/lp.c	(revision 11100)
+++ systemv/lp.c	(working copy)
@@ -146,7 +146,8 @@
             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 @@
 		                              dest->options[j].value,
 					      num_options, &options);
 	    }
+	    else if (cupsLastError() == IPP_BAD_REQUEST ||
+		     cupsLastError() == IPP_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 @@
 		                      dest->options[j].value,
 				      num_options, &options);
     }
+    else if (cupsLastError() == IPP_BAD_REQUEST ||
+	     cupsLastError() == IPP_VERSION_NOT_SUPPORTED)
+    {
+      _cupsLangPrintf(stderr,
+		      _("%s: Error - add '/version=1.1' to server "
+			"name."), argv[0]);
+      return (1);
+    }
   }

   if (printer == NULL)
@@ -679,8 +696,16 @@

   ippDelete(cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/jobs"));

-  if (cupsLastError() > IPP_OK_CONFLICT)
+  if (cupsLastError() == IPP_BAD_REQUEST ||
+      cupsLastError() == IPP_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,8 +745,16 @@

   ippDelete(cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/jobs"));

-  if (cupsLastError() > IPP_OK_CONFLICT)
+  if (cupsLastError() == IPP_BAD_REQUEST ||
+      cupsLastError() == IPP_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: systemv/lpstat.c
===================================================================
--- systemv/lpstat.c	(revision 11100)
+++ systemv/lpstat.c	(working copy)
@@ -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 @@
 	      {
 	        cupsFreeDests(num_dests, dests);
 		num_dests = cupsGetDests(&dests);
+
+		if (num_dests == 0 &&
+		    (cupsLastError() == IPP_BAD_REQUEST ||
+		     cupsLastError() == IPP_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);
@@ -267,6 +277,16 @@

 	      dests     = cupsGetNamedDest(CUPS_HTTP_DEFAULT, NULL, NULL);
 	      num_dests = dests ? 1 : 0;
+
+	      if (num_dests == 0 &&
+	          (cupsLastError() == IPP_BAD_REQUEST ||
+		   cupsLastError() == IPP_VERSION_NOT_SUPPORTED))
+	      {
+		_cupsLangPrintf(stderr,
+				_("%s: Error - add '/version=1.1' to server "
+				  "name."), argv[0]);
+		return (1);
+	      }
 	    }

             show_default(dests);
@@ -359,6 +379,16 @@
 	      {
 	        cupsFreeDests(num_dests, dests);
 		num_dests = cupsGetDests(&dests);
+
+		if (num_dests == 0 &&
+		    (cupsLastError() == IPP_BAD_REQUEST ||
+		     cupsLastError() == IPP_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);
@@ -378,6 +408,16 @@
 	    {
 	      cupsFreeDests(num_dests, dests);
 	      num_dests = cupsGetDests(&dests);
+
+	      if (num_dests == 0 &&
+		  (cupsLastError() == IPP_BAD_REQUEST ||
+		   cupsLastError() == IPP_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));
@@ -392,6 +432,16 @@
 	    {
 	      cupsFreeDests(num_dests, dests);
 	      num_dests = cupsGetDests(&dests);
+
+	      if (num_dests == 0 &&
+		  (cupsLastError() == IPP_BAD_REQUEST ||
+		   cupsLastError() == IPP_VERSION_NOT_SUPPORTED))
+	      {
+		_cupsLangPrintf(stderr,
+				_("%s: Error - add '/version=1.1' to server "
+				  "name."), argv[0]);
+		return (1);
+	      }
 	    }

 	    show_scheduler();
@@ -441,6 +491,16 @@
 	      {
 		cupsFreeDests(num_dests, dests);
 		num_dests = cupsGetDests(&dests);
+
+		if (num_dests == 0 &&
+		    (cupsLastError() == IPP_BAD_REQUEST ||
+		     cupsLastError() == IPP_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);
@@ -500,9 +560,16 @@

       if ((*dests = cupsGetNamedDest(CUPS_HTTP_DEFAULT, printer, pptr)) == NULL)
       {
-        _cupsLangPrintf(stderr,
-	                _("%s: Invalid destination name in list \"%s\"."),
-			command, name);
+	if (cupsLastError() == IPP_BAD_REQUEST ||
+	    cupsLastError() == IPP_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
@@ -554,8 +621,15 @@

     if (!cupsGetDest(printer, NULL, *num_dests, *dests))
     {
-      _cupsLangPrintf(stderr,
-                      _("%s: Unknown destination \"%s\"."), command, printer);
+      if (cupsLastError() == IPP_BAD_REQUEST ||
+          cupsLastError() == IPP_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);
     }
   }
@@ -670,17 +744,28 @@
   * 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_BAD_REQUEST ||
+      cupsLastError() == IPP_VERSION_NOT_SUPPORTED)
   {
+    _cupsLangPrintf(stderr,
+		    _("%s: Error - add '/version=1.1' to server name."),
+		    "lpstat");
+    ippDelete(response);
+    return (1);
+  }
+  else if (cupsLastError() > IPP_OK_CONFLICT)
+  {
+    _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
+    ippDelete(response);
+    return (1);
+  }
+
+  if (response)
+  {
     DEBUG_puts("show_accepting: request succeeded...");

-    if (response->request.status.status_code > IPP_OK_CONFLICT)
-    {
-      _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
-      ippDelete(response);
-      return (1);
-    }
-
    /*
     * Loop through the printers returned in the list and display
     * their devices...
@@ -782,11 +867,6 @@

     ippDelete(response);
   }
-  else
-  {
-    _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
-    return (1);
-  }

   return (0);
 }
@@ -849,8 +929,26 @@
   * 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_BAD_REQUEST ||
+      cupsLastError() == IPP_VERSION_NOT_SUPPORTED)
   {
+    _cupsLangPrintf(stderr,
+		    _("%s: Error - add '/version=1.1' to server name."),
+		    "lpstat");
+    ippDelete(response);
+    return (1);
+  }
+  else if (cupsLastError() > IPP_OK_CONFLICT)
+  {
+    _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
+    ippDelete(response);
+    return (1);
+  }
+
+  if (response)
+  {
     DEBUG_puts("show_classes: request succeeded...");

     if (response->request.status.status_code > IPP_OK_CONFLICT)
@@ -987,11 +1085,6 @@

     ippDelete(response);
   }
-  else
-  {
-    _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
-    return (1);
-  }

   return (0);
 }
@@ -1097,17 +1190,28 @@
   * 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_BAD_REQUEST ||
+      cupsLastError() == IPP_VERSION_NOT_SUPPORTED)
   {
+    _cupsLangPrintf(stderr,
+		    _("%s: Error - add '/version=1.1' to server name."),
+		    "lpstat");
+    ippDelete(response);
+    return (1);
+  }
+  else if (cupsLastError() > IPP_OK_CONFLICT)
+  {
+    _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
+    ippDelete(response);
+    return (1);
+  }
+
+  if (response)
+  {
     DEBUG_puts("show_devices: request succeeded...");

-    if (response->request.status.status_code > IPP_OK_CONFLICT)
-    {
-      _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
-      ippDelete(response);
-      return (1);
-    }
-
    /*
     * Loop through the printers returned in the list and display
     * their devices...
@@ -1246,11 +1350,6 @@

     ippDelete(response);
   }
-  else
-  {
-    _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
-    return (1);
-  }

   return (0);
 }
@@ -1334,19 +1433,30 @@
   * 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_BAD_REQUEST ||
+      cupsLastError() == IPP_VERSION_NOT_SUPPORTED)
   {
+    _cupsLangPrintf(stderr,
+		    _("%s: Error - add '/version=1.1' to server name."),
+		    "lpstat");
+    ippDelete(response);
+    return (1);
+  }
+  else if (cupsLastError() > IPP_OK_CONFLICT)
+  {
+    _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)
@@ -1492,11 +1602,6 @@

     ippDelete(response);
   }
-  else
-  {
-    _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
-    return (1);
-  }

   return (0);
 }
@@ -1587,17 +1692,28 @@
   * 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_BAD_REQUEST ||
+      cupsLastError() == IPP_VERSION_NOT_SUPPORTED)
   {
+    _cupsLangPrintf(stderr,
+		    _("%s: Error - add '/version=1.1' to server name."),
+		    "lpstat");
+    ippDelete(response);
+    return (1);
+  }
+  else if (cupsLastError() > IPP_OK_CONFLICT)
+  {
+    _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
+    ippDelete(response);
+    return (1);
+  }
+
+  if (response)
+  {
     DEBUG_puts("show_printers: request succeeded...");

-    if (response->request.status.status_code > IPP_OK_CONFLICT)
-    {
-      _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
-      ippDelete(response);
-      return (1);
-    }
-
    /*
     * Loop through the printers returned in the list and display
     * their status...
@@ -2018,11 +2134,6 @@

     ippDelete(response);
   }
-  else
-  {
-    _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
-    return (1);
-  }

   return (0);
 }
