aboutsummaryrefslogtreecommitdiffstats
path: root/cups/request.c
diff options
context:
space:
mode:
Diffstat (limited to 'cups/request.c')
-rw-r--r--cups/request.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/cups/request.c b/cups/request.c
index 39cbe6cc..efbc06eb 100644
--- a/cups/request.c
+++ b/cups/request.c
@@ -1,7 +1,7 @@
/*
* IPP utilities for CUPS.
*
- * Copyright 2007-2014 by Apple Inc.
+ * Copyright 2007-2017 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -131,13 +131,12 @@ cupsDoIORequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
* Get the default connection as needed...
*/
- if (!http)
- if ((http = _cupsConnect()) == NULL)
- {
- ippDelete(request);
+ if (!http && (http = _cupsConnect()) == NULL)
+ {
+ ippDelete(request);
- return (NULL);
- }
+ return (NULL);
+ }
/*
* See if we have a file to send...
@@ -151,9 +150,7 @@ cupsDoIORequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
* Can't get file information!
*/
- _cupsSetError(errno == EBADF ? IPP_STATUS_ERROR_NOT_FOUND : IPP_STATUS_ERROR_NOT_AUTHORIZED,
- NULL, 0);
-
+ _cupsSetError(errno == EBADF ? IPP_STATUS_ERROR_NOT_FOUND : IPP_STATUS_ERROR_NOT_AUTHORIZED, NULL, 0);
ippDelete(request);
return (NULL);
@@ -169,9 +166,8 @@ cupsDoIORequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
* Can't send a directory...
*/
- ippDelete(request);
-
_cupsSetError(IPP_STATUS_ERROR_NOT_POSSIBLE, strerror(EISDIR), 0);
+ ippDelete(request);
return (NULL);
}
@@ -186,8 +182,7 @@ cupsDoIORequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
else
length = ippLength(request);
- DEBUG_printf(("2cupsDoIORequest: Request length=%ld, total length=%ld",
- (long)ippLength(request), (long)length));
+ DEBUG_printf(("2cupsDoIORequest: Request length=%ld, total length=%ld", (long)ippLength(request), (long)length));
/*
* Clear any "Local" authentication data since it is probably stale...
@@ -596,6 +591,7 @@ cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
int got_status; /* Did we get the status? */
ipp_state_t state; /* State of IPP processing */
http_status_t expect; /* Expect: header to use */
+ char date[256]; /* Date: header value */
DEBUG_printf(("cupsSendRequest(http=%p, request=%p(%s), resource=\"%s\", length=" CUPS_LLFMT ")", (void *)http, (void *)request, request ? ippOpString(request->request.op.operation_id) : "?", resource, CUPS_LLCAST length));
@@ -615,9 +611,8 @@ cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
* Get the default connection as needed...
*/
- if (!http)
- if ((http = _cupsConnect()) == NULL)
- return (HTTP_STATUS_SERVICE_UNAVAILABLE);
+ if (!http && (http = _cupsConnect()) == NULL)
+ return (HTTP_STATUS_SERVICE_UNAVAILABLE);
/*
* If the prior request was not flushed out, do so now...
@@ -685,6 +680,7 @@ cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
httpClearFields(http);
httpSetExpect(http, expect);
httpSetField(http, HTTP_FIELD_CONTENT_TYPE, "application/ipp");
+ httpSetField(http, HTTP_FIELD_DATE, httpGetDateString2(time(NULL), date, (int)sizeof(date)));
httpSetLength(http, length);
#ifdef HAVE_GSSAPI
@@ -996,7 +992,11 @@ _cupsConnect(void)
*/
if (strcmp(cg->http->hostname, cg->server) ||
+#ifdef AF_LOCAL
+ (httpAddrFamily(cg->http->hostaddr) != AF_LOCAL && cg->ipp_port != httpAddrPort(cg->http->hostaddr)) ||
+#else
cg->ipp_port != httpAddrPort(cg->http->hostaddr) ||
+#endif /* AF_LOCAL */
(cg->http->encryption != cg->encryption &&
cg->http->encryption == HTTP_ENCRYPTION_NEVER))
{