OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.net.urlconnection; | 5 package org.chromium.net.urlconnection; |
6 | 6 |
7 import android.util.Pair; | 7 import android.util.Pair; |
8 | 8 |
9 import org.chromium.base.Log; | 9 import org.chromium.base.Log; |
10 import org.chromium.net.CronetEngine; | 10 import org.chromium.net.CronetEngine; |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 return contentLength; | 244 return contentLength; |
245 } | 245 } |
246 | 246 |
247 /** | 247 /** |
248 * Starts the request if {@code connected} is false. | 248 * Starts the request if {@code connected} is false. |
249 */ | 249 */ |
250 private void startRequest() throws IOException { | 250 private void startRequest() throws IOException { |
251 if (connected) { | 251 if (connected) { |
252 return; | 252 return; |
253 } | 253 } |
254 final UrlRequest.Builder requestBuilder = new UrlRequest.Builder( | 254 final UrlRequest.Builder requestBuilder = mCronetEngine.newUrlRequestBui
lder( |
255 getURL().toString(), new CronetUrlRequestCallback(), mMessageLoo
p, mCronetEngine); | 255 getURL().toString(), new CronetUrlRequestCallback(), mMessageLoo
p); |
256 if (doOutput) { | 256 if (doOutput) { |
257 if (method.equals("GET")) { | 257 if (method.equals("GET")) { |
258 method = "POST"; | 258 method = "POST"; |
259 } | 259 } |
260 if (mOutputStream != null) { | 260 if (mOutputStream != null) { |
261 requestBuilder.setUploadDataProvider( | 261 requestBuilder.setUploadDataProvider( |
262 mOutputStream.getUploadDataProvider(), mMessageLoop); | 262 mOutputStream.getUploadDataProvider(), mMessageLoop); |
263 if (getRequestProperty(CONTENT_LENGTH) == null && !isChunkedUplo
ad()) { | 263 if (getRequestProperty(CONTENT_LENGTH) == null && !isChunkedUplo
ad()) { |
264 addRequestProperty(CONTENT_LENGTH, | 264 addRequestProperty(CONTENT_LENGTH, |
265 Long.toString(mOutputStream.getUploadDataProvider().
getLength())); | 265 Long.toString(mOutputStream.getUploadDataProvider().
getLength())); |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 // Strips Content-Encoding response header. See crbug.com/592700. | 601 // Strips Content-Encoding response header. See crbug.com/592700. |
602 if (!entry.getKey().equalsIgnoreCase("Content-Encoding")) { | 602 if (!entry.getKey().equalsIgnoreCase("Content-Encoding")) { |
603 mResponseHeadersList.add( | 603 mResponseHeadersList.add( |
604 new AbstractMap.SimpleImmutableEntry<String, String>(ent
ry)); | 604 new AbstractMap.SimpleImmutableEntry<String, String>(ent
ry)); |
605 } | 605 } |
606 } | 606 } |
607 mResponseHeadersList = Collections.unmodifiableList(mResponseHeadersList
); | 607 mResponseHeadersList = Collections.unmodifiableList(mResponseHeadersList
); |
608 return mResponseHeadersList; | 608 return mResponseHeadersList; |
609 } | 609 } |
610 } | 610 } |
OLD | NEW |