Chromium Code Reviews| Index: components/cronet/android/java/src/org/chromium/net/HttpUrlConnectionUrlRequest.java |
| 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 21ce9c94bf196dfd40d18dee435d17c47a51b28c..98a515235f5d8dae2107b230be3c2c571173b0a0 100644 |
| --- a/components/cronet/android/java/src/org/chromium/net/HttpUrlConnectionUrlRequest.java |
| +++ b/components/cronet/android/java/src/org/chromium/net/HttpUrlConnectionUrlRequest.java |
| @@ -221,6 +221,8 @@ class HttpUrlConnectionUrlRequest implements HttpUrlRequest { |
| return; |
| } |
| + mListener.onResponseStarted(this); |
| + |
| mResponseStream = isError(mHttpStatusCode) ? mConnection |
| .getErrorStream() |
| : stream; |
| @@ -250,6 +252,14 @@ class HttpUrlConnectionUrlRequest implements HttpUrlRequest { |
| } catch (IOException e) { |
| mException = e; |
| } finally { |
| + if (mPostDataChannel != null) { |
| + try { |
| + mPostDataChannel.close(); |
| + } catch (IOException e) { |
| + // Ignore |
| + } |
| + } |
| + |
| // Don't call onRequestComplete yet if we are reading the response |
| // on a separate thread |
| if (!readingResponse) { |
| @@ -425,6 +435,15 @@ class HttpUrlConnectionUrlRequest implements HttpUrlRequest { |
| return mContentType; |
| } |
| + |
| + @Override |
| + public String getHeader(String name) { |
| + if (mConnection == null) { |
| + throw new IllegalStateException("Response headers not available"); |
|
tonycuadra
2014/05/19 17:32:24
extra space after "header not"
mef
2014/05/20 18:04:34
Done.
|
| + } |
| + return mConnection.getHeaderField(name); |
| + } |
| + |
| private void validateNotStarted() { |
| if (mStarted) { |
| throw new IllegalStateException("Request already started"); |