]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Workaround for HP IPP client.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Tue, 29 Feb 2000 20:34:39 +0000 (20:34 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Tue, 29 Feb 2000 20:34:39 +0000 (20:34 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@945 7a7537e8-13f0-0310-91df-b6672ffda945

cups/http.c

index 7dbbdb41776789c9bdd8ca795f3d099a3034ae57..c91ebb6b145340ec5788090d437ed80ee548d4b3 100644 (file)
@@ -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 $".
  */