Open
Bug 549444
Opened 15 years ago
Updated 9 months ago
Move nsUnknownDecoder logic into nsHttpChannel
Categories
(Core :: Networking: HTTP, defect, P5)
Core
Networking: HTTP
Tracking
()
NEW
People
(Reporter: dwitte, Unassigned)
References
(Blocks 1 open bug)
Details
(Whiteboard: [necko-would-take])
The title of this bug may be disingenuous, but the problem is like so:
If one registers a listener with nsHttpChannel, but no Content-Type hint is provided, nsUnknownDecoder will insert itself as a listener in between the channel and the provided listener.
If less than 512 bytes of data is provided in the stream, nsUnknownDecoder will buffer it, waiting for a Content-Type response header -- without calling the provided listeners' ODA.
nsHttpChannel::OnStopRequest will then call nsUnknownDecoder::OnStopRequest, which will belatedly call the provided listeners' ODA. By this time, the channel has changed its state, and things like nsHttpChannel::IsPending will return false. Which can be confusing for the listener.
One suggestion, if I understand bz and jduell correctly, was to move some of the logic of nsUnknownDecoder into the channel itself, such that it can call the listeners' OnStartRequest and ODA before the channel has stopped and changed its state.
Obviously, this bug is somewhat of an edge case, but if we're reworking this stuff at some point then we'd want to fix it.
Comment 1•15 years ago
|
||
This could be done somewhat like the binary detector in bug 389677 if HTTP channel could guarantee us that it has at least 512 bytes hanging out ready to pass to CallTypeSniffers when we enter nsHttpChannel::CallOnStartRequest.
Comment 2•15 years ago
|
||
Of course the difference is that you want to do this even if the LOAD_CALL_CONTENT_SNIFFERS flag isn't set.
Comment 3•15 years ago
|
||
Sure. We could even have a content sniffer category that's always called for HTTP if we want or something.
The question is how easy it is to provide the guarantee of comment 1. I guess the text-or-binary sniffer more or less already relies on this working, right?
Comment 4•15 years ago
|
||
The text-or-binary sniffer doesn't really care so much, right? I don't think we provide that guarantee right now (if the server is slow, etc)...
Comment 5•15 years ago
|
||
> The text-or-binary sniffer doesn't really care so much, right?
It does if we're going to follow the abarth mime sniff spec.
> I don't think we provide that guarantee right now
What's the simplest way to do so? Just buffer in nsHttpChannel itself?
Comment 6•15 years ago
|
||
I think you'd basically have to do it in nsInputStreamPump, i.e. delay the notification until you have that many bytes. That may be relatively easy to do actually.
Comment 7•15 years ago
|
||
Would that work for the case when we read the first 200 bytes from cache and the rest from the network or something?
Comment 8•15 years ago
|
||
No. That case will be a little hard to handle, considering the data comes from two different input streams then :/
Comment 9•15 years ago
|
||
What would be wrong with buffering 512 bytes of data in nsHttpChannel itself?
Comment 10•15 years ago
|
||
It's a lot of code to get it all right, I think.
Updated•9 years ago
|
Whiteboard: [necko-would-take]
Comment 11•7 years ago
|
||
Bulk change to priority: https://bugzilla.mozilla.org/show_bug.cgi?id=1399258
Priority: -- → P5
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•