]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Add support for HTTPS environment variable in CGIs (to keep encryption
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Sat, 10 Mar 2001 15:19:36 +0000 (15:19 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Sat, 10 Mar 2001 15:19:36 +0000 (15:19 +0000)
stuff...)

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@1628 7a7537e8-13f0-0310-91df-b6672ffda945

CHANGES.txt
cgi-bin/ipp-var.c
scheduler/client.c

index d9abfe2b8bce2c9090803779f0cfd68acb87763c..7e8d421eb92ad8cf7c39b49b7b41d1fec86b1521 100644 (file)
@@ -92,6 +92,9 @@ CHANGES IN CUPS V1.1.7
          attribute when altering a job.
        - The pstops filter did not handle PostScript files with
          lines longer than 8191 bytes.
+       - The scheduler now sets the HTTPS environment variable
+         for CGI programs when a client connects using
+         encryption.
 
 
 CHANGES IN CUPS V1.1.6-3
index c2ddfd1cc169e5e95721465d06c6c73b8664d817..5bdf9ead038fc08fc997231e3ec84a16954fa565 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: ipp-var.c,v 1.22 2001/02/20 17:32:59 mike Exp $"
+ * "$Id: ipp-var.c,v 1.23 2001/03/10 15:19:35 mike Exp $"
  *
  *   IPP variable routines for the Common UNIX Printing System (CUPS).
  *
@@ -97,13 +97,15 @@ ippSetCGIVars(ipp_t      *response, /* I - Response data to be copied... */
                        resource[HTTP_MAX_URI],
                        uri[HTTP_MAX_URI];
   int                  port;           /* URI data */
+  int                  ishttps;        /* Using encryption? */
   const char           *server;        /* Name of server */
   struct tm            *date;          /* Date information */
 
 
   ippSetServerVersion();
 
-  server = getenv("SERVER_NAME");
+  server  = getenv("SERVER_NAME");
+  ishttps = getenv("HTTPS") != NULL;
 
   for (attr = response->attrs;
        attr && attr->group_tag == IPP_TAG_OPERATION;
@@ -234,25 +236,30 @@ ippSetCGIVars(ipp_t      *response,       /* I - Response data to be copied... */
                    strcmp(method, "http") == 0)
                {
                 /*
-                 * Map localhost access to localhost...
+                 * Map localhost access to localhost and local port...
                  */
 
                  if (strcasecmp(hostname, server) == 0 &&
                      (strcmp(getenv("REMOTE_HOST"), "127.0.0.1") == 0 ||
                       strcmp(getenv("REMOTE_HOST"), "localhost") == 0 ||
                       strcmp(getenv("REMOTE_HOST"), server) == 0))
+                 {
                    strcpy(hostname, "localhost");
+                   port = atoi(getenv("SERVER_PORT"));
+                 }
 
                 /*
                  * Rewrite URI with HTTP address...
                  */
 
                  if (username[0])
-                   snprintf(uri, sizeof(uri), "http://%s@%s:%d%s", username,
-                            hostname, port, resource);
+                   snprintf(uri, sizeof(uri), "%s://%s@%s:%d%s",
+                            ishttps ? "https" : "http",
+                            username, hostname, port, resource);
                  else
-                   snprintf(uri, sizeof(uri), "http://%s:%d%s", hostname, port,
-                            resource);
+                   snprintf(uri, sizeof(uri), "%s://%s:%d%s", 
+                            ishttps ? "https" : "http",
+                            hostname, port, resource);
 
                  strncat(valptr, uri, sizeof(value) - (valptr - value) - 1);
                  break;
@@ -288,5 +295,5 @@ ippSetCGIVars(ipp_t      *response, /* I - Response data to be copied... */
 
 
 /*
- * End of "$Id: ipp-var.c,v 1.22 2001/02/20 17:32:59 mike Exp $".
+ * End of "$Id: ipp-var.c,v 1.23 2001/03/10 15:19:35 mike Exp $".
  */
index f0de5de3c62ab933bcb4fda9009511277ae528ce..adf41eac2848d5a239491c71fab7af2638d18fae 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: client.c,v 1.90 2001/03/04 03:03:42 mike Exp $"
+ * "$Id: client.c,v 1.91 2001/03/10 15:19:36 mike Exp $"
  *
  *   Client routines for the Common UNIX Printing System (CUPS) scheduler.
  *
@@ -2002,6 +2002,13 @@ pipe_command(client_t *con,      /* I - Client connection */
     envp[envc ++] = content_type;
   }
 
+ /*
+  * Tell the CGI if we are using encryption...
+  */
+
+  if (con->http.encryption >= HTTP_ENCRYPT_REQUIRED)
+    envp[envc ++] = "HTTPS=ON";
+
   envp[envc] = NULL;
 
  /*
@@ -2111,5 +2118,5 @@ pipe_command(client_t *con,       /* I - Client connection */
 
 
 /*
- * End of "$Id: client.c,v 1.90 2001/03/04 03:03:42 mike Exp $".
+ * End of "$Id: client.c,v 1.91 2001/03/10 15:19:36 mike Exp $".
  */