summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2019-12-02 16:47:22 -0500
committerMichael R Sweet <michael.r.sweet@gmail.com>2019-12-02 16:47:22 -0500
commit81d8eb3af3fb301c1d77cafe1f523c64fd72293d (patch)
treed9f895b540bf83f6c3e9bf33addce79317f316c5 /tools
parentb4f9e3f7ba079e5b3e19aecc5a1e3800d5dd08fd (diff)
downloadcups-81d8eb3af3fb301c1d77cafe1f523c64fd72293d.tar.gz
Also authenticate web IF.
Diffstat (limited to 'tools')
-rw-r--r--tools/ippeveprinter.c53
1 files changed, 32 insertions, 21 deletions
diff --git a/tools/ippeveprinter.c b/tools/ippeveprinter.c
index 930331e0f..a1c08790e 100644
--- a/tools/ippeveprinter.c
+++ b/tools/ippeveprinter.c
@@ -5734,8 +5734,7 @@ process_http(ippeve_client_t *client) /* I - Client connection */
* Handle HTTP Upgrade...
*/
- if (!strcasecmp(httpGetField(client->http, HTTP_FIELD_CONNECTION),
- "Upgrade"))
+ if (!strcasecmp(httpGetField(client->http, HTTP_FIELD_CONNECTION), "Upgrade"))
{
#ifdef HAVE_SSL
if (strstr(httpGetField(client->http, HTTP_FIELD_UPGRADE), "TLS/") != NULL && !httpIsEncrypted(client->http))
@@ -5854,32 +5853,44 @@ process_http(ippeve_client_t *client) /* I - Client connection */
httpFlushWrite(client->http);
}
}
- else if (!strcmp(client->uri, "/"))
+ else
{
/*
- * Show web status page...
+ * Authenticate if needed...
*/
- return (show_status(client));
- }
- else if (!strcmp(client->uri, "/media"))
- {
- /*
- * Show web media page...
- */
+ if ((http_status = authenticate_request(client)) != HTTP_STATUS_CONTINUE)
+ {
+ return (respond_http(client, http_status, NULL, NULL, 0));
+ }
- return (show_media(client));
- }
- else if (!strcmp(client->uri, "/supplies"))
- {
- /*
- * Show web supplies page...
- */
+ if (!strcmp(client->uri, "/"))
+ {
+ /*
+ * Show web status page...
+ */
+
+ return (show_status(client));
+ }
+ else if (!strcmp(client->uri, "/media"))
+ {
+ /*
+ * Show web media page...
+ */
- return (show_supplies(client));
+ return (show_media(client));
+ }
+ else if (!strcmp(client->uri, "/supplies"))
+ {
+ /*
+ * Show web supplies page...
+ */
+
+ return (show_supplies(client));
+ }
+ else
+ return (respond_http(client, HTTP_STATUS_NOT_FOUND, NULL, NULL, 0));
}
- else
- return (respond_http(client, HTTP_STATUS_NOT_FOUND, NULL, NULL, 0));
break;
case HTTP_STATE_POST :