]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cgi-bin/admin.c
Load cups into easysw/current.
[thirdparty/cups.git] / cgi-bin / admin.c
index e50a20797ef8b6914488e5d02ac99dbb76325660..a3d4d7f3b9263d285edfd66502cf6d4ccf196cd5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: admin.c 5290 2006-03-14 21:43:57Z mike $"
+ * "$Id: admin.c 5360 2006-03-30 17:02:17Z mike $"
  *
  *   Administration CGI for the Common UNIX Printing System (CUPS).
  *
@@ -132,12 +132,20 @@ main(int  argc,                           /* I - Number of command-line arguments */
     if (!strcmp(op, "redirect"))
     {
       const char *url;                 /* Redirection URL... */
+      char     prefix[1024];           /* URL prefix */
 
 
+      if (getenv("HTTPS"))
+        snprintf(prefix, sizeof(prefix), "https://%s:%s",
+                getenv("SERVER_NAME"), getenv("SERVER_PORT"));
+      else
+        snprintf(prefix, sizeof(prefix), "http://%s:%s",
+                getenv("SERVER_NAME"), getenv("SERVER_PORT"));
+
       if ((url = cgiGetVariable("URL")) != NULL)
-        printf("Location: %s\n\n", url);
+        printf("Location: %s%s\n\n", prefix, url);
       else
-        puts("Location: /admin\n");
+        printf("Location: %s/admin\n\n", prefix);
     }
     else if (!strcmp(op, "start-printer"))
       do_printer_op(http, IPP_RESUME_PRINTER, cgiText(_("Start Printer")));
@@ -2859,5 +2867,5 @@ match_string(const char *a,               /* I - First string */
 
     
 /*
- * End of "$Id: admin.c 5290 2006-03-14 21:43:57Z mike $".
+ * End of "$Id: admin.c 5360 2006-03-30 17:02:17Z mike $".
  */