| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 class _HttpHeaders implements HttpHeaders { | 5 class _HttpHeaders implements HttpHeaders { |
| 6 _HttpHeaders() : _headers = new Map<String, List<String>>(); | 6 _HttpHeaders() : _headers = new Map<String, List<String>>(); |
| 7 | 7 |
| 8 List<String> operator[](String name) { | 8 List<String> operator[](String name) { |
| 9 name = name.toLowerCase(); | 9 name = name.toLowerCase(); |
| 10 return _headers[name]; | 10 return _headers[name]; |
| (...skipping 1421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1432 request.headers.host = host; | 1432 request.headers.host = host; |
| 1433 request.headers.port = port; | 1433 request.headers.port = port; |
| 1434 if (connection._onRequest != null) { | 1434 if (connection._onRequest != null) { |
| 1435 connection._onRequest(request); | 1435 connection._onRequest(request); |
| 1436 } else { | 1436 } else { |
| 1437 request.outputStream.close(); | 1437 request.outputStream.close(); |
| 1438 } | 1438 } |
| 1439 } | 1439 } |
| 1440 | 1440 |
| 1441 _HttpClientConnection connection = new _HttpClientConnection(this); | 1441 _HttpClientConnection connection = new _HttpClientConnection(this); |
| 1442 connection.onDetach = () => _activeSockets.remove(connection._socketConn); |
| 1442 | 1443 |
| 1443 // If there are active connections for this key get the first one | 1444 // If there are active connections for this key get the first one |
| 1444 // otherwise create a new one. | 1445 // otherwise create a new one. |
| 1445 Queue socketConnections = _openSockets[_connectionKey(host, port)]; | 1446 Queue socketConnections = _openSockets[_connectionKey(host, port)]; |
| 1446 if (socketConnections == null || socketConnections.isEmpty()) { | 1447 if (socketConnections == null || socketConnections.isEmpty()) { |
| 1447 Socket socket = new Socket(host, port); | 1448 Socket socket = new Socket(host, port); |
| 1448 // Until the connection is established handle connection errors | 1449 // Until the connection is established handle connection errors |
| 1449 // here as the HttpClientConnection object is not yet associated | 1450 // here as the HttpClientConnection object is not yet associated |
| 1450 // with the socket. | 1451 // with the socket. |
| 1451 socket.onError = (e) { | 1452 socket.onError = (e) { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1534 } | 1535 } |
| 1535 | 1536 |
| 1536 | 1537 |
| 1537 class _DetachedSocket implements DetachedSocket { | 1538 class _DetachedSocket implements DetachedSocket { |
| 1538 _DetachedSocket(this._socket, this._unparsedData); | 1539 _DetachedSocket(this._socket, this._unparsedData); |
| 1539 Socket get socket() => _socket; | 1540 Socket get socket() => _socket; |
| 1540 List<int> get unparsedData() => _unparsedData; | 1541 List<int> get unparsedData() => _unparsedData; |
| 1541 Socket _socket; | 1542 Socket _socket; |
| 1542 List<int> _unparsedData; | 1543 List<int> _unparsedData; |
| 1543 } | 1544 } |
| OLD | NEW |