]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Mirror 1.1.x changes.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Fri, 24 Jan 2003 15:28:06 +0000 (15:28 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Fri, 24 Jan 2003 15:28:06 +0000 (15:28 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/branches/branch-1.2@3137 7a7537e8-13f0-0310-91df-b6672ffda945

scheduler/client.c

index a097c524c9e8526d071a75877bb2688cb5c8e6d5..27535cb6910b33ed46714acb85d730d5aeba8726 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: client.c,v 1.91.2.37 2003/01/24 14:47:56 mike Exp $"
+ * "$Id: client.c,v 1.91.2.38 2003/01/24 15:28:06 mike Exp $"
  *
  *   Client routines for the Common UNIX Printing System (CUPS) scheduler.
  *
@@ -694,6 +694,52 @@ ReadClient(client_t *con)  /* I - Client to read from */
              break;
        }
 
+       /*
+        * Handle full URLs in the request line...
+       */
+
+        if (con->uri[0] != '/')
+       {
+         char  method[HTTP_MAX_URI],           /* Method/scheme */
+               userpass[HTTP_MAX_URI],         /* Username:password */
+               hostname[HTTP_MAX_URI],         /* Hostname */
+               resource[HTTP_MAX_URI];         /* Resource path */
+          int  port;                           /* Port number */
+
+
+         /*
+         * Separate the URI into its components...
+         */
+
+          httpSeparate(con->uri, method, userpass, hostname, &port, resource);
+
+         /*
+         * Only allow URIs with the servername, localhost, or an IP
+         * address...
+         */
+
+         if (strcasecmp(hostname, ServerName) &&
+             strcasecmp(hostname, "localhost") &&
+             !isdigit(hostname[0]))
+         {
+          /*
+           * Nope, we don't do proxies...
+           */
+
+           LogMessage(L_ERROR, "Bad URI \"%s\" in request!", con->uri);
+           SendError(con, HTTP_METHOD_NOT_ALLOWED);
+           ShutdownClient(con);
+           return (1);
+         }
+
+         /*
+         * Copy the resource portion back into the URI; both resource and
+         * con->uri are HTTP_MAX_URI bytes in size...
+         */
+
+          strcpy(con->uri, resource);
+       }
+
        /*
         * Process the request...
        */
@@ -853,18 +899,6 @@ ReadClient(client_t *con)  /* I - Client to read from */
         return (0);
       }
     }
-    else if (con->uri[0] != '/')
-    {
-     /*
-      * Don't allow proxying (yet)...
-      */
-
-      if (!SendError(con, HTTP_METHOD_NOT_ALLOWED))
-      {
-       CloseClient(con);
-        return (0);
-      }
-    }
     else
     {
       if (strcasecmp(con->http.fields[HTTP_FIELD_CONNECTION], "Upgrade") == 0 &&
@@ -2788,5 +2822,5 @@ pipe_command(client_t *con,               /* I - Client connection */
 
 
 /*
- * End of "$Id: client.c,v 1.91.2.37 2003/01/24 14:47:56 mike Exp $".
+ * End of "$Id: client.c,v 1.91.2.38 2003/01/24 15:28:06 mike Exp $".
  */