summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2015-03-11 17:16:31 +0100
committerDavid Lawrence <dkl@mozilla.com>2015-03-11 17:18:15 +0100
commit64ad8e38d4e984b216a67d22f147921d1efaaa60 (patch)
tree25f7232928fa9dc4b0bfc07ba0268b18d8fbe8f6
parentcd00796d216adf82d18ed3b3a6bbcaa7b99b4619 (diff)
downloadbugzilla-64ad8e38d4e984b216a67d22f147921d1efaaa60.tar.gz
bugzilla-64ad8e38d4e984b216a67d22f147921d1efaaa60.tar.xz
Bug 1141440: OPTION response for CORS requests to REST doesn't allow X-Bugzilla headers
- Fixed t/001compile.t error due to tr///r only for 5.14+
-rw-r--r--Bugzilla/WebService/Server/REST.pm9
1 files changed, 7 insertions, 2 deletions
diff --git a/Bugzilla/WebService/Server/REST.pm b/Bugzilla/WebService/Server/REST.pm
index 9c9141c09..16e041985 100644
--- a/Bugzilla/WebService/Server/REST.pm
+++ b/Bugzilla/WebService/Server/REST.pm
@@ -134,8 +134,13 @@ sub response {
{ rpc => $self, result => \$result, response => $response });
# Access Control
- my @allowed_headers = (qw(accept content-type origin x-requested-with),
- map { tr/A-Z_/a-z\-/r } keys API_AUTH_HEADERS());
+ my @allowed_headers = qw(accept content-type origin x-requested-with);
+ foreach my $header (keys API_AUTH_HEADERS()) {
+ # We want to lowercase and replace _ with -
+ my $translated_header = $header;
+ $translated_header =~ tr/A-Z_/a-z\-/;
+ push(@allowed_headers, $translated_header);
+ }
$response->header("Access-Control-Allow-Origin", "*");
$response->header("Access-Control-Allow-Headers", join(', ', @allowed_headers));