I am working on the FirePHP project (http://www.firephp.org/) which
sends multipart responses in order to embed debug information into the
response without affecting how Firefox renders the page.
A sample response body for a text/css file looks like this:
--dc4b00ada3c698a5267b44d58caca336
Content-type: text/css
HTML, BODY {
PADDING: 2px;
background-color: #EEEEEE;
}
HTML, BODY, P {
FONT-FAMILY: verdana;
FONT-SIZE: 10px;
}
--dc4b00ada3c698a5267b44d58caca336
Content-type: text/firephp
DEBUG INFO
--dc4b00ada3c698a5267b44d58caca336--
When Firefox loads this page as a standard stylesheet include:
<link href="Multipart.php?File=Style" rel="stylesheet"></link>
I get the following warnings and not all directives are loaded. If I
access the CSS file with the multipart response directly in the
browser only the text/css section is displayed as expected.
* Warning: The stylesheet .../Multipart.php?File=Style was loaded as
CSS even though its MIME type, "multipart/firephp", is not "text/css".
* Warning: Selector expected. Ruleset ignored due to bad selector.
* Warning: Unexpected end of file while searching for closing } of
invalid rule set.
You can see a live example here: http://www.firephp.org/Demo/Tests.htm
NOTE: You must have the Firebug and FirePHP extension installed to see
the warning.
Is there any way I can specify an additional header to make this work
properly or is this a limitation of the CSS content handler in
Firefox?
Any suggestions on how this could be implemented/fixed?
Thanks
Christoph
It doesn't. Whether it should is pretty unclear.
> * Warning: The stylesheet .../Multipart.php?File=Style was loaded as
> CSS even though its MIME type, "multipart/firephp", is not "text/css".
I should note that that type is not multipart/mixed. And the fact that you got
that warning means the page is in quirks mode; at that point we'll just assume
that you're serving up CSS.
> Is there any way I can specify an additional header to make this work
> properly
No. But in fact, it won't work in any existing UA, so....
-Boris
This is the same situation as discussed here:
http://groups.google.com/group/mozilla.dev.tech.xml/browse_thread/thread/e1599de6fc31f2e8/a03c065ba21f71ac#a03c065ba21f71ac
I'll find another way to send debug information.
Thanks!
-Christoph
Yes. The generic content-dispatch code dispatches it to the multipart/mixed
handler (because the browser itself does not support multipart/mixed), which
breaks it up into multiple pieces. The browser never sees the multipart/mixed data.
> I was hoping the CSS parser would treat the response in the same way but
> I guess it looks at the response at a lower level.
That's correct. The CSS parser sees the HTTP response as it comes from the server.
-Boris