1 From bb10adda6f2f41448d809c3fe86175b5b69cba7b Mon Sep 17 00:00:00 2001
2 From: Michael R Sweet <michael.r.sweet@gmail.com>
3 Date: Mon, 16 Apr 2018 19:19:13 -0400
4 Subject: [PATCH] Try again to mirror fix (Issue #5289)
7 scheduler/client.c | 14 +++++++++++++-
8 scheduler/client.h | 1 +
9 2 files changed, 14 insertions(+), 1 deletion(-)
11 diff --git a/scheduler/client.c b/scheduler/client.c
12 index f68924aa1..1c4760bfd 100644
13 --- a/scheduler/client.c
14 +++ b/scheduler/client.c
15 @@ -818,6 +818,18 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */
17 if (status == HTTP_STATUS_OK)
20 + * Record whether the client is a web browser. "Mozilla" was the original
21 + * and it seems that every web browser in existence now uses that as the
22 + * prefix with additional information identifying *which* browser.
24 + * Chrome (at least) has problems with multiple WWW-Authenticate values in
25 + * a single header, so we only report Basic or Negotiate to web browsers and
26 + * leave the multiple choices to the native CUPS client...
29 + con->is_browser = !strncmp(httpGetField(con->http, HTTP_FIELD_USER_AGENT), "Mozilla/", 8);
31 if (httpGetField(con->http, HTTP_FIELD_ACCEPT_LANGUAGE)[0])
34 @@ -2361,7 +2373,7 @@ cupsdSendHeader(
35 strlcpy(auth_str, "Negotiate", sizeof(auth_str));
38 - if (con->best && auth_type != CUPSD_AUTH_NEGOTIATE &&
39 + if (con->best && auth_type != CUPSD_AUTH_NEGOTIATE && !con->is_browser &&
40 !_cups_strcasecmp(httpGetHostname(con->http, NULL, 0), "localhost"))
43 diff --git a/scheduler/client.h b/scheduler/client.h
44 index 7705f2c59..beddab0cc 100644
45 --- a/scheduler/client.h
46 +++ b/scheduler/client.h
47 @@ -30,6 +30,7 @@ struct cupsd_client_s
48 struct timeval start; /* Request start time */
49 http_state_t operation; /* Request operation */
50 off_t bytes; /* Bytes transferred for this request */
51 + int is_browser; /* Is the client a web browser? */
52 int type; /* AuthType for username */
53 char username[HTTP_MAX_VALUE],
54 /* Username from Authorization: line */