| 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 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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 } else { | 417 } else { |
| 418 // Start of new header field. | 418 // Start of new header field. |
| 419 _headerField.add(_toLowerCase(byte)); | 419 _headerField.add(_toLowerCase(byte)); |
| 420 _state = _State.HEADER_FIELD; | 420 _state = _State.HEADER_FIELD; |
| 421 } | 421 } |
| 422 } | 422 } |
| 423 break; | 423 break; |
| 424 | 424 |
| 425 case _State.HEADER_ENDING: | 425 case _State.HEADER_ENDING: |
| 426 _expect(byte, _CharCode.LF); | 426 _expect(byte, _CharCode.LF); |
| 427 _headers._mutable = false; |
| 427 | 428 |
| 428 _contentLength = _headers.contentLength; | 429 _contentLength = _headers.contentLength; |
| 429 // Ignore the Content-Length header if Transfer-Encoding | 430 // Ignore the Content-Length header if Transfer-Encoding |
| 430 // is chunked (RFC 2616 section 4.4) | 431 // is chunked (RFC 2616 section 4.4) |
| 431 if (_chunked) _contentLength = -1; | 432 if (_chunked) _contentLength = -1; |
| 432 | 433 |
| 433 // If a request message has neither Content-Length nor | 434 // If a request message has neither Content-Length nor |
| 434 // Transfer-Encoding the message must not have a body (RFC | 435 // Transfer-Encoding the message must not have a body (RFC |
| 435 // 2616 section 4.3). | 436 // 2616 section 4.3). |
| 436 if (_messageType == _MessageType.REQUEST && | 437 if (_messageType == _MessageType.REQUEST && |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 Function error; | 785 Function error; |
| 785 Function closed; | 786 Function closed; |
| 786 } | 787 } |
| 787 | 788 |
| 788 | 789 |
| 789 class HttpParserException implements Exception { | 790 class HttpParserException implements Exception { |
| 790 const HttpParserException([String this.message = ""]); | 791 const HttpParserException([String this.message = ""]); |
| 791 String toString() => "HttpParserException: $message"; | 792 String toString() => "HttpParserException: $message"; |
| 792 final String message; | 793 final String message; |
| 793 } | 794 } |
| OLD | NEW |