OkHttp v3.7.0 发布,一个高效的Http客户端

jopen 7年前
   <p style="text-align: center;"><strong><img alt="" src="https://simg.open-open.com/show/a6dcb578e17e7b0fb37f34f8fe57f157.png" /></strong></p>    <p> </p>    <p>OkHttp是一个高效的Http客户端,在Android开发中被大量使用,主要有如下的特点:</p>    <ul>     <li>支持HTTP2/SPDY黑科技</li>     <li>socket自动选择最好路线,并支持自动重连</li>     <li>拥有自动维护的socket连接池,减少握手次数</li>     <li>拥有队列线程池,轻松写并发</li>     <li>拥有Interceptors轻松处理请求与响应(比如透明GZIP压缩,LOGGING)</li>     <li>基于Headers的缓存策略</li>    </ul>    <h2>更新日志</h2>    <ul>     <li><strong>OkHttp no longer recovers from TLS handshake failures by attempting a TLSv1 connection.</strong> The fallback was necessary for servers that implemented version negotiation incorrectly. Now that 99.99% of servers do it right this fallback is obsolete.</li>     <li>Fix: Do not honor cookies set on a public domain. Previously a malicious site could inject cookies on top-level domains like<code>co.uk</code> because our cookie parser didn't honor the <a href="/misc/goto?guid=4959006065398301886">public suffix</a> list. Alongside this fix is a new API,<code>HttpUrl.topPrivateDomain()</code>, which returns the privately domain name if the URL has one.</li>     <li>Fix: Change <code>MediaType.charset()</code> to return null for unexpected charsets.</li>     <li>Fix: Don't skip cache invalidation if the invalidating response has no body.</li>     <li>Fix: Don't use a cryptographic random number generator for web sockets. Some Android devices implement<code>SecureRandom</code> incorrectly!</li>     <li>Fix: Correctly canonicalize IPv6 addresses in <code>HttpUrl</code>. This prevented OkHttp from trusting HTTPS certificates issued to certain IPv6 addresses.</li>     <li>Fix: Don't reuse connections after an unsuccessful <code>Expect: 100-continue</code>.</li>     <li>Fix: Handle either <code>TLS_</code> or <code>SSL_</code> prefixes for cipher suite names. This is necessary for IBM JVMs that use the <code>SSL_</code> prefix exclusively.</li>     <li>Fix: Reject HTTP/2 data frames if the stream ID is 0.</li>     <li>New: Connection coalescing. OkHttp may reuse HTTP/2 connections across calls that share an IP address and HTTPS certificate, even if their domain names are different.</li>     <li>New: MockWebServer's <code>RecordedRequest</code> exposes the requested <code>HttpUrl</code> with <code>getRequestUrl()</code>.</li>    </ul>    <h2>下载</h2>    <ul>     <li><a href="/misc/goto?guid=4959006065523142512" rel="nofollow"><strong>Source code</strong> (zip)</a></li>     <li><a href="/misc/goto?guid=4959006065644942988" rel="nofollow"><strong>Source code</strong> (tar.gz)</a></li>    </ul>    <p>本站原创,转载时保留以下信息:<br /> 本文转自:深度开源(open-open.com)<br /> 原文地址:<a href="http://www.open-open.com/news/view/7375d0fa">http://www.open-open.com/news/view/7375d0fa</a></p>