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

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

Issue 11316080: Change the HTTP close handling (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
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 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 new HttpParserException( 616 new HttpParserException(
617 "Connection closed before full body was received")); 617 "Connection closed before full body was received"));
618 } 618 }
619 } 619 }
620 620
621 void streamError(e) { 621 void streamError(e) {
622 // Don't report errors when HTTP parser is in idle state. Clients 622 // Don't report errors when HTTP parser is in idle state. Clients
623 // can close the connection and cause a connection reset by peer 623 // can close the connection and cause a connection reset by peer
624 // error which is OK. 624 // error which is OK.
625 if (_state == _State.START) { 625 if (_state == _State.START) {
626 print("$_requestParser $e");
Mads Ager (google) 2012/11/20 08:04:28 Remove debug print.
Søren Gjesse 2012/11/20 08:15:11 Done.
627
626 closed(); 628 closed();
627 return; 629 return;
628 } 630 }
629 error(e); 631 error(e);
630 } 632 }
631 633
632 String get version { 634 String get version {
633 switch (_httpVersion) { 635 switch (_httpVersion) {
634 case _HttpVersion.HTTP10: 636 case _HttpVersion.HTTP10:
635 return "1.0"; 637 return "1.0";
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 Function error; 768 Function error;
767 Function closed; 769 Function closed;
768 } 770 }
769 771
770 772
771 class HttpParserException implements Exception { 773 class HttpParserException implements Exception {
772 const HttpParserException([String this.message = ""]); 774 const HttpParserException([String this.message = ""]);
773 String toString() => "HttpParserException: $message"; 775 String toString() => "HttpParserException: $message";
774 final String message; 776 final String message;
775 } 777 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698