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 */
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",
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)
{
*/
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
/*
{
char uri[HTTP_MAX_URI]; /* Job/printer URI */
ipp_t *request; /* IPP request */
- _cups_globals_t *cg = _cupsGlobals(); /* Thread global data */
/*
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,
*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\", "
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);
request = ippNewRequest(CUPS_GET_CLASSES);
- ippSetVersion(request, 1, 1);
-
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes", NULL, "printer-name");
request = ippNewRequest(CUPS_GET_DEFAULT);
- ippSetVersion(request, 1, 1);
-
/*
* Do the request and get back a response...
*/
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);
request = ippNewRequest(CUPS_GET_PRINTERS);
- ippSetVersion(request, 1, 1);
-
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes", NULL, "printer-name");
*/
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);
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 */
/*
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);
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",
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);