summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authoryfriedman <yfriedman@chromium.org>2015-05-15 09:08:51 -0700
committerCommit bot <commit-bot@chromium.org>2015-05-15 16:09:54 +0000
commit4746a790d8682c550b2a57381985c3646e51096f (patch)
tree08311ef5495559b14cbf24460ccc43ed7f29e8eb /components
parent6bfe1b5612e270f8882099e486ad3975fd5b80fb (diff)
downloadchromium_src-4746a790d8682c550b2a57381985c3646e51096f.zip
chromium_src-4746a790d8682c550b2a57381985c3646e51096f.tar.gz
chromium_src-4746a790d8682c550b2a57381985c3646e51096f.tar.bz2
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}
Diffstat (limited to 'components')
-rw-r--r--components/cronet/android/java/src/org/chromium/net/ChromiumUrlRequest.java4
-rw-r--r--components/cronet/android/java/src/org/chromium/net/HttpUrlConnectionUrlRequest.java8
2 files changed, 5 insertions, 7 deletions
diff --git a/components/cronet/android/java/src/org/chromium/net/ChromiumUrlRequest.java b/components/cronet/android/java/src/org/chromium/net/ChromiumUrlRequest.java
index afccf84..f369e06 100644
--- a/components/cronet/android/java/src/org/chromium/net/ChromiumUrlRequest.java
+++ b/components/cronet/android/java/src/org/chromium/net/ChromiumUrlRequest.java
@@ -6,13 +6,13 @@ package org.chromium.net;
import android.util.Log;
-import org.apache.http.conn.ConnectTimeoutException;
import org.chromium.base.CalledByNative;
import org.chromium.base.JNINamespace;
import org.chromium.base.annotations.SuppressFBWarnings;
import java.io.IOException;
import java.net.MalformedURLException;
+import java.net.SocketTimeoutException;
import java.net.URL;
import java.net.UnknownHostException;
import java.nio.ByteBuffer;
@@ -186,7 +186,7 @@ public class ChromiumUrlRequest implements HttpUrlRequest {
case ChromiumUrlRequestError.MALFORMED_URL:
return new MalformedURLException("Malformed URL: " + mUrl);
case ChromiumUrlRequestError.CONNECTION_TIMED_OUT:
- return new ConnectTimeoutException("Connection timed out");
+ return new SocketTimeoutException("Connection timed out");
case ChromiumUrlRequestError.UNKNOWN_HOST:
String host;
try {
diff --git a/components/cronet/android/java/src/org/chromium/net/HttpUrlConnectionUrlRequest.java b/components/cronet/android/java/src/org/chromium/net/HttpUrlConnectionUrlRequest.java
index 88e97ea..21a2e35 100644
--- a/components/cronet/android/java/src/org/chromium/net/HttpUrlConnectionUrlRequest.java
+++ b/components/cronet/android/java/src/org/chromium/net/HttpUrlConnectionUrlRequest.java
@@ -7,8 +7,6 @@ package org.chromium.net;
import android.content.Context;
import android.text.TextUtils;
-import org.apache.http.HttpStatus;
-
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
@@ -283,7 +281,7 @@ class HttpUrlConnectionUrlRequest implements HttpUrlRequest {
if (mOffset != 0) {
// The server may ignore the request for a byte range.
- if (mHttpStatusCode == HttpStatus.SC_OK) {
+ if (mHttpStatusCode == HttpURLConnection.HTTP_OK) {
if (mContentLength != -1) {
mContentLength -= mOffset;
}
@@ -447,8 +445,8 @@ class HttpUrlConnectionUrlRequest implements HttpUrlRequest {
// the status code will be 206, not 200. Since the rest of the
// application is
// expecting 200 to indicate success, we need to fake it.
- if (httpStatusCode == HttpStatus.SC_PARTIAL_CONTENT) {
- httpStatusCode = HttpStatus.SC_OK;
+ if (httpStatusCode == HttpURLConnection.HTTP_PARTIAL) {
+ httpStatusCode = HttpURLConnection.HTTP_OK;
}
return httpStatusCode;
}