From d3d7d517681e9cabcfffbbcdc27a3c698cc7bca8 Mon Sep 17 00:00:00 2001 From: "darin%meer.net" Date: Thu, 31 Jul 2003 17:11:21 +0000 Subject: [PATCH] fixes bug 210229 "Helper app Window for text/html document (two comma-delimited charsets in http content-type header)" r=biesi sr=bz git-svn-id: svn://10.0.0.236/trunk@145426 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/netwerk/protocol/http/src/nsHttpResponseHead.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mozilla/netwerk/protocol/http/src/nsHttpResponseHead.cpp b/mozilla/netwerk/protocol/http/src/nsHttpResponseHead.cpp index b4ea9a9c238..240333eb779 100644 --- a/mozilla/netwerk/protocol/http/src/nsHttpResponseHead.cpp +++ b/mozilla/netwerk/protocol/http/src/nsHttpResponseHead.cpp @@ -624,9 +624,12 @@ nsHttpResponseHead::ParseContentType(char *type) // if the server sent "*/*", it is meaningless, so do not store it. // also, if type is the same as mContentType, then just update the // charset. however, if charset is empty and mContentType hasn't - // changed, then don't wipe-out an existing mContentCharset. + // changed, then don't wipe-out an existing mContentCharset. we + // also want to reject a mime-type if it does not include a slash. + // some servers give junk after the charset parameter, which may + // include a comma, so this check makes us a bit more tolerant. - if (*type && strcmp(type, "*/*") != 0) { + if (*type && strcmp(type, "*/*") != 0 && strchr(type, '/')) { PRBool eq = mContentType.Equals(Substring(type, typeEnd)); if (!eq) mContentType.Assign(type, typeEnd - type);