From: mike Date: Tue, 29 Feb 2000 20:34:39 +0000 (+0000) Subject: Workaround for HP IPP client. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=df38e840a95a55fcd1064d3dfb59aeb1b8d44ec6;p=thirdparty%2Fcups.git Workaround for HP IPP client. git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@945 7a7537e8-13f0-0310-91df-b6672ffda945 --- diff --git a/cups/http.c b/cups/http.c index 7dbbdb4177..c91ebb6b14 100644 --- a/cups/http.c +++ b/cups/http.c @@ -1,5 +1,5 @@ /* - * "$Id: http.c,v 1.59 2000/01/25 03:12:58 mike Exp $" + * "$Id: http.c,v 1.60 2000/02/29 20:34:39 mike Exp $" * * HTTP routines for the Common UNIX Printing System (CUPS) scheduler. * @@ -405,55 +405,70 @@ httpSeparate(const char *uri, /* I - Universal Resource Identifier */ * Grab the method portion of the URI... */ - ptr = host; - while (*uri != ':' && *uri != '\0') - *ptr++ = *uri++; + if (strncmp(uri, "//", 2) == 0) + { + /* + * Workaround for HP IPP client bug... + */ - *ptr = '\0'; - if (*uri == ':') - uri ++; + strcpy(method, "ipp"); + } + else + { + /* + * Standard URI with method... + */ - /* - * If the method contains a period or slash, then it's probably - * hostname/filename... - */ + ptr = host; + while (*uri != ':' && *uri != '\0') + *ptr++ = *uri++; - if (strchr(host, '.') != NULL || strchr(host, '/') != NULL || *uri == '\0') - { - if ((ptr = strchr(host, '/')) != NULL) - { - strncpy(resource, ptr, HTTP_MAX_URI - 1); - resource[HTTP_MAX_URI - 1] = '\0'; - *ptr = '\0'; - } - else - resource[0] = '\0'; + *ptr = '\0'; + if (*uri == ':') + uri ++; - if (isdigit(*uri)) - { - /* - * OK, we have "hostname:port[/resource]"... - */ + /* + * If the method contains a period or slash, then it's probably + * hostname/filename... + */ - *port = strtol(uri, (char **)&uri, 10); + if (strchr(host, '.') != NULL || strchr(host, '/') != NULL || *uri == '\0') + { + if ((ptr = strchr(host, '/')) != NULL) + { + strncpy(resource, ptr, HTTP_MAX_URI - 1); + resource[HTTP_MAX_URI - 1] = '\0'; + *ptr = '\0'; + } + else + resource[0] = '\0'; - if (*uri == '/') + if (isdigit(*uri)) { - strncpy(resource, uri, HTTP_MAX_URI - 1); - resource[HTTP_MAX_URI - 1] = '\0'; + /* + * OK, we have "hostname:port[/resource]"... + */ + + *port = strtol(uri, (char **)&uri, 10); + + if (*uri == '/') + { + strncpy(resource, uri, HTTP_MAX_URI - 1); + resource[HTTP_MAX_URI - 1] = '\0'; + } } + else + *port = 80; + + strcpy(method, "http"); + username[0] = '\0'; + return; } else - *port = 0; - - strcpy(method, "http"); - username[0] = '\0'; - return; - } - else - { - strncpy(method, host, 31); - method[31] = '\0'; + { + strncpy(method, host, 31); + method[31] = '\0'; + } } /* @@ -1524,5 +1539,5 @@ http_send(http_t *http, /* I - HTTP data */ /* - * End of "$Id: http.c,v 1.59 2000/01/25 03:12:58 mike Exp $". + * End of "$Id: http.c,v 1.60 2000/02/29 20:34:39 mike Exp $". */