Closed
Bug 369787
Opened 19 years ago
Closed 19 years ago
calling nsHttpChannel::SetContentType on a closed channel doesn't work as expected.
Categories
(Core :: Networking: HTTP, defect)
Core
Networking: HTTP
Tracking
()
RESOLVED
FIXED
mozilla1.9alpha5
People
(Reporter: sylvain.pasche, Assigned: sylvain.pasche)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 1 obsolete file)
|
3.41 KB,
patch
|
darin.moz
:
superreview+
|
Details | Diff | Splinter Review |
After the channel was dispatched and has no listener any more, calling nsHttpChannel::SetContentType() will set mContentCharsetHint, meaning the content type returned by GetContentType() is not changed.
mContentCharsetHint is used before opening the channel, but should not be used in case the channel is closed.
Comment 1•19 years ago
|
||
One problem is telling apart the "already closed" state and the "already closed, about to be reopened" state. I don't really see anything in either the API or the code that prevents someone from reopening a channel after it's done...
Comment 2•19 years ago
|
||
we don't support reopening, even though this code might not enforce that people don't do that.
Comment 3•19 years ago
|
||
We should at least document that in the API then. And maybe enforce it. I'd be pretty happy with us adding a "was ever opened" flag or something at that point.
The reason I brought it up is that people are doing it, based on newsgroup posts I've seen.
| Assignee | ||
Comment 4•19 years ago
|
||
This needs bug 372486 to be checked in order to compile.
Assignee: nobody → sylvain.pasche
Status: NEW → ASSIGNED
Attachment #258960 -
Flags: review?(cbiesinger)
| Assignee | ||
Comment 5•19 years ago
|
||
Regarding your question about an empty http server handler, I guess it's ok doing nothing in it, as it will be dealt in a specific way:
http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/netwerk/test/httpserver/httpd.js&rev=1.4&mark=1175-1192#1175
Comment 6•19 years ago
|
||
Comment on attachment 258960 [details] [diff] [review]
v1
please make BUGID and newType const
also, please use x-foo/x-bar
+function after_channel_closed() {
+ change_content_type();
put this in a try..catch (or try..finally) so that stop is called even if the test fails
Attachment #258960 -
Flags: review?(cbiesinger) → review+
| Assignee | ||
Comment 7•19 years ago
|
||
Attachment #258960 -
Attachment is obsolete: true
| Assignee | ||
Updated•19 years ago
|
Attachment #259482 -
Flags: superreview?(darin.moz)
Comment 8•19 years ago
|
||
Comment on attachment 259482 [details] [diff] [review]
v2
sr=darin (sorry for not reviewing this earlier)
Attachment #259482 -
Flags: superreview?(darin.moz) → superreview+
Updated•19 years ago
|
Whiteboard: [checkin needed]
Comment 9•19 years ago
|
||
mozilla/netwerk/protocol/http/src/nsHttpChannel.cpp 1.308
mozilla/netwerk/test/unit/test_bug331825.js 1.5
mozilla/netwerk/test/unit/test_bug369787.js 1.1
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Whiteboard: [checkin needed]
Target Milestone: --- → mozilla1.9alpha5
Comment 10•15 years ago
|
||
(In reply to comment #6)
> put this in a try..catch (or try..finally) so that stop is called even if the
> test fails
I should've pointed this out in onStopRequest as well :/ See bug 614717
You need to log in
before you can comment on or make changes to this bug.
Description
•