]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Revert previous change for STR #4231.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Mon, 14 Jan 2013 18:36:48 +0000 (18:36 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Mon, 14 Jan 2013 18:36:48 +0000 (18:36 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@10812 7a7537e8-13f0-0310-91df-b6672ffda945

cups/cups-private.h
cups/dest.c
cups/globals.c
cups/util.c

index 10e2c744e3708b44bc3fe1212b1cb4ea41bc61ea..3b0cd68be82555db0f07fde7a22b4f76799971c9 100644 (file)
@@ -92,9 +92,6 @@ typedef struct _cups_globals_s                /**** CUPS global state data ****/
   int                  thread_id;      /* Friendly thread ID */
 #  endif /* DEBUG */
 
-  /* dest.c, util.c */
-  int                  server_version; /* Server IPP version */
-
   /* file.c */
   cups_file_t          *stdio_files[3];/* stdin, stdout, stderr */
 
index 8e90862b605187f10687ebd1d549c992d207627c..b27fb3b8abf8f9a1fd0b9f40c1e6e109cafa8788 100644 (file)
@@ -1388,7 +1388,6 @@ _cupsGetDests(http_t       *http, /* I  - Connection to server or
   char         optname[1024],          /* Option name */
                value[2048],            /* Option value */
                *ptr;                   /* Pointer into name/value */
-  _cups_globals_t *cg = _cupsGlobals();        /* Thread global data */
   static const char * const pattrs[] = /* Attributes we're interested in */
                {
                  "auth-info-required",
@@ -1430,62 +1429,45 @@ _cupsGetDests(http_t       *http,       /* I  - Connection to server or
   appleGetPaperSize(media_default, sizeof(media_default));
 #endif /* __APPLE__ */
 
-  for (;;)
-  {
-   /*
-    * Build a CUPS_GET_PRINTERS or IPP_GET_PRINTER_ATTRIBUTES request, which
-    * require the following attributes:
-    *
-    *    attributes-charset
-    *    attributes-natural-language
-    *    requesting-user-name
-    *    printer-uri [for IPP_GET_PRINTER_ATTRIBUTES]
-    */
-
-    request = ippNewRequest(op);
-
-    ippSetVersion(request, cg->server_version / 10, cg->server_version % 10);
-
-    ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
-                 "requested-attributes", sizeof(pattrs) / sizeof(pattrs[0]),
-                 NULL, pattrs);
-
-    ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
-                "requesting-user-name", NULL, cupsUser());
-
-    if (name && op != CUPS_GET_DEFAULT)
-    {
-      httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
-                      "localhost", ippPort(), "/printers/%s", name);
-      ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL,
-                  uri);
-    }
-    else if (mask)
-    {
-      ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_ENUM, "printer-type",
-                   type);
-      ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_ENUM, "printer-type-mask",
-                   mask);
-    }
+ /*
+  * Build a CUPS_GET_PRINTERS or IPP_GET_PRINTER_ATTRIBUTES request, which
+  * require the following attributes:
+  *
+  *    attributes-charset
+  *    attributes-natural-language
+  *    requesting-user-name
+  *    printer-uri [for IPP_GET_PRINTER_ATTRIBUTES]
+  */
 
-   /*
-    * Do the request and get back a response...
-    */
+  request = ippNewRequest(op);
 
-    response = cupsDoRequest(http, request, "/");
-    if (cg->server_version != 20 || !response ||
-        cupsLastError() != IPP_BAD_REQUEST)
-      break;
+  ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
+                "requested-attributes", sizeof(pattrs) / sizeof(pattrs[0]),
+               NULL, pattrs);
 
-   /*
-    * Retry as an IPP/1.1 request...
-    */
+  ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
+               "requesting-user-name", NULL, cupsUser());
 
-    cg->server_version = 11;
-    ippDelete(response);
+  if (name && op != CUPS_GET_DEFAULT)
+  {
+    httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
+                     "localhost", ippPort(), "/printers/%s", name);
+    ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL,
+                 uri);
+  }
+  else if (mask)
+  {
+    ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_ENUM, "printer-type",
+                  type);
+    ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_ENUM, "printer-type-mask",
+                  mask);
   }
 
-  if (response)
+ /*
+  * Do the request and get back a response...
+  */
+
+  if ((response = cupsDoRequest(http, request, "/")) != NULL)
   {
     for (attr = response->attrs; attr != NULL; attr = attr->next)
     {
index 0eb317619aaf4e1e9d0153f0ae5598a28653529c..fec94975e93e82a5f791804b0724ef2a9c7d9129 100644 (file)
@@ -214,12 +214,11 @@ cups_globals_alloc(void)
   */
 
   memset(cg, 0, sizeof(_cups_globals_t));
-  cg->encryption     = (http_encryption_t)-1;
-  cg->password_cb    = (cups_password_cb2_t)_cupsGetPassword;
-  cg->any_root       = 1;
-  cg->expired_certs  = 1;
-  cg->expired_root   = 1;
-  cg->server_version = 20;
+  cg->encryption    = (http_encryption_t)-1;
+  cg->password_cb   = (cups_password_cb2_t)_cupsGetPassword;
+  cg->any_root      = 1;
+  cg->expired_certs = 1;
+  cg->expired_root  = 1;
 
 #ifdef DEBUG
  /*
index 4bb82109aac1fb49d06530ae3f34e3438d6a6252..a3e6427bdb752cc2b6180cec85ba0fedc6a0f7fe 100644 (file)
@@ -117,7 +117,6 @@ cupsCancelJob2(http_t     *http,    /* I - Connection to server or @code CUPS_HTTP_
 {
   char         uri[HTTP_MAX_URI];      /* Job/printer URI */
   ipp_t                *request;               /* IPP request */
-  _cups_globals_t *cg = _cupsGlobals();        /* Thread global data */
 
 
  /*
@@ -151,8 +150,6 @@ cupsCancelJob2(http_t     *http,    /* I - Connection to server or @code CUPS_HTTP_
 
   request = ippNewRequest(job_id < 0 ? IPP_PURGE_JOBS : IPP_CANCEL_JOB);
 
-  ippSetVersion(request, cg->server_version / 10, cg->server_version % 10);
-
   if (name)
   {
     httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
@@ -214,7 +211,6 @@ cupsCreateJob(
                *response;              /* Create-Job response */
   ipp_attribute_t *attr;               /* job-id attribute */
   int          job_id = 0;             /* job-id value */
-  _cups_globals_t *cg = _cupsGlobals();        /* Thread global data */
 
 
   DEBUG_printf(("cupsCreateJob(http=%p, name=\"%s\", title=\"%s\", "
@@ -241,8 +237,6 @@ cupsCreateJob(
     return (0);
   }
 
-  ippSetVersion(request, cg->server_version / 10, cg->server_version % 10);
-
   httpAssembleURIf(HTTP_URI_CODING_ALL, printer_uri, sizeof(printer_uri), "ipp",
                    NULL, "localhost", ippPort(), "/printers/%s", name);
   snprintf(resource, sizeof(resource), "/printers/%s", name);
@@ -369,8 +363,6 @@ cupsGetClasses(char ***classes)             /* O - Classes */
 
   request = ippNewRequest(CUPS_GET_CLASSES);
 
-  ippSetVersion(request, 1, 1);
-
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
                "requested-attributes", NULL, "printer-name");
 
@@ -490,8 +482,6 @@ cupsGetDefault2(http_t *http)               /* I - Connection to server or @code CUPS_HTTP_DE
 
   request = ippNewRequest(CUPS_GET_DEFAULT);
 
-  ippSetVersion(request, 1, 1);
-
  /*
   * Do the request and get back a response...
   */
@@ -637,8 +627,6 @@ cupsGetJobs2(http_t     *http,              /* I - Connection to server or @code CUPS_HTTP_D
 
   request = ippNewRequest(IPP_GET_JOBS);
 
-  ippSetVersion(request, cg->server_version / 10, cg->server_version % 10);
-
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
                "printer-uri", NULL, uri);
 
@@ -1227,8 +1215,6 @@ cupsGetPrinters(char ***printers) /* O - Printers */
 
   request = ippNewRequest(CUPS_GET_PRINTERS);
 
-  ippSetVersion(request, 1, 1);
-
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
                "requested-attributes", NULL, "printer-name");
 
@@ -1345,8 +1331,6 @@ cupsGetServerPPD(http_t     *http,        /* I - Connection to server or @code CUPS_HTT
   */
 
   request = ippNewRequest(CUPS_GET_PPD);
-  ippSetVersion(request, cg->server_version / 10, cg->server_version % 10);
-
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "ppd-name", NULL,
                name);
 
@@ -1588,7 +1572,6 @@ cupsStartDocument(
                printer_uri[1024];      /* Printer URI */
   ipp_t                *request;               /* Send-Document request */
   http_status_t        status;                 /* HTTP status */
-  _cups_globals_t *cg = _cupsGlobals();        /* Thread global data */
 
 
  /*
@@ -1601,8 +1584,6 @@ cupsStartDocument(
     return (HTTP_ERROR);
   }
 
-  ippSetVersion(request, cg->server_version / 10, cg->server_version % 10);
-
   httpAssembleURIf(HTTP_URI_CODING_ALL, printer_uri, sizeof(printer_uri), "ipp",
                    NULL, "localhost", ippPort(), "/printers/%s", name);
   snprintf(resource, sizeof(resource), "/printers/%s", name);
@@ -1660,7 +1641,6 @@ cups_get_printer_uri(
                classname[255],         /* Temporary class name */
                http_hostname[HTTP_MAX_HOST];
                                        /* Hostname associated with connection */
-  _cups_globals_t *cg = _cupsGlobals();        /* Thread global data */
   static const char * const requested_attrs[] =
                {                       /* Requested attributes */
                  "device-uri",
@@ -1710,8 +1690,6 @@ cups_get_printer_uri(
 
   request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES);
 
-  ippSetVersion(request, cg->server_version / 10, cg->server_version % 10);
-
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
                NULL, uri);