Commit 4746a790 authored by yfriedman's avatar yfriedman Committed by Commit bot

Remove cronet dependency on org.apache.http.

Remaps status codes to ones from HttpURLConnection.
Changes ConnectTimoutException to SocketTimeoutException.

BUG=468861

Review URL: https://codereview.chromium.org/1141943003

Cr-Commit-Position: refs/heads/master@{#330103}
parent 6bfe1b56
...@@ -6,13 +6,13 @@ package org.chromium.net; ...@@ -6,13 +6,13 @@ package org.chromium.net;
import android.util.Log; import android.util.Log;
import org.apache.http.conn.ConnectTimeoutException;
import org.chromium.base.CalledByNative; import org.chromium.base.CalledByNative;
import org.chromium.base.JNINamespace; import org.chromium.base.JNINamespace;
import org.chromium.base.annotations.SuppressFBWarnings; import org.chromium.base.annotations.SuppressFBWarnings;
import java.io.IOException; import java.io.IOException;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.SocketTimeoutException;
import java.net.URL; import java.net.URL;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
...@@ -186,7 +186,7 @@ public class ChromiumUrlRequest implements HttpUrlRequest { ...@@ -186,7 +186,7 @@ public class ChromiumUrlRequest implements HttpUrlRequest {
case ChromiumUrlRequestError.MALFORMED_URL: case ChromiumUrlRequestError.MALFORMED_URL:
return new MalformedURLException("Malformed URL: " + mUrl); return new MalformedURLException("Malformed URL: " + mUrl);
case ChromiumUrlRequestError.CONNECTION_TIMED_OUT: case ChromiumUrlRequestError.CONNECTION_TIMED_OUT:
return new ConnectTimeoutException("Connection timed out"); return new SocketTimeoutException("Connection timed out");
case ChromiumUrlRequestError.UNKNOWN_HOST: case ChromiumUrlRequestError.UNKNOWN_HOST:
String host; String host;
try { try {
......
...@@ -7,8 +7,6 @@ package org.chromium.net; ...@@ -7,8 +7,6 @@ package org.chromium.net;
import android.content.Context; import android.content.Context;
import android.text.TextUtils; import android.text.TextUtils;
import org.apache.http.HttpStatus;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
...@@ -283,7 +281,7 @@ class HttpUrlConnectionUrlRequest implements HttpUrlRequest { ...@@ -283,7 +281,7 @@ class HttpUrlConnectionUrlRequest implements HttpUrlRequest {
if (mOffset != 0) { if (mOffset != 0) {
// The server may ignore the request for a byte range. // The server may ignore the request for a byte range.
if (mHttpStatusCode == HttpStatus.SC_OK) { if (mHttpStatusCode == HttpURLConnection.HTTP_OK) {
if (mContentLength != -1) { if (mContentLength != -1) {
mContentLength -= mOffset; mContentLength -= mOffset;
} }
...@@ -447,8 +445,8 @@ class HttpUrlConnectionUrlRequest implements HttpUrlRequest { ...@@ -447,8 +445,8 @@ class HttpUrlConnectionUrlRequest implements HttpUrlRequest {
// the status code will be 206, not 200. Since the rest of the // the status code will be 206, not 200. Since the rest of the
// application is // application is
// expecting 200 to indicate success, we need to fake it. // expecting 200 to indicate success, we need to fake it.
if (httpStatusCode == HttpStatus.SC_PARTIAL_CONTENT) { if (httpStatusCode == HttpURLConnection.HTTP_PARTIAL) {
httpStatusCode = HttpStatus.SC_OK; httpStatusCode = HttpURLConnection.HTTP_OK;
} }
return httpStatusCode; return httpStatusCode;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment