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

Side by Side Diff: runtime/bin/http_parser.dart

Issue 11231070: Fix bug in HTTP client request generation (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 | « runtime/bin/http_impl.dart ('k') | runtime/bin/websocket_impl.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) 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 // Global constants. 5 // Global constants.
6 class _Const { 6 class _Const {
7 // Bytes for "HTTP". 7 // Bytes for "HTTP".
8 static const HTTP = const [72, 84, 84, 80]; 8 static const HTTP = const [72, 84, 84, 80];
9 // Bytes for "HTTP/1.". 9 // Bytes for "HTTP/1.".
10 static const HTTP1DOT = const [72, 84, 84, 80, 47, 49, 46]; 10 static const HTTP1DOT = const [72, 84, 84, 80, 47, 49, 46];
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 } else { 227 } else {
228 if (_Const.SEPARATORS_AND_CR_LF.indexOf(byte) != -1) { 228 if (_Const.SEPARATORS_AND_CR_LF.indexOf(byte) != -1) {
229 throw new HttpParserException("Invalid request method"); 229 throw new HttpParserException("Invalid request method");
230 } 230 }
231 _method_or_status_code.addCharCode(byte); 231 _method_or_status_code.addCharCode(byte);
232 } 232 }
233 break; 233 break;
234 234
235 case _State.REQUEST_LINE_URI: 235 case _State.REQUEST_LINE_URI:
236 if (byte == _CharCode.SP) { 236 if (byte == _CharCode.SP) {
237 if (_uri_or_reason_phrase.length == 0) {
238 throw new HttpParserException("Invalid request URI");
239 }
237 _state = _State.REQUEST_LINE_HTTP_VERSION; 240 _state = _State.REQUEST_LINE_HTTP_VERSION;
238 _httpVersionIndex = 0; 241 _httpVersionIndex = 0;
239 } else { 242 } else {
240 if (byte == _CharCode.CR || byte == _CharCode.LF) { 243 if (byte == _CharCode.CR || byte == _CharCode.LF) {
241 throw new HttpParserException("Invalid request URI"); 244 throw new HttpParserException("Invalid request URI");
242 } 245 }
243 _uri_or_reason_phrase.addCharCode(byte); 246 _uri_or_reason_phrase.addCharCode(byte);
244 } 247 }
245 break; 248 break;
246 249
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 Function dataEnd; 718 Function dataEnd;
716 Function error; 719 Function error;
717 } 720 }
718 721
719 722
720 class HttpParserException implements Exception { 723 class HttpParserException implements Exception {
721 const HttpParserException([String this.message = ""]); 724 const HttpParserException([String this.message = ""]);
722 String toString() => "HttpParserException: $message"; 725 String toString() => "HttpParserException: $message";
723 final String message; 726 final String message;
724 } 727 }
OLDNEW
« no previous file with comments | « runtime/bin/http_impl.dart ('k') | runtime/bin/websocket_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698