[Filesystem-dev] CR-Client: fix for Content-Type with charset appended
Eric Hyche ehyche at real.com
Synopsis: Correctly read mime type in httpfsys when charset
is appended to the string (as in JSP 2.0 servers)
Overview: A customer was using a Java Server Page server to generate
SMIL presentations. After the customer upgraded their
JSP server to 2.0, they found that the generated SMIL
presentations would no longer work in our player (any
version), but rather would attempt an AU.
What was happening was that the JSP 2.0 spec specifies
that under certain conditions, the charset should be
appended to the "Content-Type" header, as in:
Content-Type: application/smil;charset=ISO-8859-1
For more information, see the JSP 2.0 spec at:
http://www.jcp.org/aboutJava/communityprocess/review/jsr152
httpfys was taking the whole string as the mime type,
and therefore could not match mime types with any
available file format. Also, since the URL had a
.jsp extension, then it couldn't match on file
extension either. So we AU'd.
The fix is simply to search for a ';' in the
"Content-Type" string and ignore it and anything that
comes after it.
Files Modified:
filesystem/http/httpfsys.cpp
Image Size and Heap Use impact: tiny increase
Platforms and Profiles Affected: all that use full httpfsys
Distribution Libraries affected: none
Distribution library impact and planned action: n/a
Platforms and Profiles Build Verified: win32
Platforms and Profiles Functionality verified: win32
Branch: head, 116Nep, 130NepX, others?
QA Instructions:
This URL should work both before and after the fix:
http://sander.internet.eo.nl:8080/real/index.jsp
This URL should only work after the fix:
http://sander.internet.eo.nl:9090/real/index.jsp
Index: httpfsys.cpp
===================================================================
RCS file: /cvsroot/filesystem/http/httpfsys.cpp,v
retrieving revision 1.30
diff -u -w -u -w -r1.30 httpfsys.cpp
--- httpfsys.cpp 23 Apr 2004 23:12:23 -0000 1.30
+++ httpfsys.cpp 14 May 2004 19:56:05 -0000
@@ -4957,6 +4957,27 @@
CHXString sMimeType;
sMimeType = pMessage->getHeaderValue("content-type");
+ // Some Java Server Pages (JSP) servers (version 2.0
+ // and higher) may append the "charset" after the
+ // mime type in the "Content-Type" header like this:
+ //
+ // Content-Type: application/smil;charset=ISO-8859-1
+ //
+ // as specified in the JSP 2.0 specification:
+ // http://www.jcp.org/aboutJava/communityprocess/review/jsr152
+ //
+ // Therefore, we should check to see if there's a ';'
+ // in the content type. If there is, then only use the string
+ // up to that point
+ INT32 lSemi = sMimeType.Find(';');
+ if (lSemi > 0)
+ {
+ // We have a semi-colon, so only use the content-type
+ // up to the semi-colon but not include it or anything
+ // past it
+ sMimeType = sMimeType.Left(lSemi);
+ }
+
// IF "application/octet-stream"
// mask mimetype to get actual mimetype
// based on extension later in the core.
======================================
M. Eric Hyche (ehyche at real.com)
Core Technologies
RealNetworks, Inc.