]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Try again to mirror fix (Issue #5289)
authorMichael R Sweet <michael.r.sweet@gmail.com>
Mon, 16 Apr 2018 23:19:13 +0000 (19:19 -0400)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Mon, 16 Apr 2018 23:19:13 +0000 (19:19 -0400)
scheduler/client.c
scheduler/client.h

index f68924aa18897239f0d9134bcd5276775b0ba890..1c4760bfd883a846357ca668de13cb59b48835d3 100644 (file)
@@ -818,6 +818,18 @@ cupsdReadClient(cupsd_client_t *con)       /* I - Client to read from */
 
   if (status == HTTP_STATUS_OK)
   {
+   /*
+    * Record whether the client is a web browser.  "Mozilla" was the original
+    * and it seems that every web browser in existence now uses that as the
+    * prefix with additional information identifying *which* browser.
+    *
+    * Chrome (at least) has problems with multiple WWW-Authenticate values in
+    * a single header, so we only report Basic or Negotiate to web browsers and
+    * leave the multiple choices to the native CUPS client...
+    */
+
+    con->is_browser = !strncmp(httpGetField(con->http, HTTP_FIELD_USER_AGENT), "Mozilla/", 8);
+
     if (httpGetField(con->http, HTTP_FIELD_ACCEPT_LANGUAGE)[0])
     {
      /*
@@ -2361,7 +2373,7 @@ cupsdSendHeader(
       strlcpy(auth_str, "Negotiate", sizeof(auth_str));
     }
 
-    if (con->best && auth_type != CUPSD_AUTH_NEGOTIATE &&
+    if (con->best && auth_type != CUPSD_AUTH_NEGOTIATE && !con->is_browser &&
         !_cups_strcasecmp(httpGetHostname(con->http, NULL, 0), "localhost"))
     {
      /*
index 7705f2c596841dd0ad53c677b68fdf8680908c0f..beddab0cc5bf240ab5fed1bdd55bf118843be928 100644 (file)
@@ -30,6 +30,7 @@ struct cupsd_client_s
   struct timeval       start;          /* Request start time */
   http_state_t         operation;      /* Request operation */
   off_t                        bytes;          /* Bytes transferred for this request */
+  int                  is_browser;     /* Is the client a web browser? */
   int                  type;           /* AuthType for username */
   char                 username[HTTP_MAX_VALUE],
                                        /* Username from Authorization: line */