]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 731219: Fix XMLRPC breakage when content-type contains a charset
authorByron Jones <bjones@mozilla.com>
Wed, 29 Feb 2012 04:51:35 +0000 (12:51 +0800)
committerByron Jones <bjones@mozilla.com>
Wed, 29 Feb 2012 04:51:35 +0000 (12:51 +0800)
r=dkl, a=LpSolit

Bugzilla/WebService/Server/XMLRPC.pm

index 822709d857d750182bddfe42d99548528e65fb51..025fb8f192cb408c49f20fe7e4b2837555c049a9 100644 (file)
@@ -93,7 +93,10 @@ sub deserialize {
     my $self = shift;
 
     # Only allow certain content types to protect against CSRF attacks
-    if (!grep($_ eq $ENV{'CONTENT_TYPE'}, XMLRPC_CONTENT_TYPE_WHITELIST)) {
+    my $content_type = lc($ENV{'CONTENT_TYPE'});
+    # Remove charset, etc, if provided
+    $content_type =~ s/^([^;]+);.*/$1/;
+    if (!grep($_ eq $content_type, XMLRPC_CONTENT_TYPE_WHITELIST)) {
         ThrowUserError('xmlrpc_illegal_content_type',
                        { content_type => $ENV{'CONTENT_TYPE'} });
     }