8000 fetcher: httpcaching fixes by sgotti · Pull Request #2965 · rkt/rkt · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Feb 24, 2020. It is now read-only.

fetcher: httpcaching fixes #2965

Merged
merged 2 commits into from
Aug 1, 2016
Merged

Conversation

sgotti
Copy link
Contributor
@sgotti sgotti commented Jul 22, 2016

The fetchers refactor in #1763 changed some logic in handling http Cache-Control max-age. The two commits fixes some issues for httpfetcher and namefetcher and adds related functional tests.

As you can see there's a lot of duplicated code between namefetcher and httpfetcher since namefetcher once discovered the ACI URL needs to fetch them via http (at the moment the unique supported transport). The proposals in #2953 and #2964 will avoid this code duplication.

The namefetcher commit will probably fix the problem reported in #2276 (comment)

/cc @dgonyeo It might interest you

@sgotti sgotti force-pushed the fetcher_httpcaching_fixes branch from a3fcbf9 to b84328e Compare July 22, 2016 09:39
return ""
}

func getRemoteForURL(s *store.Store, u *url.URL) (*store.Remote, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please, no more getters ;-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just moved the original function 😄 ok for remoteForURL?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@s-urbaniak
Copy link
Contributor

small nit, else LGTM

@s-urbaniak
Copy link
Contributor

... modulo green ;-)

@s-urbaniak s-urbaniak added this to the v1.12.0 milestone Jul 22, 2016
@sgotti sgotti force-pushed the fetcher_httpcaching_fixes branch from b84328e to 0896dc0 Compare July 22, 2016 10:08
@cgonyeo
Copy link
Member
cgonyeo commented Jul 22, 2016

FWIW my plugin proposal also fixed the duplication, as after performing discovery it used the http(s) plugin to actually perform the fetching.

@sgotti
Copy link
Contributor Author
sgotti commented Jul 22, 2016

@dgonyeo Great! We are on the same page. Sorry for not having mentioned #2830.

@lucab
Copy link
Member
lucab commented Jul 25, 2016

@sgotti this needs rebasing and also conflicts with #2975, in which order do you want to queue them?

@dgonyeo can you please have a second look and shepherd this in once rebased?

@lucab lucab assigned lucab and cgonyeo and unassigned lucab Jul 25, 2016
@sgotti
Copy link
Contributor Author
sgotti commented Jul 25, 2016

@sgotti this needs rebasing and also conflicts with #2975, in which order do you want to queue them?

No big preferences, I'll probably rebase it tomorrow, if #2975 goes first I'll rebase on top of it.

sgotti added 2 commits July 28, 2016 20:46
The fetcher refactor in rkt#1763 moved Cache-Control max-age check
inside the store caching logic, instead it should live in the transport
logic (currently colled "remote"), like the ETag handling.

This made the behavior different from the explained image fetching
behavior and will cause redownloading an image when using `--no-store`
regardless of the Cache-Control max-age value.

Also fix the maybeUseCached function since it's wrong to check the
returned cache-control max-age information. The check should be done with
the current max-age saved in the remote (before the http fetching).

A functional test has been added.
The fetcher refactor in rkt#1763 removed the http caching checks but left
them only in the http fetcher.

This patch adds the same logic also to the namefetcher and extends the
functional test to also check fetching by appc name.

In the meantime (it won't affect anything since there's no way to
currently ask for it) change the meaning of Fetcher.NoCache to not disable both store and
transport cache but only disable transport cache. This is a more logical
one and decoupled from the store as it should be.
@sgotti sgotti force-pushed the fetcher_httpcaching_fixes branch from 0896dc0 to 292a009 Compare July 28, 2016 18:46
@sgotti
Copy link
Contributor Author
sgotti commented Jul 28, 2016

@lucab rebased.

@iaguis
Copy link
Member
iaguis commented Jul 29, 2016

Is NoCache actually used anywhere?

@sgotti
Copy link
Contributor Author
sgotti commented Jul 29, 2016

@iaguis No (not setted by any rkt option). But it can become useful in this new acception when adding transport cache instead of relying on remote (#2964). The reason for the change in that commit is that it was easy to pur it here but of you prefer I'll try to split it out.

@iaguis
Copy link
Member
iaguis commented Jul 29, 2016

@iaguis No (not setted by any rkt option). But it can become useful in this new acception when adding transport cache instead of relying on remote (#2964). The reason for the change in that commit is that it was easy to pur it here but of you prefer I'll try to split it out.

No, it's fine here. I was just wondering.

@iaguis
Copy link
Member
iaguis commented Jul 29, 2016

lgtm

@iaguis
Copy link
Member
iaguis commented Jul 29, 2016

I'll wait for @dgonyeo's review before merging though.

@cgonyeo
Copy link
Member
cgonyeo commented Aug 1, 2016

LGTM

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0