Closed
Bug 27022
Opened 25 years ago
Closed 25 years ago
Files read through nsBufferedInputStream are truncated
Categories
(Core :: Networking, defect, P3)
Tracking
()
VERIFIED
FIXED
M14
People
(Reporter: mbp, Assigned: warrensomebody)
Details
(Whiteboard: [PDT+])
Files read through nsBufferedInputStream are truncated to mBufferSize. If I try to read a large (text, html or other) file into the browser, I only get the first 64K. This happens with the latest (feb 8) source, but not with M13. The problem seems to be a bug in nsBufferedInputStram::Fill() in the file mozilla/netwerk/base/src/nsBufferedStreams.cpp If the buffer is empty when Fill() is called, mFillPoint is not moved back to zero. And under some circumstances this means that nothing is read into the buffer. To fix it I changed if (rem > 0) { // slide the remainder down to the start of the buffer // |<------------->|<--rem-->|<--->| // b c f s nsCRT::memcpy(mBuffer, mBuffer + mCursor, rem); mBufferStartOffset += mCursor; mFillPoint = rem; mCursor = 0; } to the following: if (rem > 0) { // slide the remainder down to the start of the buffer // |<------------->|<--rem-->|<--->| // b c f s nsCRT::memcpy(mBuffer, mBuffer + mCursor, rem); mBufferStartOffset += mCursor; } mFillPoint = rem; mCursor = 0; This seems to work well here, at least.
Assignee | ||
Comment 1•25 years ago
|
||
I'll take this. Doug: Can you review this change too? Jud: Could this be related to the data transfer problem you were seeing in the socket transport?
Comment 2•25 years ago
|
||
quite possibly (rick has that bug now). let me know when you've got something and I'll test it.
Comment 3•25 years ago
|
||
nice find mbp@worldonline.dk. warren, r=dougt.
Assignee | ||
Comment 4•25 years ago
|
||
Jud: Give this patch a try and see if it fixes the other problem you were seeing.
Comment 5•25 years ago
|
||
it may have helped, but we still bogg out. I'm noticing some event processing issues. If I give other windows attention while uploading, we seem to fall out of select and write some data :-/
Comment 6•25 years ago
|
||
scratch the event processing association comment, I'm tired. and I take back the "maybe" comment too. If I try to upload a 150k file, we get up to about 145k then stall. If I try to upload a 50k file, we get up to about 40k then stall.
Assignee | ||
Comment 7•25 years ago
|
||
Sounds like it's not flushing the last chunk in the buffer. If this is for input streams, then maybe we should just turn buffering off for now. We primarily determined the need for buffering for output streams. Input streams where a "bonus."
Assignee | ||
Comment 8•25 years ago
|
||
I think we need to pull mBufferStartOffset += mCursor; out of the if statement too, right? Otherwise the seek stuff gets thrown off.
Reporter | ||
Comment 9•25 years ago
|
||
I think you're right. "mBufferStartOffset += mCursor;" should also be moved.
Assignee | ||
Comment 10•25 years ago
|
||
mbp -- muchos gracias for spotting this, and for your suggested fix!
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•