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

Bugzilla/WebService/Server/XMLRPC.pm

index 33a1e92d3704d668243212e3af64c90eb7fbcd3a..e8fb5de997d4ab7c6751934ccb3c0bb057ac6919 100644 (file)
@@ -80,7 +80,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'} });
     }