Closed Bug 278007 Opened 15 years ago Closed 14 years ago

Cache entries are killed too often

Categories

(Core :: Networking: HTTP, defect)

defect
Not set

Tracking

()

RESOLVED DUPLICATE of bug 189570
mozilla1.9alpha1

People

(Reporter: Biesinger, Assigned: darin.moz)

References

()

Details

(Keywords: helpwanted)

in nsHttpChannel.cpp, we have this statement:
3713             isPartial = !mTransaction->ResponseIsComplete();

So, isPartial will be false if we have all the data already. (as per
http://lxr.mozilla.org/seamonkey/source/netwerk/protocol/http/src/nsHttpTransaction.cpp#845
)

Now, the cache entry:
3764         nsresult closeStatus = status;

This will be a failure code when the channel got cancelled (or when it failed...)

now there's some code as to not kill the cache entry in some cases:
3765         if (mCanceled) {
3768             if (request == mCachePump)
3769                 closeStatus = NS_OK;

This one is not generally the case, assumes reading from cache.

3773             else if (isPartial && mResponseHead &&
mResponseHead->IsResumable()) {
3775                 closeStatus = NS_OK; 

This condition is _not_ met when we already have the full data!


In fact, it seems to me like a better logic would be to always keep the cache
data. When not resumable, overwrite it the next time we load this URL.
If this is wasteful with disk space, then maybe throw it away iff we read some
data and load is not resumable.


This would also fix the problem that the cache data is thrown away just because
the hostname can not be resolved (eg, laptop with no current network connection,
for example on a train)
Maybe related to bug 189570?
Keywords: helpwanted
Target Milestone: --- → mozilla1.9alpha
*** Bug 298988 has been marked as a duplicate of this bug. ***
Going to go ahead and dupe these.

*** This bug has been marked as a duplicate of 189570 ***
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.