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

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

Issue 10883071: - Change "static final" to "static const" in the runtime/ directory. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 | « runtime/bin/http_impl.dart ('k') | runtime/bin/input_stream.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 final 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 final HTTP1DOT = const [72, 84, 84, 80, 47, 49, 46]; 10 static const HTTP1DOT = const [72, 84, 84, 80, 47, 49, 46];
11 // Bytes for "HTTP/1.0". 11 // Bytes for "HTTP/1.0".
12 static final HTTP10 = const [72, 84, 84, 80, 47, 49, 46, 48]; 12 static const HTTP10 = const [72, 84, 84, 80, 47, 49, 46, 48];
13 // Bytes for "HTTP/1.1". 13 // Bytes for "HTTP/1.1".
14 static final HTTP11 = const [72, 84, 84, 80, 47, 49, 46, 49]; 14 static const HTTP11 = const [72, 84, 84, 80, 47, 49, 46, 49];
15 15
16 static final END_CHUNKED = const [0x30, 13, 10, 13, 10]; 16 static const END_CHUNKED = const [0x30, 13, 10, 13, 10];
17 17
18 // Bytes for '()<>@,;:\\"/[]?={} \t'. 18 // Bytes for '()<>@,;:\\"/[]?={} \t'.
19 static final SEPARATORS = const [40, 41, 60, 62, 64, 44, 59, 58, 92, 34, 47, 19 static const SEPARATORS = const [40, 41, 60, 62, 64, 44, 59, 58, 92, 34, 47,
20 91, 93, 63, 61, 123, 125, 32, 9]; 20 91, 93, 63, 61, 123, 125, 32, 9];
21 21
22 // Bytes for '()<>@,;:\\"/[]?={} \t\r\n'. 22 // Bytes for '()<>@,;:\\"/[]?={} \t\r\n'.
23 static final SEPARATORS_AND_CR_LF = const [40, 41, 60, 62, 64, 44, 59, 58, 92, 23 static const SEPARATORS_AND_CR_LF = const [40, 41, 60, 62, 64, 44, 59, 58, 92,
24 34, 47, 91, 93, 63, 61, 123, 125, 24 34, 47, 91, 93, 63, 61, 123, 125,
25 32, 9, 13, 10]; 25 32, 9, 13, 10];
26 } 26 }
27 27
28 28
29 // Frequently used character codes. 29 // Frequently used character codes.
30 class _CharCode { 30 class _CharCode {
31 static final int HT = 9; 31 static const int HT = 9;
32 static final int LF = 10; 32 static const int LF = 10;
33 static final int CR = 13; 33 static const int CR = 13;
34 static final int SP = 32; 34 static const int SP = 32;
35 static final int COMMA = 44; 35 static const int COMMA = 44;
36 static final int DASH = 45; 36 static const int DASH = 45;
37 static final int SLASH = 47; 37 static const int SLASH = 47;
38 static final int ZERO = 48; 38 static const int ZERO = 48;
39 static final int ONE = 49; 39 static const int ONE = 49;
40 static final int COLON = 58; 40 static const int COLON = 58;
41 static final int SEMI_COLON = 59; 41 static const int SEMI_COLON = 59;
42 } 42 }
43 43
44 44
45 // States of the HTTP parser state machine. 45 // States of the HTTP parser state machine.
46 class _State { 46 class _State {
47 static final int START = 0; 47 static const int START = 0;
48 static final int METHOD_OR_RESPONSE_HTTP_VERSION = 1; 48 static const int METHOD_OR_RESPONSE_HTTP_VERSION = 1;
49 static final int RESPONSE_HTTP_VERSION = 2; 49 static const int RESPONSE_HTTP_VERSION = 2;
50 static final int REQUEST_LINE_METHOD = 3; 50 static const int REQUEST_LINE_METHOD = 3;
51 static final int REQUEST_LINE_URI = 4; 51 static const int REQUEST_LINE_URI = 4;
52 static final int REQUEST_LINE_HTTP_VERSION = 5; 52 static const int REQUEST_LINE_HTTP_VERSION = 5;
53 static final int REQUEST_LINE_ENDING = 6; 53 static const int REQUEST_LINE_ENDING = 6;
54 static final int RESPONSE_LINE_STATUS_CODE = 7; 54 static const int RESPONSE_LINE_STATUS_CODE = 7;
55 static final int RESPONSE_LINE_REASON_PHRASE = 8; 55 static const int RESPONSE_LINE_REASON_PHRASE = 8;
56 static final int RESPONSE_LINE_ENDING = 9; 56 static const int RESPONSE_LINE_ENDING = 9;
57 static final int HEADER_START = 10; 57 static const int HEADER_START = 10;
58 static final int HEADER_FIELD = 11; 58 static const int HEADER_FIELD = 11;
59 static final int HEADER_VALUE_START = 12; 59 static const int HEADER_VALUE_START = 12;
60 static final int HEADER_VALUE = 13; 60 static const int HEADER_VALUE = 13;
61 static final int HEADER_VALUE_FOLDING_OR_ENDING = 14; 61 static const int HEADER_VALUE_FOLDING_OR_ENDING = 14;
62 static final int HEADER_VALUE_FOLD_OR_END = 15; 62 static const int HEADER_VALUE_FOLD_OR_END = 15;
63 static final int HEADER_ENDING = 16; 63 static const int HEADER_ENDING = 16;
64 64
65 static final int CHUNK_SIZE_STARTING_CR = 17; 65 static const int CHUNK_SIZE_STARTING_CR = 17;
66 static final int CHUNK_SIZE_STARTING_LF = 18; 66 static const int CHUNK_SIZE_STARTING_LF = 18;
67 static final int CHUNK_SIZE = 19; 67 static const int CHUNK_SIZE = 19;
68 static final int CHUNK_SIZE_EXTENSION = 20; 68 static const int CHUNK_SIZE_EXTENSION = 20;
69 static final int CHUNK_SIZE_ENDING = 21; 69 static const int CHUNK_SIZE_ENDING = 21;
70 static final int CHUNKED_BODY_DONE_CR = 22; 70 static const int CHUNKED_BODY_DONE_CR = 22;
71 static final int CHUNKED_BODY_DONE_LF = 23; 71 static const int CHUNKED_BODY_DONE_LF = 23;
72 static final int BODY = 24; 72 static const int BODY = 24;
73 static final int CLOSED = 25; 73 static const int CLOSED = 25;
74 static final int UPGRADED = 26; 74 static const int UPGRADED = 26;
75 static final int FAILURE = 27; 75 static const int FAILURE = 27;
76 76
77 static final int FIRST_BODY_STATE = CHUNK_SIZE_STARTING_CR; 77 static const int FIRST_BODY_STATE = CHUNK_SIZE_STARTING_CR;
78 } 78 }
79 79
80 // HTTP version of the request or response being parsed. 80 // HTTP version of the request or response being parsed.
81 class _HttpVersion { 81 class _HttpVersion {
82 static final int UNDETERMINED = 0; 82 static const int UNDETERMINED = 0;
83 static final int HTTP10 = 1; 83 static const int HTTP10 = 1;
84 static final int HTTP11 = 2; 84 static const int HTTP11 = 2;
85 } 85 }
86 86
87 // States of the HTTP parser state machine. 87 // States of the HTTP parser state machine.
88 class _MessageType { 88 class _MessageType {
89 static final int UNDETERMINED = 0; 89 static const int UNDETERMINED = 0;
90 static final int REQUEST = 1; 90 static const int REQUEST = 1;
91 static final int RESPONSE = 0; 91 static const int RESPONSE = 0;
92 } 92 }
93 93
94 94
95 /** 95 /**
96 * HTTP parser which parses the HTTP stream as data is supplied 96 * HTTP parser which parses the HTTP stream as data is supplied
97 * through the [:writeList:] and [:connectionClosed:] methods. As the 97 * through the [:writeList:] and [:connectionClosed:] methods. As the
98 * data is parsed the following callbacks are called: 98 * data is parsed the following callbacks are called:
99 * 99 *
100 * [:requestStart:] 100 * [:requestStart:]
101 * [:responseStart:] 101 * [:responseStart:]
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 Function dataEnd; 717 Function dataEnd;
718 Function error; 718 Function error;
719 } 719 }
720 720
721 721
722 class HttpParserException implements Exception { 722 class HttpParserException implements Exception {
723 const HttpParserException([String this.message = ""]); 723 const HttpParserException([String this.message = ""]);
724 String toString() => "HttpParserException: $message"; 724 String toString() => "HttpParserException: $message";
725 final String message; 725 final String message;
726 } 726 }
OLDNEW
« no previous file with comments | « runtime/bin/http_impl.dart ('k') | runtime/bin/input_stream.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698