OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 part of dart.io; | 5 part of dart.io; |
6 | 6 |
7 // Global constants. | 7 // Global constants. |
8 class _Const { | 8 class _Const { |
9 // Bytes for "HTTP". | 9 // Bytes for "HTTP". |
10 static const HTTP = const [72, 84, 84, 80]; | 10 static const HTTP = const [72, 84, 84, 80]; |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 } else { | 571 } else { |
572 _incoming.statusCode = _statusCode; | 572 _incoming.statusCode = _statusCode; |
573 _incoming.reasonPhrase = | 573 _incoming.reasonPhrase = |
574 new String.fromCharCodes(_uri_or_reason_phrase); | 574 new String.fromCharCodes(_uri_or_reason_phrase); |
575 } | 575 } |
576 _method_or_status_code.clear(); | 576 _method_or_status_code.clear(); |
577 _uri_or_reason_phrase.clear(); | 577 _uri_or_reason_phrase.clear(); |
578 if (_connectionUpgrade) { | 578 if (_connectionUpgrade) { |
579 _incoming.upgraded = true; | 579 _incoming.upgraded = true; |
580 _parserCalled = false; | 580 _parserCalled = false; |
581 _controller.add(_incoming); | 581 var tmp = _incoming; |
| 582 _closeIncoming(); |
| 583 _controller.add(tmp); |
582 return; | 584 return; |
583 } | 585 } |
584 if (_transferLength == 0 || | 586 if (_transferLength == 0 || |
585 (_messageType == _MessageType.RESPONSE && | 587 (_messageType == _MessageType.RESPONSE && |
586 (_noMessageBody || _responseToMethod == "HEAD"))) { | 588 (_noMessageBody || _responseToMethod == "HEAD"))) { |
587 _reset(); | 589 _reset(); |
588 var tmp = _incoming; | 590 var tmp = _incoming; |
589 _closeIncoming(); | 591 _closeIncoming(); |
590 _controller.add(tmp); | 592 _controller.add(tmp); |
591 break; | 593 break; |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
991 StreamController<_HttpIncoming> _controller; | 993 StreamController<_HttpIncoming> _controller; |
992 StreamController<List<int>> _bodyController; | 994 StreamController<List<int>> _bodyController; |
993 } | 995 } |
994 | 996 |
995 | 997 |
996 class HttpParserException implements Exception { | 998 class HttpParserException implements Exception { |
997 const HttpParserException([String this.message = ""]); | 999 const HttpParserException([String this.message = ""]); |
998 String toString() => "HttpParserException: $message"; | 1000 String toString() => "HttpParserException: $message"; |
999 final String message; | 1001 final String message; |
1000 } | 1002 } |
OLD | NEW |