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 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1406 _request._streamErrorHandler(e); | 1406 _request._streamErrorHandler(e); |
1407 } | 1407 } |
1408 if (_response != null && _response._streamErrorHandler != null) { | 1408 if (_response != null && _response._streamErrorHandler != null) { |
1409 _response._streamErrorHandler(e); | 1409 _response._streamErrorHandler(e); |
1410 } | 1410 } |
1411 } | 1411 } |
1412 | 1412 |
1413 // If currently not processing any request close the socket when | 1413 // If currently not processing any request close the socket when |
1414 // we are done writing the response. | 1414 // we are done writing the response. |
1415 if (_httpParser.isIdle) { | 1415 if (_httpParser.isIdle) { |
| 1416 // If the httpParser is idle and we get an error from the |
| 1417 // connection we deal with that as a closed connection and not |
| 1418 // as an error. When the client disappears we get a connection |
| 1419 // reset by peer and that is OK. |
1416 if (e != null) { | 1420 if (e != null) { |
1417 onError(e); | 1421 onClosed(); |
1418 } else { | 1422 } else { |
1419 _socket.outputStream.onClosed = () { | 1423 _socket.outputStream.onClosed = () { |
1420 _destroy(); | 1424 _destroy(); |
1421 onClosed(); | 1425 onClosed(); |
1422 }; | 1426 }; |
1423 // If the client closes and we are done writing the response | 1427 // If the client closes and we are done writing the response |
1424 // the connection should be closed. | 1428 // the connection should be closed. |
1425 if (_response == null) _close(); | 1429 if (_response == null) _close(); |
1426 } | 1430 } |
1427 } else { | 1431 } else { |
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2656 | 2660 |
2657 | 2661 |
2658 class _RedirectInfo implements RedirectInfo { | 2662 class _RedirectInfo implements RedirectInfo { |
2659 const _RedirectInfo(int this.statusCode, | 2663 const _RedirectInfo(int this.statusCode, |
2660 String this.method, | 2664 String this.method, |
2661 Uri this.location); | 2665 Uri this.location); |
2662 final int statusCode; | 2666 final int statusCode; |
2663 final String method; | 2667 final String method; |
2664 final Uri location; | 2668 final Uri location; |
2665 } | 2669 } |
OLD | NEW |