Closed
Bug 790524
Opened 13 years ago
Closed 13 years ago
The sniffing logic can overwrite sniffed content-type by application/octet-stream
Categories
(Core :: Networking: HTTP, defect)
Core
Networking: HTTP
Tracking
()
RESOLVED
FIXED
mozilla19
People
(Reporter: padenot, Assigned: padenot)
Details
Attachments
(1 file)
|
4.57 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
If we successfully sniff a file in [1], but we set a nsUnknownDecoder as mListener in [2], we will end up overwriting what we sniffed when OnDataAvailable for the nsUnknownDecoder is called, because the nsUnknownDecoder does not check if we already have a content-type in the request, but only in its mContentType.
[1]: http://mxr.mozilla.org/mozilla-central/source/netwerk/protocol/http/nsHttpChannel.cpp
[2]: http://mxr.mozilla.org/mozilla-central/source/netwerk/streamconv/converters/nsUnknownDecoder.cpp#305
Comment 1•13 years ago
|
||
And the point is that we should be setting up the unknown decoder, if we do it, _after_ calling content sniffers, I think.
Christian, Jason, does that make sense?
Comment 2•13 years ago
|
||
I'm probably missing something here, but
http://mxr.mozilla.org/mozilla-central/source/netwerk/protocol/http/nsHttpChannel.cpp#885
seems to set mContentType when the sniffers are run. So why isn't nsUnknownDecoder::DetermineContentType failing or returning right away?
http://mxr.mozilla.org/mozilla-central/source/netwerk/streamconv/converters/nsUnknownDecoder.cpp#307
But that's just from looking at this briefly, without an actual test case to follow. An xpcshell test or some other steps to repro would be nice.
Comment 3•13 years ago
|
||
> So why isn't nsUnknownDecoder::DetermineContentType failing or returning right away?
nsUnknownDecoder is set up as a stream converter in this case, not a content sniffer. See the beginning of nsHttpChannel::CallOnStartRequest.
Comment 4•13 years ago
|
||
hm, that sounds reasonable
| Assignee | ||
Comment 5•13 years ago
|
||
This is what comment 1 describes and is green on try.
Attachment #682543 -
Flags: review?(bzbarsky)
Comment 6•13 years ago
|
||
Comment on attachment 682543 [details] [diff] [review]
Avoid overwriting the content-type by application/octet-stream in the sniffing logic. r=
Perfect, thanks!
Attachment #682543 -
Flags: review?(bzbarsky) → review+
| Assignee | ||
Comment 7•13 years ago
|
||
Status: NEW → ASSIGNED
| Assignee | ||
Updated•13 years ago
|
Assignee: nobody → paul
Comment 8•13 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
You need to log in
before you can comment on or make changes to this bug.
Description
•