*
* HTTP support routines for CUPS.
*
- * Copyright 2007-2014 by Apple Inc.
+ * Copyright 2007-2015 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
if (!ptr)
goto assemble_overflow;
- if (!strcmp(scheme, "mailto") || !strcmp(scheme, "tel"))
+ if (!strcmp(scheme, "geo") || !strcmp(scheme, "mailto") || !strcmp(scheme, "tel"))
{
/*
- * mailto: and tel: only have :, no //...
+ * geo:, mailto:, and tel: only have :, no //...
*/
if (ptr < end)
else
{
/*
- * Schemes other than mailto: and tel: all have //...
+ * Schemes other than geo:, mailto:, and tel: typically have //...
*/
if ((ptr + 2) < end)
if (port > 0)
{
- snprintf(ptr, end - ptr + 1, ":%d", port);
+ snprintf(ptr, (size_t)(end - ptr + 1), ":%d", port);
ptr += strlen(ptr);
if (ptr >= end)
break;
case 3 :
if (outptr < outend)
- *outptr++ |= base64;
+ *outptr++ |= (char)base64;
pos = 0;
break;
}
tdate = gmtime(&t);
if (tdate)
- snprintf(s, slen, "%s, %02d %s %d %02d:%02d:%02d GMT",
- http_days[tdate->tm_wday], tdate->tm_mday,
- http_months[tdate->tm_mon], tdate->tm_year + 1900,
- tdate->tm_hour, tdate->tm_min, tdate->tm_sec);
+ snprintf(s, (size_t)slen, "%s, %02d %s %d %02d:%02d:%02d GMT", http_days[tdate->tm_wday], tdate->tm_mday, http_months[tdate->tm_mon], tdate->tm_year + 1900, tdate->tm_hour, tdate->tm_min, tdate->tm_sec);
else
s[0] = '\0';
* Workaround for HP IPP client bug...
*/
- strlcpy(scheme, "ipp", schemelen);
+ strlcpy(scheme, "ipp", (size_t)schemelen);
status = HTTP_URI_STATUS_MISSING_SCHEME;
}
else if (*uri == '/')
* Filename...
*/
- strlcpy(scheme, "file", schemelen);
+ strlcpy(scheme, "file", (size_t)schemelen);
status = HTTP_URI_STATUS_MISSING_SCHEME;
}
else
/*
* 'httpStateString()' - Return the string describing a HTTP state value.
*
- * @since CUPS 2.0@
+ * @since CUPS 2.0/OS 10.10@
*/
const char * /* O - State string */
/*
* 'httpURIStatusString()' - Return a string describing a URI status code.
*
- * @since CUPS 2.0@
+ * @since CUPS 2.0/OS 10.10@
*/
const char * /* O - Localized status string */
# endif /* WIN32 */
DNSServiceRef ref, /* DNS-SD master service reference */
domainref = NULL,/* DNS-SD service reference for domain */
+ ippref = NULL, /* DNS-SD service reference for network IPP */
+ ippsref = NULL, /* DNS-SD service reference for network IPPS */
localref; /* DNS-SD service reference for .local */
- int domainsent = 0; /* Send the domain resolve? */
+ int extrasent = 0; /* Send the domain/IPP/IPPS resolves? */
# ifdef HAVE_POLL
struct pollfd polldata; /* Polling data */
# else /* select() */
while (time(NULL) < end_time)
{
if (options & _HTTP_RESOLVE_STDERR)
- _cupsLangPrintFilter(stderr, "INFO", _("Looking for printer."));
+ _cupsLangPrintFilter(stderr, "INFO", _("Looking for printer..."));
if (cb && !(*cb)(context))
{
* comes in, do an additional domain resolution...
*/
- if (domainsent == 0 && domain && _cups_strcasecmp(domain, "local."))
+ if (extrasent == 0 && domain && _cups_strcasecmp(domain, "local."))
{
if (options & _HTTP_RESOLVE_STDERR)
fprintf(stderr,
myinterface, hostname, regtype, domain,
http_resolve_cb,
&uribuf) == kDNSServiceErr_NoError)
- domainsent = 1;
+ extrasent = 1;
+ }
+ else if (extrasent == 0 && !strcmp(scheme, "ippusb"))
+ {
+ if (options & _HTTP_RESOLVE_STDERR)
+ fprintf(stderr, "DEBUG: Resolving \"%s\", regtype=\"_ipps._tcp\", domain=\"local.\"...\n", hostname);
+
+ ippsref = ref;
+ if (DNSServiceResolve(&ippsref,
+ kDNSServiceFlagsShareConnection,
+ kDNSServiceInterfaceIndexAny, hostname,
+ "_ipps._tcp", domain, http_resolve_cb,
+ &uribuf) == kDNSServiceErr_NoError)
+ extrasent = 1;
+ }
+ else if (extrasent == 1 && !strcmp(scheme, "ippusb"))
+ {
+ if (options & _HTTP_RESOLVE_STDERR)
+ fprintf(stderr, "DEBUG: Resolving \"%s\", regtype=\"_ipp._tcp\", domain=\"local.\"...\n", hostname);
+
+ ippref = ref;
+ if (DNSServiceResolve(&ippref,
+ kDNSServiceFlagsShareConnection,
+ kDNSServiceInterfaceIndexAny, hostname,
+ "_ipp._tcp", domain, http_resolve_cb,
+ &uribuf) == kDNSServiceErr_NoError)
+ extrasent = 2;
}
/*
}
}
- if (domainsent)
- DNSServiceRefDeallocate(domainref);
+ if (extrasent)
+ {
+ if (domainref)
+ DNSServiceRefDeallocate(domainref);
+ if (ippref)
+ DNSServiceRefDeallocate(ippref);
+ if (ippsref)
+ DNSServiceRefDeallocate(ippsref);
+ }
DNSServiceRefDeallocate(localref);
}
{
for (addr = addrlist; addr; addr = addr->next)
{
- int error = getnameinfo(&(addr->addr.addr),
- httpAddrLength(&(addr->addr)),
- fqdn, sizeof(fqdn), NULL, 0, NI_NAMEREQD);
+ int error = getnameinfo(&(addr->addr.addr), (socklen_t)httpAddrLength(&(addr->addr)), fqdn, sizeof(fqdn), NULL, 0, NI_NAMEREQD);
if (!error)
{