Closed
Bug 89045
Opened 25 years ago
Closed 24 years ago
[RFE] autodetect content type for images when server gives incorrect content type
Categories
(Core :: DOM: Navigation, enhancement)
Core
DOM: Navigation
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: megabyte, Assigned: adamlock)
Details
(Keywords: compat, Whiteboard: WONTFIX ? -- non standards compliant (py8ieh: file new bug))
When attemping (for example) to view images with no extension (which means the
server does not send proper Content-Type) Mozilla (and Netscape 4.x) display
text data instead of the image. IE autodetects the file format and displays the
image.
Updated•25 years ago
|
Severity: normal → enhancement
Summary: autodetect content type → [RFE] autodetect content type
Comment 1•25 years ago
|
||
Marking INVALID. The server sends back:
Content-Type: text/html
so we parse it as html. The presence or lack of an file extension has nothing to
do with whether there is a content type.
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → INVALID
| Reporter | ||
Comment 2•25 years ago
|
||
Reopening with modified description the way I sohld have worded it originally.
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
Summary: [RFE] autodetect content type → [RFE] autodetect content type for images when server gives incorrect content type
Comment 3•25 years ago
|
||
Remarking as INVALID. The problem is that we can't know when the server has
given us an incorrect mimetype - that document could be perfectly valid.
IE works by actually ignoring a mimetype of text/html, and content-sniffing
anyway, which is broken - see http://www.damowmow.com/mozilla/xhtml-in-uas.xhtml
(although thats talking about xml, html, and xhtml), in particular the example
at http://www.damowmow.com/mozilla/html-not-xml.html - that case may have been a
server configuration error, or what the user actually wanted. There is no way
for a browser to determine what was intended.
Its possible to configure the server to do this sniffing for you, at least with
apache.
Status: REOPENED → RESOLVED
Closed: 25 years ago → 25 years ago
Resolution: --- → INVALID
| Reporter | ||
Comment 4•25 years ago
|
||
That's why I specifically said content type for /images/. Though that would
generate more overhead and probably best be left as a pref. I realize the
implications for text-type documents, but is there ever a time when binary
image data needs to be viewed?
Comment 5•25 years ago
|
||
ian, comments?
Comment 6•25 years ago
|
||
How can you tell if, when I send a file as text/html, I mean text/html, or if
I mean image/png?
Surely, if I mean image/png, I would have said image/png, and not text/html?
The point is that it is wrong for us to try to guess at what the author meant.
VERIFIED INVALID (really WONTFIX).
Status: RESOLVED → VERIFIED
I think the meaning is:
If the server was asked for something that was IMG, and a non image format goes
back, through it to the format detector thing that we use for things like file URLs.
Pavlov, is this a valid RFE?
Status: VERIFIED → REOPENED
Component: Networking → ImageLib
Resolution: INVALID → ---
Comment 8•25 years ago
|
||
we attempt to detect what form images are, at least for png jpeg and gif, by
looking at the first few bytes of the data. if we can't figure it out from that
then we use what the server told us.
| Reporter | ||
Comment 9•25 years ago
|
||
Can this also be done for images accessed directly instead of just ones
accessed with the <img> tag? (That's why I put it in Networking, not ImageLib)
Comment 10•25 years ago
|
||
There is no theoeretical reason why one should not embed a text/html or
text/plain or application/xml file in an <img> tag. I still think this bug
is INVALID and furthermore I think that the one case where we _do_ do content-
type sniffing (as described by Pavlov above) should be removed.
Keywords: compat
Whiteboard: WONTFIX ? -- non standards compliant (py8ieh: file new bug)
Comment 11•25 years ago
|
||
and application/xml makes sense for svg, sort of.
-> default imagelib owners for resolution
Assignee: neeti → pavlov
Status: REOPENED → NEW
QA Contact: benc → tpreston
Comment 12•24 years ago
|
||
How does one tell that an image is requested in the general case of clicking on
a link?
Comment 13•24 years ago
|
||
This bug only applys to images (or any other content really) that is loaded
directly. Not sure who should own this since this would have to happen prior
to the document viewer being created, which I belive is currently all done very
early based on the mimetype.
Assignee: pavlov → adamlock
Component: ImageLib → Embedding: Docshell
QA Contact: tpreston → adamlock
| Assignee | ||
Comment 14•24 years ago
|
||
I don't believe docshell is the place for this either. It looks like libpr0n
would be the place to sniff out the header and infer the correct content type .
Specifically, imgRequest::OnDataAvailable. The code attempts to create an image
decoder based on the content type given by the request. It could be changed so
that if no decoder existed for the provided content type, it would attempt to
infer the type by looking at a few bytes from the stream. If that didn't succeed
it could do what it does now and just abort the binding.
I will reassign on that basis.
Assignee: adamlock → pavlov
Component: Embedding: Docshell → ImageLib
QA Contact: adamlock → tpreston
| Assignee | ||
Comment 15•24 years ago
|
||
Ack, on second thoughts maybe it should be the content viewer people who own it.
Thoughts?
Assignee: pavlov → adamlock
Component: ImageLib → Embedding: Docshell
QA Contact: tpreston → adamlock
| Assignee | ||
Comment 16•24 years ago
|
||
Regrabbing bug
| Assignee | ||
Comment 17•24 years ago
|
||
This is a pretty tricky issue.
The problem is that the viewer is instantiated for any given mime type before
the data may have arrived. And it is the data that you need to correct the mime
type so the right viewer is instantiated.
That suggests either:
a) adding simple sanity checking in netwerk
b) In content loader factory sniff a few bytes from the data and determine the
real content type before creating the wrong viewer.
All these approaches are likely to have unforeseen issues since we would have to
wait for some data to arrive before being able to determine the content type.
Unless anyone has suggestions of clean ways to implement this functionality, I
would suggest marking this WONTFIX. The effort and risk appear to outweigh the
few occasions the fix would be useful.
We have debated this over and over, and so far the answer has always been: we
don't do content sniffing. There are several reasons for that, but for example
if we do, the server side will remain busted forever. The fix would also be
likely to introduce some tricky error situations. I vote for WONTFIX, and
evangelize the sites.
| Assignee | ||
Comment 19•24 years ago
|
||
Marking this WONTFIX.
If anyone wants to champion this bug then reopen and reassign. Personally I
don't believe the small payoff justifies the effort involved in producing a sane
fix.
Status: NEW → RESOLVED
Closed: 25 years ago → 24 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•