| Index: runtime/bin/http_parser.dart
|
| diff --git a/runtime/bin/http_parser.dart b/runtime/bin/http_parser.dart
|
| index 2e8d8fa26e15943b79c9e9690044da21461b3fed..f3ea7c52dc72dcabee7aff12529e3064adaa62ec 100644
|
| --- a/runtime/bin/http_parser.dart
|
| +++ b/runtime/bin/http_parser.dart
|
| @@ -259,12 +259,17 @@ class _HttpParser {
|
| if (byte == _CharCode.COLON) {
|
| _state = _State.HEADER_VALUE_START;
|
| } else {
|
| + if (!_isTokenChar(byte)) {
|
| + throw new HttpParserException("Invalid header field name");
|
| + }
|
| _headerField.addCharCode(_toLowerCase(byte));
|
| }
|
| break;
|
|
|
| case _State.HEADER_VALUE_START:
|
| - if (byte != _CharCode.SP && byte != _CharCode.HT) {
|
| + if (byte == _CharCode.CR) {
|
| + _state = _State.HEADER_VALUE_FOLDING_OR_ENDING;
|
| + } else if (byte != _CharCode.SP && byte != _CharCode.HT) {
|
| // Start of new header value.
|
| _headerValue.addCharCode(byte);
|
| _state = _State.HEADER_VALUE;
|
| @@ -518,6 +523,10 @@ class _HttpParser {
|
| _remainingContent = null;
|
| }
|
|
|
| + bool _isTokenChar(int byte) {
|
| + return byte > 31 && byte < 128 && _Const.SEPARATORS.indexOf(byte) == -1;
|
| + }
|
| +
|
| int _toLowerCase(int byte) {
|
| final int aCode = "A".charCodeAt(0);
|
| final int zCode = "Z".charCodeAt(0);
|
|
|