1
0
mirror of https://github.com/square/okhttp.git synced 2026-01-25 16:01:38 +03:00

Merge pull request #276 from square/jwilson/prepare_okhttp_1_2

Prepare for OkHttp 2.0.
This commit is contained in:
Jesse Wilson
2013-08-10 13:51:46 -07:00
10 changed files with 35 additions and 26 deletions

View File

@@ -1,6 +1,30 @@
Change Log
==========
Version 1.2 *(2013-08-10)*
----------------------------
* New APIs on OkHttpClient to set default timeouts for connect and read.
* Fix bug when caching SPDY responses.
* Fix a bug with SPDY plus half-closed streams. (thanks kwuollett)
* Fix a bug in `Content-Length` reporting for gzipped streams in the Apache
HTTP client adapter. (thanks kwuollett)
* Work around the Alcatel `getByInetAddress` bug (thanks k.kocel)
* Be more aggressive about testing pooled sockets before reuse. (thanks
warpspin)
* Include `Content-Type` and `Content-Encoding` in the Apache HTTP client
adapter. (thanks kwuollett)
* Add a media type class to OkHttp.
* Change custom header prefix:
```
X-Android-Sent-Millis is now OkHttp-Sent-Millis
X-Android-Received-Millis is now OkHttp-Received-Millis.
X-Android-Response-Source is now OkHttp-Response-Source.
X-Android-Selected-Transport is now OkHttp-Selected-Transport.
```
* Improve cache invalidation for POST-like requests.
* Bring MockWebServer into OkHttp and teach it SPDY.
Version 1.1.1 *(2013-06-23)*
----------------------------

View File

@@ -13,10 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.squareup.okhttp.internal.http;
package com.squareup.okhttp;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
@@ -28,7 +26,7 @@ import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
public final class Dispatcher {
final class Dispatcher {
// TODO: thread pool size should be configurable; possibly configurable per host.
private final ThreadPoolExecutor executorService = new ThreadPoolExecutor(
8, 8, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());

View File

@@ -21,7 +21,7 @@ package com.squareup.okhttp;
* <h3>Warning: Experimental OkHttp 2.0 API</h3>
* This class is in beta. APIs are subject to change!
*/
public class Failure {
/* OkHttp 2.0: public */ class Failure {
private final Request request;
private final Throwable exception;

View File

@@ -13,15 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.squareup.okhttp.internal.http;
package com.squareup.okhttp;
import com.squareup.okhttp.Failure;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
import java.io.IOException;
import java.net.HttpURLConnection;
public final class Job implements Runnable {
final class Job implements Runnable {
final HttpURLConnection connection;
final Request request;
final Response.Receiver responseReceiver;

View File

@@ -16,7 +16,6 @@
package com.squareup.okhttp;
import com.squareup.okhttp.internal.Util;
import com.squareup.okhttp.internal.http.Dispatcher;
import com.squareup.okhttp.internal.http.HttpAuthenticator;
import com.squareup.okhttp.internal.http.HttpURLConnectionImpl;
import com.squareup.okhttp.internal.http.HttpsURLConnectionImpl;
@@ -321,7 +320,7 @@ public final class OkHttpClient implements URLStreamHandlerFactory {
/**
* Schedules {@code request} to be executed.
*/
public void enqueue(Request request, Response.Receiver responseReceiver) {
/* OkHttp 2.0: public */ void enqueue(Request request, Response.Receiver responseReceiver) {
// Create the HttpURLConnection immediately so the enqueued job gets the current settings of
// this client. Otherwise changes to this client (socket factory, redirect policy, etc.) may
// incorrectly be reflected in the request when it is dispatched later.

View File

@@ -35,7 +35,7 @@ import java.util.Set;
* <h3>Warning: Experimental OkHttp 2.0 API</h3>
* This class is in beta. APIs are subject to change!
*/
public final class Request {
/* OkHttp 2.0: public */ final class Request {
private final URL url;
private final String method;
private final RawHeaders headers;

View File

@@ -33,7 +33,7 @@ import java.util.Set;
* <h3>Warning: Experimental OkHttp 2.0 API</h3>
* This class is in beta. APIs are subject to change!
*/
public final class Response {
/* OkHttp 2.0: public */ final class Response {
private final Request request;
private final int code;
private final RawHeaders headers;

View File

@@ -13,14 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.squareup.okhttp.internal;
package com.squareup.okhttp;
import com.squareup.okhttp.mockwebserver.MockResponse;
import com.squareup.okhttp.mockwebserver.MockWebServer;
import com.squareup.okhttp.mockwebserver.RecordedRequest;
import com.squareup.okhttp.MediaType;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import org.junit.After;
import org.junit.Test;

View File

@@ -13,11 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.squareup.okhttp.internal;
package com.squareup.okhttp;
import com.squareup.okhttp.Failure;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

View File

@@ -13,11 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.squareup.okhttp.internal;
package com.squareup.okhttp;
import com.squareup.okhttp.Failure;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;