Skip to content

The first request made "is not" cached #627

@13steinj

Description

@13steinj

I'm unsure if this is intended or just by consequence. I found this while writing up some tests for a Betamax-like package for python's httplib, and I was comparing responses with those from praw for the sake of ease.

I'll split this up into three scenarios:

  1. No authentication: The first request "is" cached by the handler, however reddit adds the "__cfduid" (I don't know what this does from a cursory look), "loid" (logged out id cookie for A/b tests), and "loidcreated" (timestamp of the LOid cookie creation so that reddit can change your variant test after a set amount of time) cookies to the requests Session cookiejar. Because of this, a request to the same url right after this does not read from the cache (as the cookies do not match, obviously).
  2. OAuth2 authentication: Same as scenario 1, except it's not the first request, it's the first request after authenticating.
  3. Login authentication: Same as scenario 1, except "reddit_session" and "secure_session" cookies are also added.

Sometimes a session_id cookie is also added, however this seems to be for anonymous tracking purposes and doesn't occur all the time.

Regardless the addition of these cookies make it so that the initial request, when stored in the DefaultHandler's cache, would never be retrieved from the cache (unless you manually manipulate the cookiejar)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions