We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
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.1,code == 200的Response。
HTTP/2
304
Http/1.1
code == 200
目前HTTP/2中关于Cache的地方我只发现了可以通过Server Push的方法主动推送资源给Client,其他地方没有改动,所以304响应在OkHttp中可以直接按照Http/1.1返回给上层200,反正这个Lib其实也不是像浏览器一样需要让上层知道304的,上层只需要知道获取资源成功,200即可,其他全部交给OkHttp来处理就好了。
查找源码参照了TragedyGo的简书
The text was updated successfully, but these errors were encountered:
No branches or pull requests
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.1
,code == 200
的Response。目前HTTP/2中关于Cache的地方我只发现了可以通过Server Push的方法主动推送资源给Client,其他地方没有改动,所以304响应在OkHttp中可以直接按照Http/1.1返回给上层200,反正这个Lib其实也不是像浏览器一样需要让上层知道304的,上层只需要知道获取资源成功,200即可,其他全部交给OkHttp来处理就好了。
查找源码参照了TragedyGo的简书
The text was updated successfully, but these errors were encountered: