* Make a copy of the printer connection...
*/
- http = _httpCreate(monitor->hostname, monitor->port, monitor->encryption);
+ http = _httpCreate(monitor->hostname, monitor->port, monitor->encryption,
+ AF_UNSPEC);
cupsSetPasswordCB(password_cb);
/*
if (!cg->http)
{
if ((cg->http = _httpCreate(cupsServer(), ippPort(),
- cupsEncryption())) == NULL)
+ cupsEncryption(), AF_UNSPEC)) == NULL)
{
if (errno)
_cupsSetError(IPP_SERVICE_UNAVAILABLE, NULL, 0);
extern http_tls_credentials_t
_httpConvertCredentials(cups_array_t *credentials);
extern http_t *_httpCreate(const char *host, int port,
- http_encryption_t encryption);
+ http_encryption_t encryption,
+ int family);
extern void _httpDisconnect(http_t *http);
extern char *_httpEncodeURI(char *dst, const char *src,
size_t dstsize);
* Create the HTTP structure...
*/
- if ((http = _httpCreate(host, port, encryption)) == NULL)
+ if ((http = _httpCreate(host, port, encryption, AF_UNSPEC)) == NULL)
return (NULL);
/*
_httpCreate(
const char *host, /* I - Hostname */
int port, /* I - Port number */
- http_encryption_t encryption) /* I - Encryption to use */
+ http_encryption_t encryption, /* I - Encryption to use */
+ int family) /* I - Address family or AF_UNSPEC */
{
http_t *http; /* New HTTP connection */
http_addrlist_t *addrlist; /* Host address data */
sprintf(service, "%d", port);
- if ((addrlist = httpAddrGetList(host, AF_UNSPEC, service)) == NULL)
+ if ((addrlist = httpAddrGetList(host, family, service)) == NULL)
return (NULL);
/*
.\" which should have been included with this file. If this file is
.\" file is missing or damaged, see the license at "http://www.cups.org/".
.\"
-.TH ipptool 1 "CUPS" "17 October 2010" "Apple Inc."
+.TH ipptool 1 "CUPS" "9 November 2010" "Apple Inc."
.SH NAME
ipptool - perform internet printing protocol requests
.SH SYNOPSIS
.B ipptool
-[ -C ] [ -E ] [ -I ] [ -L ] [ -S ] [ -T
+[ -4 ] [ -6 ] [ -C ] [ -E ] [ -I ] [ -L ] [ -S ] [ -T
.I seconds
] [ -V
.I version
.SH OPTIONS
The following options are recognized by \fIipptool\fR:
.TP 5
+-4
+Specifies that \fIipptool\fR must connect to the printer or server using IPv4.
+.TP 5
+-6
+Specifies that \fIipptool\fR must connect to the printer or server using IPv6.
+.TP 5
-C
Specifies that requests should be sent using the HTTP/1.1 "Transfer-Encoding: chunked" header, which is required for conformance by all versions of IPP. The default is to use "Transfer-Encoding: chunked" for requests with attached files and "Content-Length:" for requests without attached files.
.TP 5
int port; /* Port number from URI */
http_encryption_t encryption; /* Encryption for connection? */
double timeout; /* Timeout for connection */
+ int family; /* Address family */
cups_array_t *vars; /* Array of variables */
} _cups_vars_t;
_cupsSetLocale(argv);
memset(&vars, 0, sizeof(vars));
- vars.vars = cupsArrayNew((cups_array_func_t)compare_vars, NULL);
+ vars.family = AF_UNSPEC;
+ vars.vars = cupsArrayNew((cups_array_func_t)compare_vars, NULL);
/*
* We need at least:
{
switch (*opt)
{
+ case '4' : /* Connect using IPv4 only */
+ vars.family = AF_INET;
+ break;
+
+#ifdef AF_INET6
+ case '6' : /* Connect using IPv6 only */
+ vars.family = AF_INET6;
+ break;
+#endif /* AF_INET6 */
+
case 'C' : /* Enable HTTP chunking */
Transfer = _CUPS_TRANSFER_CHUNKED;
break;
* Connect to the server...
*/
- if ((http = httpConnectEncrypt(vars->hostname, vars->port,
- vars->encryption)) == NULL)
+ if ((http = _httpCreate(vars->hostname, vars->port, vars->encryption,
+ vars->family)) == NULL)
+ {
+ print_fatal_error("Unable to connect to %s on port %d - %s", vars->hostname,
+ vars->port, strerror(errno));
+ pass = 0;
+ goto test_exit;
+ }
+
+ if (httpReconnect(http))
{
print_fatal_error("Unable to connect to %s on port %d - %s", vars->hostname,
vars->port, strerror(errno));
"\n"
"Options:\n"
"\n"
- "-C Send requests using chunking (default)\n"
+ "-4 Connect using IPv4.\n"
+ "-6 Connect using IPv6.\n"
+ "-C Send requests using chunking (default).\n"
"-E Test with TLS encryption.\n"
- "-I Ignore errors\n"
- "-L Send requests using content-length\n"
+ "-I Ignore errors.\n"
+ "-L Send requests using content-length.\n"
"-S Test with SSL encryption.\n"
"-T Set the receive/send timeout in seconds.\n"
"-V version Set default IPP version.\n"