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 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1292 _closing = true; | 1292 _closing = true; |
1293 _socket.outputStream.close(); | 1293 _socket.outputStream.close(); |
1294 } | 1294 } |
1295 | 1295 |
1296 bool _destroy() { | 1296 bool _destroy() { |
1297 _closing = true; | 1297 _closing = true; |
1298 _socket.close(); | 1298 _socket.close(); |
1299 } | 1299 } |
1300 | 1300 |
1301 void _onData() { | 1301 void _onData() { |
1302 int available = _socket.available(); | 1302 List<int> buffer = _socket.read(); |
1303 if (available == 0) { | 1303 if (buffer != null) { |
1304 return; | 1304 _httpParser.writeList(buffer, 0, buffer.length); |
1305 } | |
1306 | |
1307 List<int> buffer = new Uint8List(available); | |
1308 int bytesRead = _socket.readList(buffer, 0, available); | |
1309 if (bytesRead > 0) { | |
1310 _httpParser.writeList(buffer, 0, bytesRead); | |
1311 } | 1305 } |
1312 } | 1306 } |
1313 | 1307 |
1314 void _onClosed() { | 1308 void _onClosed() { |
1315 _closing = true; | 1309 _closing = true; |
1316 _onConnectionClosed(null); | 1310 _onConnectionClosed(null); |
1317 } | 1311 } |
1318 | 1312 |
1319 void _onError(e) { | 1313 void _onError(e) { |
1320 // If an error occurs, make sure to close the socket if one is associated. | 1314 // If an error occurs, make sure to close the socket if one is associated. |
(...skipping 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2652 | 2646 |
2653 | 2647 |
2654 class _RedirectInfo implements RedirectInfo { | 2648 class _RedirectInfo implements RedirectInfo { |
2655 const _RedirectInfo(int this.statusCode, | 2649 const _RedirectInfo(int this.statusCode, |
2656 String this.method, | 2650 String this.method, |
2657 Uri this.location); | 2651 Uri this.location); |
2658 final int statusCode; | 2652 final int statusCode; |
2659 final String method; | 2653 final String method; |
2660 final Uri location; | 2654 final Uri location; |
2661 } | 2655 } |
OLD | NEW |