| 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.net.ExtendedResponseInfo; | 9 import org.chromium.net.ExtendedResponseInfo; |
| 10 import org.chromium.net.ResponseInfo; | 10 import org.chromium.net.ResponseInfo; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 @Override | 64 @Override |
| 65 public void connect() throws IOException { | 65 public void connect() throws IOException { |
| 66 if (connected) { | 66 if (connected) { |
| 67 checkHasResponse(); | 67 checkHasResponse(); |
| 68 return; | 68 return; |
| 69 } | 69 } |
| 70 connected = true; | 70 connected = true; |
| 71 for (Pair<String, String> requestHeader : mRequestHeaders) { | 71 for (Pair<String, String> requestHeader : mRequestHeaders) { |
| 72 mRequest.addHeader(requestHeader.first, requestHeader.second); | 72 mRequest.addHeader(requestHeader.first, requestHeader.second); |
| 73 } | 73 } |
| 74 if (!getUseCaches()) { |
| 75 mRequest.disableCache(); |
| 76 } |
| 74 mRequest.start(); | 77 mRequest.start(); |
| 75 // Blocks until onResponseStarted or onFailed is called. | 78 // Blocks until onResponseStarted or onFailed is called. |
| 76 mMessageLoop.loop(); | 79 mMessageLoop.loop(); |
| 77 checkHasResponse(); | 80 checkHasResponse(); |
| 78 } | 81 } |
| 79 | 82 |
| 80 /** | 83 /** |
| 81 * Releases this connection so that its resources may be either reused or | 84 * Releases this connection so that its resources may be either reused or |
| 82 * closed. | 85 * closed. |
| 83 */ | 86 */ |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 return null; | 417 return null; |
| 415 } | 418 } |
| 416 List<Pair<String, String>> headers = | 419 List<Pair<String, String>> headers = |
| 417 mResponseInfo.getAllHeadersAsList(); | 420 mResponseInfo.getAllHeadersAsList(); |
| 418 if (pos >= headers.size()) { | 421 if (pos >= headers.size()) { |
| 419 return null; | 422 return null; |
| 420 } | 423 } |
| 421 return headers.get(pos); | 424 return headers.get(pos); |
| 422 } | 425 } |
| 423 } | 426 } |
| OLD | NEW |