Closed
Bug 121441
Opened 23 years ago
Closed 23 years ago
unable to publish via http PUT (nsStorageStream should support nsISeekableStream)
Categories
(Core :: Networking: HTTP, defect, P1)
Core
Networking: HTTP
Tracking
()
RESOLVED
FIXED
mozilla0.9.9
People
(Reporter: Brade, Assigned: darin.moz)
Details
Attachments
(2 files)
32.40 KB,
text/plain
|
Details | |
1.71 KB,
patch
|
Brade
:
review+
dveditz
:
superreview+
|
Details | Diff | Splinter Review |
I am unable to publish via http PUT.
This is the relevant code snippet:
nsCOMPtr<nsIUploadChannel> uploadChannel(do_QueryInterface(inputChannel));
uploadChannel->SetUploadStream(inputstream, tmpFormat, -1);
rv = inputChannel->AsyncOpen(this, nsnull);
I am trying to http publish with the username and password in the uri:
http://brade:password@blues.mcom.com/users/brade/publish/testpub.html
The url loads fine in Composer but publishing results in writing a 0-length
file. HTTP logging done; log file coming soon.
Reporter | ||
Comment 1•23 years ago
|
||
This log file was reproduced by doing the following steps:
* open location in Composer (http url with username and password)
* make a change in composer
* load "www.ietf.org" in browser window
* File | Publish
* quit
You should skip past everything for ietf.org to get to the put command (very
end of log file).
Reporter | ||
Comment 2•23 years ago
|
||
clarification for any readers of this bug: NO, my password isn't "password" :-P
Assignee | ||
Comment 3•23 years ago
|
||
does this "publish" example work for you in nav 4x?
Reporter | ||
Comment 4•23 years ago
|
||
4.x can publish this page to this server fine
Assignee | ||
Comment 5•23 years ago
|
||
-> 0.9.9 (critical)
Severity: normal → critical
Status: NEW → ASSIGNED
Priority: -- → P1
Target Milestone: --- → mozilla0.9.9
Assignee | ||
Comment 6•23 years ago
|
||
the response from the server is a 401, and the username:password from the URL
are used to generate a new request. this requires that the given nsIInputStream
be rewound, so it can be rewritten in the new request. it appears that
nsStorageStream unfortunately does not support nsISeekableStream. this is the
cause of this bug. if authentication were not required, you'd find that
everything would just work.
Assignee | ||
Updated•23 years ago
|
Summary: unable to publish via http PUT → unable to publish via http PUT (nsStorageStream should support nsISeekableStream)
Assignee | ||
Comment 7•23 years ago
|
||
this patch adds support for nsISeekableStream to nsStorageInputStream.
brade: can you verify that this patch solves the HTTP PUT problem?
Assignee | ||
Updated•23 years ago
|
Reporter | ||
Comment 8•23 years ago
|
||
Comment on attachment 66247 [details] [diff] [review]
v1.0 patch
this patch didn't work until I changed this line to
NS_IMPL_THREADSAFE_ISUPPORTS2(nsStorageInputStream, nsIInputStream,
nsISeekableStream)
r=brade with that fix :-)
Attachment #66247 -
Flags: review+
Comment 9•23 years ago
|
||
Comment on attachment 66247 [details] [diff] [review]
v1.0 patch
sr=dveditz with brade's change to the NS_IMPL_ macro
Attachment #66247 -
Flags: superreview+
Assignee | ||
Comment 10•23 years ago
|
||
brade: thanks for catching my error :-)
fixed-on-trunk
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Comment 11•23 years ago
|
||
nsStorageInputStream::Seek in this patch can pass an uninitialized value to Seek
if called with an unexpected value of aWhence. This, among other things,
produces a compiler warning.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Reporter | ||
Comment 12•23 years ago
|
||
I see a minor bug in nsStorageInputStream::ReadSegments as well:
availableInSegment doesn't get reset when mReadCursor and mSegmentEnd are reset
This causes a needless iteration.
Adding "availableInSegment = mSegmentEnd - mReadCursor;" after mSegmentEnd is
reset should fix this.
Keywords: patch
Assignee | ||
Comment 13•23 years ago
|
||
brade: i don't follow... are you sure the current impl is flawed?
aleksey: thanks for catching that mistake... fixed.
Reporter | ||
Comment 14•23 years ago
|
||
Here is the snippet of code where I think the bug is with some comments tossed
in to explain what I saw:
while (remainingCapacity) { // remainingCapacity is 8192
availableInSegment = mSegmentEnd - mReadCursor; // availableInSegment == 0
if (!availableInSegment) {
PRUint32 available = mStorageStream->mLogicalLength - mLogicalCursor;
if (!available) // available is # of bytes to write (say 700)
goto out;
mReadCursor = mStorageStream->mSegmentedBuffer->GetSegment(mSegmentNum++);
mSegmentEnd = mReadCursor + PR_MIN(mSegmentSize, available);
// THIS is where I think we need to reset availableInSegment
// since it is still 0
}
count = PR_MIN(availableInSegment, remainingCapacity);
// count is 0 since that's the min of 0 and 8192
writer(this, closure, mReadCursor, mLogicalCursor, count, &bytesConsumed);
// this was called to write 0 bytes
looping again will reset availableInSegment as desired but we do an iteration
for writing 0 bytes when we don't need to
Assignee | ||
Comment 15•23 years ago
|
||
hmm... that makes sense. i'm a bit worried about recalculating
availableInSegment, but i definitely think we should guard against calling the
writer to write zero bytes.
brade: how about filing a separate bug for this? ... feel free to submit a
patch BTW :-)
Assignee | ||
Comment 16•23 years ago
|
||
marking FIXED again
Status: REOPENED → RESOLVED
Closed: 23 years ago → 23 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•