*
* Private definitions for CUPS.
*
- * Copyright 2007-2012 by Apple Inc.
+ * Copyright 2007-2013 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
cups_server_cert_cb_t server_cert_cb; /* Server certificate callback */
void *server_cert_data;
/* Server certificate user data */
- int any_root, /* Allow any root */
+ int server_version, /* Server IPP version */
+ any_root, /* Allow any root */
expired_certs, /* Allow expired certs */
expired_root; /* Allow expired root */
*
* Global variable access routines for CUPS.
*
- * Copyright 2007-2012 by Apple Inc.
+ * Copyright 2007-2013 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
*/
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->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;
#ifdef DEBUG
/*
*
* Internet Printing Protocol functions for CUPS.
*
- * Copyright 2007-2012 by Apple Inc.
+ * Copyright 2007-2013 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
ipp_t * /* O - New IPP message */
ippNew(void)
{
- ipp_t *temp; /* New IPP message */
+ ipp_t *temp; /* New IPP message */
+ _cups_globals_t *cg = _cupsGlobals();
+ /* Global data */
DEBUG_puts("ippNew()");
if ((temp = (ipp_t *)calloc(1, sizeof(ipp_t))) != NULL)
{
/*
- * Default to IPP 2.0...
+ * Set default version - usually 2.0...
*/
- temp->request.any.version[0] = 2;
- temp->request.any.version[1] = 0;
+ temp->request.any.version[0] = cg->server_version / 10;
+ temp->request.any.version[1] = cg->server_version % 10;
temp->use = 1;
}
void
cupsSetServer(const char *server) /* I - Server name */
{
- char *port; /* Pointer to port */
+ char *options, /* Options */
+ *port; /* Pointer to port */
_cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */
{
strlcpy(cg->server, server, sizeof(cg->server));
+ if (cg->server[0] != '/' && (options = strrchr(cg->server, '/')) != NULL)
+ {
+ *options++ = '\0';
+
+ if (!strcmp(options, "version=1.0"))
+ cg->server_version = 10;
+ else if (!strcmp(options, "version=1.1"))
+ cg->server_version = 11;
+ else if (!strcmp(options, "version=2.0"))
+ cg->server_version = 20;
+ else if (!strcmp(options, "version=2.1"))
+ cg->server_version = 21;
+ else if (!strcmp(options, "version=2.2"))
+ cg->server_version = 22;
+ }
+
if (cg->server[0] != '/' && (port = strrchr(cg->server, ':')) != NULL &&
!strchr(port, ']') && isdigit(port[1] & 255))
{
}
else
{
- cg->server[0] = '\0';
- cg->servername[0] = '\0';
+ cg->server[0] = '\0';
+ cg->servername[0] = '\0';
+ cg->server_version = 20;
}
if (cg->http)