设为首页 加入收藏

TOP

Okhttp3源码解析(5)-拦截器RetryAndFollowUpInterceptor(三)
2019-09-03 03:44:36 】 浏览:107
Tags:Okhttp3 源码 解析 拦截 RetryAndFollowUpInterceptor
HER 303 See Other - HTTP_CLIENT_TIMEOUT 408 Request Time-Out - HTTP_UNAVAILABLE 503 Service Unavailable 对于这些响应码都做了处理: 1.返回null ``` if (followUp == null) { if (!forWebSocket) { streamAllocation.release(); } return response; } ``` 2.其他异常情况直接抛异常了 强调: `MAX_FOLLOW_UPS`字段, 表示最大的重定向次数 ``` /** * How many redirects and auth challenges should we attempt? Chrome follows 21 redirects; Firefox, * curl, and wget follow 20; Safari follows 16; and HTTP/1.0 recommends 5. */ private static final int MAX_FOLLOW_UPS = 20; ``` ``` if (++followUpCount > MAX_FOLLOW_UPS) { streamAllocation.release(); throw new ProtocolException("Too many follow-up requests: " + followUpCount); } ``` 这节就说到这,希望对大家有所帮助..... ![](https://img2018.cnblogs.com/blog/1312938/201908/1312938-20190829084746645-654895211.png) 大家可以关注我的微信公众号:「秦子帅」一个有质量、有态度的公众号! ![公众号](https://img2018.cnblogs.com/blog/1312938/201908/1312938-20190829084746832-730035128.jpg)
首页 上一页 1 2 3 4 下一页 尾页 3/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇亲,麻烦给个五星好评!—RatingB.. 下一篇Android开发笔记

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目