]> 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:47:25 +0000 (12:47 +0800)
committerByron Jones <bjones@mozilla.com>
Wed, 29 Feb 2012 04:47:25 +0000 (12:47 +0800)
r=dkl, a=LpSolit

Bugzilla/WebService/Server/XMLRPC.pm

index 94d44fd019e07eb6d7362059d563946f6da8cd54..936e40fa57fae6876d054032d28c447e6ed448b3 100644 (file)
@@ -79,7 +79,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'} });
     }