Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OkHttp3 Cache #65

Open
alwaystest opened this issue Aug 3, 2017 · 0 comments
Open

OkHttp3 Cache #65

alwaystest opened this issue Aug 3, 2017 · 0 comments

Comments

@alwaystest
Copy link
Owner

OkHttp3 Cache

标签(空格分隔): OkHttp3


okhttp3.internal.http.StatusLine.toString()

result.append(this.protocol == Protocol.HTTP_1_0?"HTTP/1.0":"HTTP/1.1");

所以即使网络请求使用了HTTP/2,启用了Cache之后,如果服务器使用HTTP/2响应304,那么Client接收到的依然是Http/1.1code == 200的Response。

目前HTTP/2中关于Cache的地方我只发现了可以通过Server Push的方法主动推送资源给Client,其他地方没有改动,所以304响应在OkHttp中可以直接按照Http/1.1返回给上层200,反正这个Lib其实也不是像浏览器一样需要让上层知道304的,上层只需要知道获取资源成功,200即可,其他全部交给OkHttp来处理就好了。

查找源码参照了TragedyGo的简书

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

No branches or pull requests

1 participant