Index: cgi-bin/printers.c =================================================================== --- cgi-bin/printers.c (revision 9461) +++ cgi-bin/printers.c (working copy) @@ -1,9 +1,9 @@ /* * "$Id$" * - * Printer status CGI for the Common UNIX Printing System (CUPS). + * Printer status CGI for CUPS. * - * Copyright 2007-2008 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 1997-2006 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -148,7 +148,21 @@ } else if (printer) { - if (!strcmp(op, "start-printer")) + if (!*op) + { + const char *server_port = getenv("SERVER_PORT"); + /* Port number string */ + int port = atoi(server_port ? server_port : "0"); + /* Port number */ + char uri[1024]; /* URL */ + + httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), + getenv("HTTPS") ? "https" : "http", NULL, + getenv("SERVER_NAME"), port, "/printers/%s", printer); + + printf("Location: %s\n\n", uri); + } + else if (!strcmp(op, "start-printer")) do_printer_op(http, printer, IPP_RESUME_PRINTER, cgiText(_("Resume Printer"))); else if (!strcmp(op, "stop-printer")) Index: cgi-bin/admin.c =================================================================== --- cgi-bin/admin.c (revision 9461) +++ cgi-bin/admin.c (working copy) @@ -145,7 +145,30 @@ fprintf(stderr, "DEBUG: op=\"%s\"...\n", op); - if (!strcmp(op, "set-allowed-users")) + if (!*op) + { + const char *printer = getenv("PRINTER_NAME"), + /* Printer or class name */ + *server_port = getenv("SERVER_PORT"); + /* Port number string */ + int port = atoi(server_port ? server_port : "0"); + /* Port number */ + char uri[1024]; /* URL */ + + if (printer) + httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), + getenv("HTTPS") ? "https" : "http", NULL, + getenv("SERVER_NAME"), port, "/%s/%s", + cgiGetVariable("IS_CLASS") ? "classes" : "printers", + printer); + else + httpAssembleURI(HTTP_URI_CODING_ALL, uri, sizeof(uri), + getenv("HTTPS") ? "https" : "http", NULL, + getenv("SERVER_NAME"), port, "/admin"); + + printf("Location: %s\n\n", uri); + } + else if (!strcmp(op, "set-allowed-users")) do_set_allowed_users(http); else if (!strcmp(op, "set-as-default")) do_set_default(http); Index: cgi-bin/classes.c =================================================================== --- cgi-bin/classes.c (revision 9461) +++ cgi-bin/classes.c (working copy) @@ -1,9 +1,9 @@ /* * "$Id$" * - * Class status CGI for the Common UNIX Printing System (CUPS). + * Class status CGI for CUPS. * - * Copyright 2007-2008 by Apple Inc. + * Copyright 2007-2011 by Apple Inc. * Copyright 1997-2006 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -147,7 +147,21 @@ } else if (pclass) { - if (!strcmp(op, "start-class")) + if (!*op) + { + const char *server_port = getenv("SERVER_PORT"); + /* Port number string */ + int port = atoi(server_port ? server_port : "0"); + /* Port number */ + char uri[1024]; /* URL */ + + httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), + getenv("HTTPS") ? "https" : "http", NULL, + getenv("SERVER_NAME"), port, "/classes/%s", pclass); + + printf("Location: %s\n\n", uri); + } + else if (!strcmp(op, "start-class")) do_class_op(http, pclass, IPP_RESUME_PRINTER, cgiText(_("Resume Class"))); else if (!strcmp(op, "stop-class")) do_class_op(http, pclass, IPP_PAUSE_PRINTER, cgiText(_("Pause Class")));