Closed
Bug 342321
Opened 20 years ago
Closed 20 years ago
nsIncrementalDownload doesn't create 0-sized file when downloading a 0-sized file
Categories
(Core :: Networking, defect)
Core
Networking
Tracking
()
RESOLVED
FIXED
mozilla1.9alpha1
People
(Reporter: Waldo, Assigned: Waldo)
References
Details
(Keywords: fixed1.8.1)
Attachments
(1 file)
|
1.38 KB,
patch
|
darin.moz
:
review+
darin.moz
:
superreview+
dbaron
:
approval1.8.1+
|
Details | Diff | Splinter Review |
The problem is that the file is only ever created from scratch when a downloaded chunk is appended to the possibly-non-existent file, but nsIncrementalDownload::FlushChunk() short-circuits if the chunk to be written has a length of 0, and thus the file is never created.
This problem is part of what makes nsUpdateService die when zero-sized MARs are served to it -- it makes the reasonable assumption that the file has been downloaded and created during onStopRequest, and an exception is thrown trying to access the downloaded file's size.
| Assignee | ||
Comment 1•20 years ago
|
||
Attachment #226514 -
Flags: superreview?(darin)
Attachment #226514 -
Flags: review?(darin)
Updated•20 years ago
|
Attachment #226514 -
Flags: superreview?(darin)
Attachment #226514 -
Flags: superreview+
Attachment #226514 -
Flags: review?(darin)
Attachment #226514 -
Flags: review+
| Assignee | ||
Comment 2•20 years ago
|
||
Patch checked in on trunk; after some baking time I'd like to get it on trunk as well, particularly since the branch/trunk versions of these files are exactly synced.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9alpha
| Assignee | ||
Comment 3•20 years ago
|
||
Comment on attachment 226514 [details] [diff] [review]
Always create/truncate the dest. file during the channel's onStartRequest
This patch will help make the update service more reliable when the server-side component is buggy and generates a zero-sized update. The risk of the patch is very small -- the only difference in behavior occurs if |mCurrentSize == 0|, which only occurs if the downloaded file doesn't exist or has an existing size of zero. In either case we're just creating the file if it doesn't already exist or truncating the file if it does, using code which has performed reliably whenever |mCurrentSize != 0| (which is every circumstance in which the component otherwise performs correctly).
Attachment #226514 -
Flags: approval1.8.1?
| Assignee | ||
Comment 4•20 years ago
|
||
*** Bug 317305 has been marked as a duplicate of this bug. ***
Comment on attachment 226514 [details] [diff] [review]
Always create/truncate the dest. file during the channel's onStartRequest
a=dbaron on behalf of drivers. Please check in to the MOZILLA_1_8_BRANCH and mark the bug fixed1.8.1 once you have.
Attachment #226514 -
Flags: approval1.8.1? → approval1.8.1+
You need to log in
before you can comment on or make changes to this bug.
Description
•