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

Unified Diff: runtime/bin/http_parser.dart

Issue 10449020: Support using the HEAD request in the HTTP library (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/http_impl.dart ('k') | tests/standalone/io/http_head_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/http_parser.dart
diff --git a/runtime/bin/http_parser.dart b/runtime/bin/http_parser.dart
index c3f391a3e26c262c06ab185798041733896240a4..8486f5baa1e184b87f6b1255c387189be5b4be52 100644
--- a/runtime/bin/http_parser.dart
+++ b/runtime/bin/http_parser.dart
@@ -148,7 +148,9 @@ class _HttpParser {
if (_state == _State.FAILURE) {
throw new HttpParserException("Data on failed connection");
}
- while ((index < lastIndex) && _state != _State.FAILURE && _state != _State.UPGRADED) {
+ while ((index < lastIndex) &&
+ _state != _State.FAILURE &&
+ _state != _State.UPGRADED) {
int byte = buffer[index];
switch (_state) {
case _State.START:
@@ -173,7 +175,8 @@ class _HttpParser {
_httpVersionIndex++;
} else if (_httpVersionIndex == _Const.HTTP.length &&
byte == _CharCode.SLASH) {
- // HTTP/ parsed. As method is a token this cannot be a method anymore.
+ // HTTP/ parsed. As method is a token this cannot be a
+ // method anymore.
_httpVersionIndex++;
_state = _State.RESPONSE_HTTP_VERSION;
} else {
@@ -181,9 +184,13 @@ class _HttpParser {
for (int i = 0; i < _httpVersionIndex; i++) {
_method_or_status_code.addCharCode(_Const.HTTP[i]);
}
- //_method_or_status_code.addCharCode(byte);
- _httpVersion = _HttpVersion.UNDETERMINED;
- _state = _State.REQUEST_LINE_URI;
+ if (byte == _CharCode.SP) {
+ _state = _State.REQUEST_LINE_URI;
+ } else {
+ _method_or_status_code.addCharCode(byte);
+ _httpVersion = _HttpVersion.UNDETERMINED;
+ _state = _State.REQUEST_LINE_METHOD;
+ }
}
break;
« no previous file with comments | « runtime/bin/http_impl.dart ('k') | tests/standalone/io/http_head_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698