From: mike Date: Mon, 14 Jan 2013 18:36:48 +0000 (+0000) Subject: Revert previous change for STR #4231. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=16443823ebd86d30887ea5a36c5241544d0d88b0;p=thirdparty%2Fcups.git Revert previous change for STR #4231. git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@10812 7a7537e8-13f0-0310-91df-b6672ffda945 --- diff --git a/cups/cups-private.h b/cups/cups-private.h index 10e2c744e3..3b0cd68be8 100644 --- a/cups/cups-private.h +++ b/cups/cups-private.h @@ -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 */ diff --git a/cups/dest.c b/cups/dest.c index 8e90862b60..b27fb3b8ab 100644 --- a/cups/dest.c +++ b/cups/dest.c @@ -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) { diff --git a/cups/globals.c b/cups/globals.c index 0eb317619a..fec94975e9 100644 --- a/cups/globals.c +++ b/cups/globals.c @@ -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 /* diff --git a/cups/util.c b/cups/util.c index 4bb82109aa..a3e6427bdb 100644 --- a/cups/util.c +++ b/cups/util.c @@ -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);