Blame SOURCES/0003-Fix-incorrect-header-used-for-detecting-AJAX-request.patch

182345
From 6358a5169762ef7b89d8b6d0f1a99b006f0fdd2f Mon Sep 17 00:00:00 2001
182345
From: Olav Morken <olav.morken@uninett.no>
182345
Date: Wed, 25 Jul 2018 12:19:39 +0200
182345
Subject: [PATCH] Fix incorrect header used for detecting AJAX requests
182345
182345
The code was looking for "X-Request-With", but the header is actually
182345
"X-Requested-With". As far as I can tell, it has always been the
182345
latter, at least in the jQuery source code.
182345
182345
Fixes issue #174.
182345
---
182345
 README.md             | 2 +-
182345
 auth_mellon_handler.c | 4 ++--
182345
 2 files changed, 3 insertions(+), 3 deletions(-)
182345
182345
diff --git a/README.md b/README.md
182345
index 0a91dc5..8d85b43 100644
182345
--- a/README.md
182345
+++ b/README.md
182345
@@ -180,7 +180,7 @@ MellonDiagnosticsEnable Off
182345
         #           then we will redirect him to the login page of the IdP.
182345
         #
182345
         #           There is a special handling of AJAX requests, that are
182345
-        #           identified by the "X-Request-With: XMLHttpRequest" HTTP
182345
+        #           identified by the "X-Requested-With: XMLHttpRequest" HTTP
182345
         #           header. Since no user interaction can happen there,
182345
         #           we always fail unauthenticated (not logged in) requests
182345
         #           with a 403 Forbidden error without redirecting to the IdP.
182345
diff --git a/auth_mellon_handler.c b/auth_mellon_handler.c
182345
index b16dc45..e33e6e9 100644
182345
--- a/auth_mellon_handler.c
182345
+++ b/auth_mellon_handler.c
182345
@@ -3658,11 +3658,11 @@ int am_auth_mellon_user(request_rec *r)
182345
              * If this is an AJAX request, we cannot proceed to the IdP,
182345
              * Just fail early to save our resources
182345
              */
182345
-            ajax_header = apr_table_get(r->headers_in, "X-Request-With");
182345
+            ajax_header = apr_table_get(r->headers_in, "X-Requested-With");
182345
             if (ajax_header != NULL &&
182345
                 strcmp(ajax_header, "XMLHttpRequest") == 0) {
182345
                     AM_LOG_RERROR(APLOG_MARK, APLOG_INFO, 0, r,
182345
-                      "Deny unauthenticated X-Request-With XMLHttpRequest "
182345
+                      "Deny unauthenticated X-Requested-With XMLHttpRequest "
182345
                       "(AJAX) request");
182345
                     return HTTP_FORBIDDEN;
182345
             }
182345
-- 
182345
2.20.1
182345