Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: sdk/lib/io/http_parser.dart

Issue 12918002: Allow an empty HTTP resason phrase (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/standalone/io/regress_9194_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 if (byte < 0x30 && 0x39 < byte) { 413 if (byte < 0x30 && 0x39 < byte) {
414 throw new HttpParserException("Invalid response status code"); 414 throw new HttpParserException("Invalid response status code");
415 } else { 415 } else {
416 _method_or_status_code.add(byte); 416 _method_or_status_code.add(byte);
417 } 417 }
418 } 418 }
419 break; 419 break;
420 420
421 case _State.RESPONSE_LINE_REASON_PHRASE: 421 case _State.RESPONSE_LINE_REASON_PHRASE:
422 if (byte == _CharCode.CR) { 422 if (byte == _CharCode.CR) {
423 if (_uri_or_reason_phrase.length == 0) {
424 throw new HttpParserException("Invalid response reason phrase");
425 }
426 _state = _State.RESPONSE_LINE_ENDING; 423 _state = _State.RESPONSE_LINE_ENDING;
427 } else { 424 } else {
428 if (byte == _CharCode.CR || byte == _CharCode.LF) { 425 if (byte == _CharCode.CR || byte == _CharCode.LF) {
429 throw new HttpParserException("Invalid response reason phrase"); 426 throw new HttpParserException("Invalid response reason phrase");
430 } 427 }
431 _uri_or_reason_phrase.add(byte); 428 _uri_or_reason_phrase.add(byte);
432 } 429 }
433 break; 430 break;
434 431
435 case _State.RESPONSE_LINE_ENDING: 432 case _State.RESPONSE_LINE_ENDING:
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 StreamController<_HttpIncoming> _controller; 971 StreamController<_HttpIncoming> _controller;
975 StreamController<List<int>> _bodyController; 972 StreamController<List<int>> _bodyController;
976 } 973 }
977 974
978 975
979 class HttpParserException implements Exception { 976 class HttpParserException implements Exception {
980 const HttpParserException([String this.message = ""]); 977 const HttpParserException([String this.message = ""]);
981 String toString() => "HttpParserException: $message"; 978 String toString() => "HttpParserException: $message";
982 final String message; 979 final String message;
983 } 980 }
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/io/regress_9194_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698