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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
389 | 389 |
390 /** | 390 /** |
391 * Returns whether this connection uses a proxy server. | 391 * Returns whether this connection uses a proxy server. |
392 */ | 392 */ |
393 @Override | 393 @Override |
394 public boolean usingProxy() { | 394 public boolean usingProxy() { |
395 // TODO(xunjieli): implement this. | 395 // TODO(xunjieli): implement this. |
396 return false; | 396 return false; |
397 } | 397 } |
398 | 398 |
399 @Override | |
400 public void setConnectTimeout(int timeout) { | |
401 // Per-request connect timeout is not supported because of late binding. | |
402 // Sockets are assigned to requests according to request priorities | |
403 // when sockets are connected. This requires requests with the same host , | |
404 // domain and port to have same timeout. | |
405 throw new UnsupportedOperationException("Not supported"); | |
pauljensen
2016/05/19 00:51:59
I'm not sure throwing an exception here is what we
| |
406 } | |
407 | |
399 /** | 408 /** |
400 * Used by {@link CronetInputStream} to get more data from the network | 409 * Used by {@link CronetInputStream} to get more data from the network |
401 * stack. This should only be called after the request has started. Note | 410 * stack. This should only be called after the request has started. Note |
402 * that this call might block if there isn't any more data to be read. | 411 * that this call might block if there isn't any more data to be read. |
403 * Since byteBuffer is passed to the UrlRequest, it must be a direct | 412 * Since byteBuffer is passed to the UrlRequest, it must be a direct |
404 * ByteBuffer. | 413 * ByteBuffer. |
405 */ | 414 */ |
406 void getMoreData(ByteBuffer byteBuffer) throws IOException { | 415 void getMoreData(ByteBuffer byteBuffer) throws IOException { |
407 mRequest.read(byteBuffer); | 416 mRequest.read(byteBuffer); |
408 mMessageLoop.loop(); | 417 mMessageLoop.loop(getReadTimeout()); |
409 } | 418 } |
410 | 419 |
411 /** | 420 /** |
412 * Returns the index of request header in {@link #mRequestHeaders} or | 421 * Returns the index of request header in {@link #mRequestHeaders} or |
413 * -1 if not found. | 422 * -1 if not found. |
414 */ | 423 */ |
415 private int findRequestProperty(String key) { | 424 private int findRequestProperty(String key) { |
416 for (int i = 0; i < mRequestHeaders.size(); i++) { | 425 for (int i = 0; i < mRequestHeaders.size(); i++) { |
417 Pair<String, String> entry = mRequestHeaders.get(i); | 426 Pair<String, String> entry = mRequestHeaders.get(i); |
418 if (entry.first.equalsIgnoreCase(key)) { | 427 if (entry.first.equalsIgnoreCase(key)) { |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
588 // Strips Content-Encoding response header. See crbug.com/592700. | 597 // Strips Content-Encoding response header. See crbug.com/592700. |
589 if (!entry.getKey().equalsIgnoreCase("Content-Encoding")) { | 598 if (!entry.getKey().equalsIgnoreCase("Content-Encoding")) { |
590 mResponseHeadersList.add( | 599 mResponseHeadersList.add( |
591 new AbstractMap.SimpleImmutableEntry<String, String>(ent ry)); | 600 new AbstractMap.SimpleImmutableEntry<String, String>(ent ry)); |
592 } | 601 } |
593 } | 602 } |
594 mResponseHeadersList = Collections.unmodifiableList(mResponseHeadersList ); | 603 mResponseHeadersList = Collections.unmodifiableList(mResponseHeadersList ); |
595 return mResponseHeadersList; | 604 return mResponseHeadersList; |
596 } | 605 } |
597 } | 606 } |
OLD | NEW |