Closed Bug 75679 Opened 23 years ago Closed 23 years ago

nsIRequest:: new load flags for cache

Categories

(Core :: Networking: Cache, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla0.9

People

(Reporter: darin.moz, Assigned: darin.moz)

References

Details

the nsIRequest:: load flags need to be revised.  the issues are:

1) need to support caching "no-cache" content for session history

2) VALIDATE_ALWAYS is unnecessary/redundant.  it can be replaced by either
   FORCE_VALIDATION or LOAD_NORMAL, depending on your interpretation of this
   flag ;-)

we can resolve these issues by adding the following flags:

   STORE_NO_CACHE_CONTENT - allow caching of content that should not be reused
   REUSE_NO_CACHE_CONTENT - allow reuse of content that shouldn't be reused

and removing VALIDATE_ALWAYS as it is currently equivalent to LOAD_NORMAL.
Status: NEW → ASSIGNED
Keywords: nsbeta1
Target Milestone: --- → mozilla0.9
Blocks: 56346, 73293, 75098
Blocks: 70229
gordon and i have developed a much simpler and (hopefully) more intuitive set
of load flags:

MUST_RELOAD                      - must ignore cached content and reload
MUST_VALIDATE                    - must validate cached content
DONT_VALIDATE                    - use whatever is in the cache
DONT_VALIDATE_EXPIRED            - dont validate things that have expired, but
                                   always reload/validate no-cache content.
DONT_VALIDATE_EXPIRED_IF_RECENT  - dont validate things that have expired if
                                   they were created/already-validated this    
                              session, but always reload/validate no-cache
                                   content.

the last two flags correspond to the browsing modes "validate never" and
"validate once per session."  if none of the flags are set, then validation
will be automatic, meaning only if the content has expired or if the content
must be validated.

as a comment: it turns out that http permits caching of all downloaded content;
however, some content simply must be validated before it can be reused.  this
is why the last two flags listed above do not rule out validation in all cases.
this means that the STORE_NO_CACHE_CONTENT flag that i previously proposed is
unnecessary.
i've been studying the way ns4x and ie5 interpret the cache validation flags,
and i believe that the way i've interpreted them is consistent.  i feel that
this is very important for maintaining expected browser behavior w.r.t. caching
and validation.
Discussed this extensively with gordon and gagan on friday, and we settled on
a hopefully simpler set of load flags:

LOAD_NORMAL       - normal browsing
LOAD_BYPASS_CACHE - ignore cached response, replaces FORCE_RELOAD
LOAD_FROM_CACHE   - trust cached response, even if the cached response was not
                    meant to be reused without validation.

if LOAD_NORMAL, then the following flags also apply:

VALIDATE_ALWAYS           - validate *all* cached responses before reusing.
VALIDATE_ONCE_PER_SESSION - always validate cached responses that were not meant
                            to be reused.  don't bother validating other cached
                            responses if already validated this session.
VALIDATE_NEVER            - always validate cached responses that were not meant
                            to be reused.  don't bother validating other cached
                            responses.

if LOAD_NORMAL and none of the VALIDATE_ bits are set, then validation is 
performed automatically (based on expiration times, etc).
A patch for the flags as just described was checked in on friday 4/13.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Component: Networking → Networking: Cache
QA Contact: tever → bbaetz
Summary: nsIRequest:: load flags need revision → nsIRequest:: new load flags for cache
verfied via lxr
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.