thin 0.5.3-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of thin might be problematic. Click here for more details.

Files changed (117) hide show
  1. data/CHANGELOG +40 -0
  2. data/COPYING +18 -0
  3. data/README +60 -0
  4. data/Rakefile +11 -0
  5. data/benchmark/simple.rb +48 -0
  6. data/bin/thin +123 -0
  7. data/doc/benchmarks.txt +86 -0
  8. data/doc/rdoc/classes/Process.html +181 -0
  9. data/doc/rdoc/classes/Rack.html +156 -0
  10. data/doc/rdoc/classes/Rack/Adapter.html +155 -0
  11. data/doc/rdoc/classes/Rack/Adapter/Rails.html +289 -0
  12. data/doc/rdoc/classes/Rack/Adapter/Rails/CGIWrapper.html +359 -0
  13. data/doc/rdoc/classes/Rack/Handler.html +155 -0
  14. data/doc/rdoc/classes/Rack/Handler/Thin.html +175 -0
  15. data/doc/rdoc/classes/Thin.html +164 -0
  16. data/doc/rdoc/classes/Thin/Cluster.html +399 -0
  17. data/doc/rdoc/classes/Thin/Connection.html +223 -0
  18. data/doc/rdoc/classes/Thin/Daemonizable.html +260 -0
  19. data/doc/rdoc/classes/Thin/Daemonizable/ClassMethods.html +197 -0
  20. data/doc/rdoc/classes/Thin/Headers.html +238 -0
  21. data/doc/rdoc/classes/Thin/InvalidRequest.html +144 -0
  22. data/doc/rdoc/classes/Thin/Logging.html +201 -0
  23. data/doc/rdoc/classes/Thin/Request.html +231 -0
  24. data/doc/rdoc/classes/Thin/Response.html +271 -0
  25. data/doc/rdoc/classes/Thin/Server.html +295 -0
  26. data/doc/rdoc/classes/Thin/StopServer.html +143 -0
  27. data/doc/rdoc/created.rid +1 -0
  28. data/doc/rdoc/files/README.html +226 -0
  29. data/doc/rdoc/files/bin/thin.html +245 -0
  30. data/doc/rdoc/files/lib/rack/adapter/rails_rb.html +146 -0
  31. data/doc/rdoc/files/lib/rack/handler/thin_rb.html +146 -0
  32. data/doc/rdoc/files/lib/thin/cluster_rb.html +146 -0
  33. data/doc/rdoc/files/lib/thin/connection_rb.html +145 -0
  34. data/doc/rdoc/files/lib/thin/daemonizing_rb.html +146 -0
  35. data/doc/rdoc/files/lib/thin/headers_rb.html +146 -0
  36. data/doc/rdoc/files/lib/thin/logging_rb.html +146 -0
  37. data/doc/rdoc/files/lib/thin/request_rb.html +145 -0
  38. data/doc/rdoc/files/lib/thin/response_rb.html +145 -0
  39. data/doc/rdoc/files/lib/thin/server_rb.html +145 -0
  40. data/doc/rdoc/files/lib/thin/statuses_rb.html +145 -0
  41. data/doc/rdoc/files/lib/thin/version_rb.html +145 -0
  42. data/doc/rdoc/files/lib/thin_rb.html +152 -0
  43. data/doc/rdoc/index.html +10 -0
  44. data/doc/rdoc/logo.gif +0 -0
  45. data/doc/rdoc/rdoc-style.css +55 -0
  46. data/example/config.ru +9 -0
  47. data/example/thin.god +72 -0
  48. data/ext/thin_parser/common.rl +54 -0
  49. data/ext/thin_parser/ext_help.h +14 -0
  50. data/ext/thin_parser/extconf.rb +6 -0
  51. data/ext/thin_parser/parser.c +1199 -0
  52. data/ext/thin_parser/parser.h +49 -0
  53. data/ext/thin_parser/parser.rl +143 -0
  54. data/ext/thin_parser/thin.c +424 -0
  55. data/lib/rack/adapter/rails.rb +155 -0
  56. data/lib/rack/handler/thin.rb +13 -0
  57. data/lib/thin.rb +36 -0
  58. data/lib/thin/cluster.rb +106 -0
  59. data/lib/thin/connection.rb +46 -0
  60. data/lib/thin/daemonizing.rb +112 -0
  61. data/lib/thin/headers.rb +37 -0
  62. data/lib/thin/logging.rb +23 -0
  63. data/lib/thin/request.rb +72 -0
  64. data/lib/thin/response.rb +48 -0
  65. data/lib/thin/server.rb +80 -0
  66. data/lib/thin/statuses.rb +43 -0
  67. data/lib/thin/version.rb +11 -0
  68. data/lib/thin_parser.so +0 -0
  69. data/spec/cluster_spec.rb +58 -0
  70. data/spec/daemonizing_spec.rb +93 -0
  71. data/spec/headers_spec.rb +35 -0
  72. data/spec/rack_rails_spec.rb +92 -0
  73. data/spec/rails_app/app/controllers/application.rb +10 -0
  74. data/spec/rails_app/app/controllers/simple_controller.rb +19 -0
  75. data/spec/rails_app/app/helpers/application_helper.rb +3 -0
  76. data/spec/rails_app/app/views/simple/index.html.erb +15 -0
  77. data/spec/rails_app/config/boot.rb +109 -0
  78. data/spec/rails_app/config/environment.rb +64 -0
  79. data/spec/rails_app/config/environments/development.rb +18 -0
  80. data/spec/rails_app/config/environments/production.rb +19 -0
  81. data/spec/rails_app/config/environments/test.rb +22 -0
  82. data/spec/rails_app/config/initializers/inflections.rb +10 -0
  83. data/spec/rails_app/config/initializers/mime_types.rb +5 -0
  84. data/spec/rails_app/config/routes.rb +35 -0
  85. data/spec/rails_app/public/404.html +30 -0
  86. data/spec/rails_app/public/422.html +30 -0
  87. data/spec/rails_app/public/500.html +30 -0
  88. data/spec/rails_app/public/dispatch.cgi +10 -0
  89. data/spec/rails_app/public/dispatch.fcgi +24 -0
  90. data/spec/rails_app/public/dispatch.rb +10 -0
  91. data/spec/rails_app/public/favicon.ico +0 -0
  92. data/spec/rails_app/public/images/rails.png +0 -0
  93. data/spec/rails_app/public/index.html +277 -0
  94. data/spec/rails_app/public/javascripts/application.js +2 -0
  95. data/spec/rails_app/public/javascripts/controls.js +963 -0
  96. data/spec/rails_app/public/javascripts/dragdrop.js +972 -0
  97. data/spec/rails_app/public/javascripts/effects.js +1120 -0
  98. data/spec/rails_app/public/javascripts/prototype.js +4225 -0
  99. data/spec/rails_app/public/robots.txt +5 -0
  100. data/spec/rails_app/script/about +3 -0
  101. data/spec/rails_app/script/console +3 -0
  102. data/spec/rails_app/script/destroy +3 -0
  103. data/spec/rails_app/script/generate +3 -0
  104. data/spec/rails_app/script/performance/benchmarker +3 -0
  105. data/spec/rails_app/script/performance/profiler +3 -0
  106. data/spec/rails_app/script/performance/request +3 -0
  107. data/spec/rails_app/script/plugin +3 -0
  108. data/spec/rails_app/script/process/inspector +3 -0
  109. data/spec/rails_app/script/process/reaper +3 -0
  110. data/spec/rails_app/script/process/spawner +3 -0
  111. data/spec/rails_app/script/runner +3 -0
  112. data/spec/rails_app/script/server +3 -0
  113. data/spec/request_spec.rb +258 -0
  114. data/spec/response_spec.rb +56 -0
  115. data/spec/server_spec.rb +75 -0
  116. data/spec/spec_helper.rb +127 -0
  117. metadata +219 -0
data/doc/rdoc/logo.gif ADDED
Binary file
@@ -0,0 +1,55 @@
1
+ body { margin:0; padding:0; font: 12px Times, "Times New Roman"; text-align: center }
2
+ img { border:0 }
3
+
4
+ a { color: #666; text-decoration: none; border-bottom: solid 1px #ccc; }
5
+ a:hover { color: #333; border-bottom: solid 1px #aaa; }
6
+
7
+ acronym { border-bottom: dotted 1px #ccc; cursor: help; }
8
+
9
+ pre { font: 10px Courier, "Courier New"; background: #111; color: #fff; padding: 3px; border: solid 1px #ccc; }
10
+ hr { background: url(/thin/images/split.gif) no-repeat; height: 30px; width: 100px; border: 0; margin: 40px auto; }
11
+
12
+ input, select, textarea { font: 9px Tahoma, Arial; }
13
+ label { font-size: 11px; }
14
+
15
+ h1, h2, h3, h4 { margin: 12px 0 8px 0; padding: 0; }
16
+ h3 { font-size: 14px; }
17
+ h4 { font-size: 13px; }
18
+
19
+ ul#menu { padding: 4px; margin:0; background: #111; list-style: none; border-bottom: solid 1px #ccc; }
20
+ ul#menu li { margin:0; display: inline; }
21
+ ul#menu li a { color: #fff; text-decoration: none; padding: 6px; border: 0; }
22
+ ul#menu li a:hover { text-decoration: underline; }
23
+
24
+ #container { width: 300px; margin: 0 auto; }
25
+
26
+ #header { padding: 30px 0 10px 0; }
27
+ #header #logo { padding-bottom: 10px; }
28
+ #header #tag_line { margin: 4px 0; font-size: 12px; letter-spacing: -1px; color: #333; }
29
+
30
+ #content { line-height: 16px; text-align: left; }
31
+ #content h1 { margin: 40px 0 10px 0; padding: 0; text-align: center; }
32
+ #content h2 { margin: 40px 0 10px 0; padding: 0; text-align: center; }
33
+ #content h3 { margin: 40px 0 10px 0; padding: 0; text-align: center; }
34
+
35
+ #content ul { list-style-image: url(/thin/images/bullet.gif); margin: 0; padding: 0 20px; }
36
+ #content li { padding: 1px 0; }
37
+
38
+ #footer { margin: 60px 0 20px 0; font-size: 10px; color: #666; }
39
+
40
+ #sidebar { position: absolute; right: 0; width: 400px; text-align: right; padding: 10px; }
41
+
42
+ ul.list { list-style: none; }
43
+ ul.list li { margin: 0; padding: 1px 0; }
44
+
45
+ #content div.graph h3 { margin: 6px 0; }
46
+ #content div.graph { text-align: center; }
47
+
48
+ #content em.filename { display: block; text-align: right; margin-bottom: -8px; }
49
+
50
+ .clear { clear: both; }
51
+
52
+ /*RDoc*/
53
+ .dyn-source { display: none; }
54
+ .path { text-align: center; font: 9px Tahoma, Arial; }
55
+ .method-type { font: 9px Tahoma, Arial; color: #fff; background: #111; border: solid 1px #ccc; padding: 1px; }
data/example/config.ru ADDED
@@ -0,0 +1,9 @@
1
+ # Run with: rackup -s thin
2
+ # Then browse to http://localhost:9292
3
+ # Check Rack::Builder doc for more details on this file format:
4
+ # http://rack.rubyforge.org/doc/classes/Rack/Builder.html
5
+
6
+ require File.dirname(__FILE__) + '/../lib/thin'
7
+ require 'rack/lobster'
8
+
9
+ run Rack::Lobster.new
data/example/thin.god ADDED
@@ -0,0 +1,72 @@
1
+ # WARNING: this config file has not been tested yet.
2
+ # If you know God better then I, feel free to tweak it and send it to me.
3
+ # Thanks!
4
+ # -- Marc
5
+
6
+ RAILS_ROOT = "/Users/marc/projects/refactormycode"
7
+
8
+ God.watch do |w|
9
+ w.name = "thin-3000"
10
+ w.group = 'thins'
11
+ w.interval = 5.seconds # default
12
+ w.start = "thin start -c #{RAILS_ROOT} -P #{RAILS_ROOT}/tmp/pids/thin.3000.pid -p 3000 -d"
13
+ w.stop = "thin stop -P #{RAILS_ROOT}/tmp/pids/thin.3000.pid"
14
+ w.restart = "thin restart -P #{RAILS_ROOT}/tmp/pids/thin.3000.pid -p 3000"
15
+ w.pid_file = File.join(RAILS_ROOT, "tmp/pids/thin.3000.pid")
16
+
17
+ # clean pid files before start if necessary
18
+ w.behavior(:clean_pid_file)
19
+
20
+ # determine the state on startup
21
+ w.transition(:init, { true => :up, false => :start }) do |on|
22
+ on.condition(:process_running) do |c|
23
+ c.running = true
24
+ end
25
+ end
26
+
27
+ # determine when process has finished starting
28
+ w.transition([:start, :restart], :up) do |on|
29
+ on.condition(:process_running) do |c|
30
+ c.running = true
31
+ end
32
+
33
+ # failsafe
34
+ on.condition(:tries) do |c|
35
+ c.times = 5
36
+ c.transition = :start
37
+ end
38
+ end
39
+
40
+ # start if process is not running
41
+ w.transition(:up, :start) do |on|
42
+ on.condition(:process_exits)
43
+ end
44
+
45
+ # restart if memory or cpu is too high
46
+ w.transition(:up, :restart) do |on|
47
+ on.condition(:memory_usage) do |c|
48
+ c.interval = 20
49
+ c.above = 50.megabytes
50
+ c.times = [3, 5]
51
+ end
52
+
53
+ on.condition(:cpu_usage) do |c|
54
+ c.interval = 10
55
+ c.above = 10.percent
56
+ c.times = [3, 5]
57
+ end
58
+ end
59
+
60
+ # lifecycle
61
+ w.lifecycle do |on|
62
+ on.condition(:flapping) do |c|
63
+ c.to_state = [:start, :restart]
64
+ c.times = 5
65
+ c.within = 5.minute
66
+ c.transition = :unmonitored
67
+ c.retry_in = 10.minutes
68
+ c.retry_times = 5
69
+ c.retry_within = 2.hours
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,54 @@
1
+ %%{
2
+
3
+ machine http_parser_common;
4
+
5
+ #### HTTP PROTOCOL GRAMMAR
6
+ # line endings
7
+ CRLF = "\r\n";
8
+
9
+ # character types
10
+ CTL = (cntrl | 127);
11
+ safe = ("$" | "-" | "_" | ".");
12
+ extra = ("!" | "*" | "'" | "(" | ")" | ",");
13
+ reserved = (";" | "/" | "?" | ":" | "@" | "&" | "=" | "+");
14
+ unsafe = (CTL | " " | "\"" | "#" | "%" | "<" | ">");
15
+ national = any -- (alpha | digit | reserved | extra | safe | unsafe);
16
+ unreserved = (alpha | digit | safe | extra | national);
17
+ escape = ("%" xdigit xdigit);
18
+ uchar = (unreserved | escape);
19
+ pchar = (uchar | ":" | "@" | "&" | "=" | "+");
20
+ tspecials = ("(" | ")" | "<" | ">" | "@" | "," | ";" | ":" | "\\" | "\"" | "/" | "[" | "]" | "?" | "=" | "{" | "}" | " " | "\t");
21
+
22
+ # elements
23
+ token = (ascii -- (CTL | tspecials));
24
+
25
+ # URI schemes and absolute paths
26
+ scheme = ( alpha | digit | "+" | "-" | "." )* ;
27
+ absolute_uri = (scheme ":" (uchar | reserved )*);
28
+
29
+ path = ( pchar+ ( "/" pchar* )* ) ;
30
+ query = ( uchar | reserved )* %query_string ;
31
+ param = ( pchar | "/" )* ;
32
+ params = ( param ( ";" param )* ) ;
33
+ rel_path = ( path? %request_path (";" params)? ) ("?" %start_query query)?;
34
+ absolute_path = ( "/"+ rel_path );
35
+
36
+ Request_URI = ( "*" | absolute_uri | absolute_path ) >mark %request_uri;
37
+ Fragment = ( uchar | reserved )* >mark %fragment;
38
+ Method = ( upper | digit | safe ){1,20} >mark %request_method;
39
+
40
+ http_number = ( digit+ "." digit+ ) ;
41
+ HTTP_Version = ( "HTTP/" http_number ) >mark %http_version ;
42
+ Request_Line = ( Method " " Request_URI ("#" Fragment){0,1} " " HTTP_Version CRLF ) ;
43
+
44
+ field_name = ( token -- ":" )+ >start_field %write_field;
45
+
46
+ field_value = any* >start_value %write_value;
47
+
48
+ message_header = field_name ":" " "* field_value :> CRLF;
49
+
50
+ Request = Request_Line ( message_header )* ( CRLF @done );
51
+
52
+ main := Request;
53
+
54
+ }%%
@@ -0,0 +1,14 @@
1
+ #ifndef ext_help_h
2
+ #define ext_help_h
3
+
4
+ #define RAISE_NOT_NULL(T) if(T == NULL) rb_raise(rb_eArgError, "NULL found for " # T " when shouldn't be.");
5
+ #define DATA_GET(from,type,name) Data_Get_Struct(from,type,name); RAISE_NOT_NULL(name);
6
+ #define REQUIRE_TYPE(V, T) if(TYPE(V) != T) rb_raise(rb_eTypeError, "Wrong argument type for " # V " required " # T);
7
+
8
+ #ifdef DEBUG
9
+ #define TRACE() fprintf(stderr, "> %s:%d:%s\n", __FILE__, __LINE__, __FUNCTION__)
10
+ #else
11
+ #define TRACE()
12
+ #endif
13
+
14
+ #endif
@@ -0,0 +1,6 @@
1
+ require 'mkmf'
2
+
3
+ dir_config("thin_parser")
4
+ have_library("c", "main")
5
+
6
+ create_makefile("thin_parser")
@@ -0,0 +1,1199 @@
1
+ #line 1 "parser.rl"
2
+ /**
3
+ * Copyright (c) 2005 Zed A. Shaw
4
+ * You can redistribute it and/or modify it under the same terms as Ruby.
5
+ */
6
+ #include "parser.h"
7
+ #include <stdio.h>
8
+ #include <assert.h>
9
+ #include <stdlib.h>
10
+ #include <ctype.h>
11
+ #include <string.h>
12
+
13
+ #define LEN(AT, FPC) (FPC - buffer - parser->AT)
14
+ #define MARK(M,FPC) (parser->M = (FPC) - buffer)
15
+ #define PTR_TO(F) (buffer + parser->F)
16
+
17
+ /** Machine **/
18
+
19
+ #line 65 "parser.rl"
20
+
21
+
22
+ /** Data **/
23
+
24
+ #line 25 "parser.c"
25
+ static const int http_parser_start = 1;
26
+ static const int http_parser_first_final = 57;
27
+ static const int http_parser_error = 0;
28
+
29
+ static const int http_parser_en_main = 1;
30
+
31
+ #line 69 "parser.rl"
32
+
33
+ int http_parser_init(http_parser *parser) {
34
+ int cs = 0;
35
+
36
+ #line 37 "parser.c"
37
+ {
38
+ cs = http_parser_start;
39
+ }
40
+ #line 73 "parser.rl"
41
+ parser->cs = cs;
42
+ parser->body_start = 0;
43
+ parser->content_len = 0;
44
+ parser->mark = 0;
45
+ parser->nread = 0;
46
+ parser->field_len = 0;
47
+ parser->field_start = 0;
48
+
49
+ return(1);
50
+ }
51
+
52
+
53
+ /** exec **/
54
+ size_t http_parser_execute(http_parser *parser, const char *buffer, size_t len, size_t off) {
55
+ const char *p, *pe;
56
+ int cs = parser->cs;
57
+
58
+ assert(off <= len && "offset past end of buffer");
59
+
60
+ p = buffer+off;
61
+ pe = buffer+len;
62
+
63
+ assert(*pe == '\0' && "pointer does not end on NUL");
64
+ assert(pe - p == len - off && "pointers aren't same distance");
65
+
66
+
67
+
68
+ #line 69 "parser.c"
69
+ {
70
+ if ( p == pe )
71
+ goto _out;
72
+ switch ( cs )
73
+ {
74
+ case 1:
75
+ switch( (*p) ) {
76
+ case 36: goto tr0;
77
+ case 95: goto tr0;
78
+ }
79
+ if ( (*p) < 48 ) {
80
+ if ( 45 <= (*p) && (*p) <= 46 )
81
+ goto tr0;
82
+ } else if ( (*p) > 57 ) {
83
+ if ( 65 <= (*p) && (*p) <= 90 )
84
+ goto tr0;
85
+ } else
86
+ goto tr0;
87
+ goto st0;
88
+ st0:
89
+ goto _out0;
90
+ tr0:
91
+ #line 22 "parser.rl"
92
+ {MARK(mark, p); }
93
+ goto st2;
94
+ st2:
95
+ if ( ++p == pe )
96
+ goto _out2;
97
+ case 2:
98
+ #line 99 "parser.c"
99
+ switch( (*p) ) {
100
+ case 32: goto tr2;
101
+ case 36: goto st38;
102
+ case 95: goto st38;
103
+ }
104
+ if ( (*p) < 48 ) {
105
+ if ( 45 <= (*p) && (*p) <= 46 )
106
+ goto st38;
107
+ } else if ( (*p) > 57 ) {
108
+ if ( 65 <= (*p) && (*p) <= 90 )
109
+ goto st38;
110
+ } else
111
+ goto st38;
112
+ goto st0;
113
+ tr2:
114
+ #line 34 "parser.rl"
115
+ {
116
+ parser->request_method(parser->data, PTR_TO(mark), LEN(mark, p));
117
+ }
118
+ goto st3;
119
+ st3:
120
+ if ( ++p == pe )
121
+ goto _out3;
122
+ case 3:
123
+ #line 124 "parser.c"
124
+ switch( (*p) ) {
125
+ case 42: goto tr4;
126
+ case 43: goto tr5;
127
+ case 47: goto tr6;
128
+ case 58: goto tr7;
129
+ }
130
+ if ( (*p) < 65 ) {
131
+ if ( 45 <= (*p) && (*p) <= 57 )
132
+ goto tr5;
133
+ } else if ( (*p) > 90 ) {
134
+ if ( 97 <= (*p) && (*p) <= 122 )
135
+ goto tr5;
136
+ } else
137
+ goto tr5;
138
+ goto st0;
139
+ tr4:
140
+ #line 22 "parser.rl"
141
+ {MARK(mark, p); }
142
+ goto st4;
143
+ st4:
144
+ if ( ++p == pe )
145
+ goto _out4;
146
+ case 4:
147
+ #line 148 "parser.c"
148
+ switch( (*p) ) {
149
+ case 32: goto tr8;
150
+ case 35: goto tr9;
151
+ }
152
+ goto st0;
153
+ tr8:
154
+ #line 37 "parser.rl"
155
+ {
156
+ parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
157
+ }
158
+ goto st5;
159
+ tr30:
160
+ #line 40 "parser.rl"
161
+ {
162
+ parser->fragment(parser->data, PTR_TO(mark), LEN(mark, p));
163
+ }
164
+ goto st5;
165
+ tr40:
166
+ #line 53 "parser.rl"
167
+ {
168
+ parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
169
+ }
170
+ #line 37 "parser.rl"
171
+ {
172
+ parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
173
+ }
174
+ goto st5;
175
+ tr51:
176
+ #line 44 "parser.rl"
177
+ {MARK(query_start, p); }
178
+ #line 45 "parser.rl"
179
+ {
180
+ parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
181
+ }
182
+ #line 37 "parser.rl"
183
+ {
184
+ parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
185
+ }
186
+ goto st5;
187
+ tr55:
188
+ #line 45 "parser.rl"
189
+ {
190
+ parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
191
+ }
192
+ #line 37 "parser.rl"
193
+ {
194
+ parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
195
+ }
196
+ goto st5;
197
+ st5:
198
+ if ( ++p == pe )
199
+ goto _out5;
200
+ case 5:
201
+ #line 202 "parser.c"
202
+ if ( (*p) == 72 )
203
+ goto tr10;
204
+ goto st0;
205
+ tr10:
206
+ #line 22 "parser.rl"
207
+ {MARK(mark, p); }
208
+ goto st6;
209
+ st6:
210
+ if ( ++p == pe )
211
+ goto _out6;
212
+ case 6:
213
+ #line 214 "parser.c"
214
+ if ( (*p) == 84 )
215
+ goto st7;
216
+ goto st0;
217
+ st7:
218
+ if ( ++p == pe )
219
+ goto _out7;
220
+ case 7:
221
+ if ( (*p) == 84 )
222
+ goto st8;
223
+ goto st0;
224
+ st8:
225
+ if ( ++p == pe )
226
+ goto _out8;
227
+ case 8:
228
+ if ( (*p) == 80 )
229
+ goto st9;
230
+ goto st0;
231
+ st9:
232
+ if ( ++p == pe )
233
+ goto _out9;
234
+ case 9:
235
+ if ( (*p) == 47 )
236
+ goto st10;
237
+ goto st0;
238
+ st10:
239
+ if ( ++p == pe )
240
+ goto _out10;
241
+ case 10:
242
+ if ( 48 <= (*p) && (*p) <= 57 )
243
+ goto st11;
244
+ goto st0;
245
+ st11:
246
+ if ( ++p == pe )
247
+ goto _out11;
248
+ case 11:
249
+ if ( (*p) == 46 )
250
+ goto st12;
251
+ if ( 48 <= (*p) && (*p) <= 57 )
252
+ goto st11;
253
+ goto st0;
254
+ st12:
255
+ if ( ++p == pe )
256
+ goto _out12;
257
+ case 12:
258
+ if ( 48 <= (*p) && (*p) <= 57 )
259
+ goto st13;
260
+ goto st0;
261
+ st13:
262
+ if ( ++p == pe )
263
+ goto _out13;
264
+ case 13:
265
+ if ( (*p) == 13 )
266
+ goto tr18;
267
+ if ( 48 <= (*p) && (*p) <= 57 )
268
+ goto st13;
269
+ goto st0;
270
+ tr18:
271
+ #line 49 "parser.rl"
272
+ {
273
+ parser->http_version(parser->data, PTR_TO(mark), LEN(mark, p));
274
+ }
275
+ goto st14;
276
+ tr26:
277
+ #line 31 "parser.rl"
278
+ {
279
+ parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
280
+ }
281
+ goto st14;
282
+ st14:
283
+ if ( ++p == pe )
284
+ goto _out14;
285
+ case 14:
286
+ #line 287 "parser.c"
287
+ if ( (*p) == 10 )
288
+ goto st15;
289
+ goto st0;
290
+ st15:
291
+ if ( ++p == pe )
292
+ goto _out15;
293
+ case 15:
294
+ switch( (*p) ) {
295
+ case 13: goto st16;
296
+ case 33: goto tr21;
297
+ case 124: goto tr21;
298
+ case 126: goto tr21;
299
+ }
300
+ if ( (*p) < 45 ) {
301
+ if ( (*p) > 39 ) {
302
+ if ( 42 <= (*p) && (*p) <= 43 )
303
+ goto tr21;
304
+ } else if ( (*p) >= 35 )
305
+ goto tr21;
306
+ } else if ( (*p) > 46 ) {
307
+ if ( (*p) < 65 ) {
308
+ if ( 48 <= (*p) && (*p) <= 57 )
309
+ goto tr21;
310
+ } else if ( (*p) > 90 ) {
311
+ if ( 94 <= (*p) && (*p) <= 122 )
312
+ goto tr21;
313
+ } else
314
+ goto tr21;
315
+ } else
316
+ goto tr21;
317
+ goto st0;
318
+ st16:
319
+ if ( ++p == pe )
320
+ goto _out16;
321
+ case 16:
322
+ if ( (*p) == 10 )
323
+ goto tr22;
324
+ goto st0;
325
+ tr22:
326
+ #line 57 "parser.rl"
327
+ {
328
+ parser->body_start = p - buffer + 1;
329
+ parser->header_done(parser->data, p + 1, pe - p - 1);
330
+ goto _out57;
331
+ }
332
+ goto st57;
333
+ st57:
334
+ if ( ++p == pe )
335
+ goto _out57;
336
+ case 57:
337
+ #line 338 "parser.c"
338
+ goto st0;
339
+ tr21:
340
+ #line 25 "parser.rl"
341
+ { MARK(field_start, p); }
342
+ goto st17;
343
+ st17:
344
+ if ( ++p == pe )
345
+ goto _out17;
346
+ case 17:
347
+ #line 348 "parser.c"
348
+ switch( (*p) ) {
349
+ case 33: goto st17;
350
+ case 58: goto tr24;
351
+ case 124: goto st17;
352
+ case 126: goto st17;
353
+ }
354
+ if ( (*p) < 45 ) {
355
+ if ( (*p) > 39 ) {
356
+ if ( 42 <= (*p) && (*p) <= 43 )
357
+ goto st17;
358
+ } else if ( (*p) >= 35 )
359
+ goto st17;
360
+ } else if ( (*p) > 46 ) {
361
+ if ( (*p) < 65 ) {
362
+ if ( 48 <= (*p) && (*p) <= 57 )
363
+ goto st17;
364
+ } else if ( (*p) > 90 ) {
365
+ if ( 94 <= (*p) && (*p) <= 122 )
366
+ goto st17;
367
+ } else
368
+ goto st17;
369
+ } else
370
+ goto st17;
371
+ goto st0;
372
+ tr24:
373
+ #line 26 "parser.rl"
374
+ {
375
+ parser->field_len = LEN(field_start, p);
376
+ }
377
+ goto st18;
378
+ tr27:
379
+ #line 30 "parser.rl"
380
+ { MARK(mark, p); }
381
+ goto st18;
382
+ st18:
383
+ if ( ++p == pe )
384
+ goto _out18;
385
+ case 18:
386
+ #line 387 "parser.c"
387
+ switch( (*p) ) {
388
+ case 13: goto tr26;
389
+ case 32: goto tr27;
390
+ }
391
+ goto tr25;
392
+ tr25:
393
+ #line 30 "parser.rl"
394
+ { MARK(mark, p); }
395
+ goto st19;
396
+ st19:
397
+ if ( ++p == pe )
398
+ goto _out19;
399
+ case 19:
400
+ #line 401 "parser.c"
401
+ if ( (*p) == 13 )
402
+ goto tr26;
403
+ goto st19;
404
+ tr9:
405
+ #line 37 "parser.rl"
406
+ {
407
+ parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
408
+ }
409
+ goto st20;
410
+ tr41:
411
+ #line 53 "parser.rl"
412
+ {
413
+ parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
414
+ }
415
+ #line 37 "parser.rl"
416
+ {
417
+ parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
418
+ }
419
+ goto st20;
420
+ tr52:
421
+ #line 44 "parser.rl"
422
+ {MARK(query_start, p); }
423
+ #line 45 "parser.rl"
424
+ {
425
+ parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
426
+ }
427
+ #line 37 "parser.rl"
428
+ {
429
+ parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
430
+ }
431
+ goto st20;
432
+ tr56:
433
+ #line 45 "parser.rl"
434
+ {
435
+ parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
436
+ }
437
+ #line 37 "parser.rl"
438
+ {
439
+ parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
440
+ }
441
+ goto st20;
442
+ st20:
443
+ if ( ++p == pe )
444
+ goto _out20;
445
+ case 20:
446
+ #line 447 "parser.c"
447
+ switch( (*p) ) {
448
+ case 32: goto tr30;
449
+ case 37: goto tr31;
450
+ case 60: goto st0;
451
+ case 62: goto st0;
452
+ case 127: goto st0;
453
+ }
454
+ if ( (*p) > 31 ) {
455
+ if ( 34 <= (*p) && (*p) <= 35 )
456
+ goto st0;
457
+ } else if ( (*p) >= 0 )
458
+ goto st0;
459
+ goto tr29;
460
+ tr29:
461
+ #line 22 "parser.rl"
462
+ {MARK(mark, p); }
463
+ goto st21;
464
+ st21:
465
+ if ( ++p == pe )
466
+ goto _out21;
467
+ case 21:
468
+ #line 469 "parser.c"
469
+ switch( (*p) ) {
470
+ case 32: goto tr30;
471
+ case 37: goto st22;
472
+ case 60: goto st0;
473
+ case 62: goto st0;
474
+ case 127: goto st0;
475
+ }
476
+ if ( (*p) > 31 ) {
477
+ if ( 34 <= (*p) && (*p) <= 35 )
478
+ goto st0;
479
+ } else if ( (*p) >= 0 )
480
+ goto st0;
481
+ goto st21;
482
+ tr31:
483
+ #line 22 "parser.rl"
484
+ {MARK(mark, p); }
485
+ goto st22;
486
+ st22:
487
+ if ( ++p == pe )
488
+ goto _out22;
489
+ case 22:
490
+ #line 491 "parser.c"
491
+ if ( (*p) < 65 ) {
492
+ if ( 48 <= (*p) && (*p) <= 57 )
493
+ goto st23;
494
+ } else if ( (*p) > 70 ) {
495
+ if ( 97 <= (*p) && (*p) <= 102 )
496
+ goto st23;
497
+ } else
498
+ goto st23;
499
+ goto st0;
500
+ st23:
501
+ if ( ++p == pe )
502
+ goto _out23;
503
+ case 23:
504
+ if ( (*p) < 65 ) {
505
+ if ( 48 <= (*p) && (*p) <= 57 )
506
+ goto st21;
507
+ } else if ( (*p) > 70 ) {
508
+ if ( 97 <= (*p) && (*p) <= 102 )
509
+ goto st21;
510
+ } else
511
+ goto st21;
512
+ goto st0;
513
+ tr5:
514
+ #line 22 "parser.rl"
515
+ {MARK(mark, p); }
516
+ goto st24;
517
+ st24:
518
+ if ( ++p == pe )
519
+ goto _out24;
520
+ case 24:
521
+ #line 522 "parser.c"
522
+ switch( (*p) ) {
523
+ case 43: goto st24;
524
+ case 58: goto st25;
525
+ }
526
+ if ( (*p) < 48 ) {
527
+ if ( 45 <= (*p) && (*p) <= 46 )
528
+ goto st24;
529
+ } else if ( (*p) > 57 ) {
530
+ if ( (*p) > 90 ) {
531
+ if ( 97 <= (*p) && (*p) <= 122 )
532
+ goto st24;
533
+ } else if ( (*p) >= 65 )
534
+ goto st24;
535
+ } else
536
+ goto st24;
537
+ goto st0;
538
+ tr7:
539
+ #line 22 "parser.rl"
540
+ {MARK(mark, p); }
541
+ goto st25;
542
+ st25:
543
+ if ( ++p == pe )
544
+ goto _out25;
545
+ case 25:
546
+ #line 547 "parser.c"
547
+ switch( (*p) ) {
548
+ case 32: goto tr8;
549
+ case 34: goto st0;
550
+ case 35: goto tr9;
551
+ case 37: goto st26;
552
+ case 60: goto st0;
553
+ case 62: goto st0;
554
+ case 127: goto st0;
555
+ }
556
+ if ( 0 <= (*p) && (*p) <= 31 )
557
+ goto st0;
558
+ goto st25;
559
+ st26:
560
+ if ( ++p == pe )
561
+ goto _out26;
562
+ case 26:
563
+ if ( (*p) < 65 ) {
564
+ if ( 48 <= (*p) && (*p) <= 57 )
565
+ goto st27;
566
+ } else if ( (*p) > 70 ) {
567
+ if ( 97 <= (*p) && (*p) <= 102 )
568
+ goto st27;
569
+ } else
570
+ goto st27;
571
+ goto st0;
572
+ st27:
573
+ if ( ++p == pe )
574
+ goto _out27;
575
+ case 27:
576
+ if ( (*p) < 65 ) {
577
+ if ( 48 <= (*p) && (*p) <= 57 )
578
+ goto st25;
579
+ } else if ( (*p) > 70 ) {
580
+ if ( 97 <= (*p) && (*p) <= 102 )
581
+ goto st25;
582
+ } else
583
+ goto st25;
584
+ goto st0;
585
+ tr6:
586
+ #line 22 "parser.rl"
587
+ {MARK(mark, p); }
588
+ goto st28;
589
+ st28:
590
+ if ( ++p == pe )
591
+ goto _out28;
592
+ case 28:
593
+ #line 594 "parser.c"
594
+ switch( (*p) ) {
595
+ case 32: goto tr40;
596
+ case 34: goto st0;
597
+ case 35: goto tr41;
598
+ case 37: goto st29;
599
+ case 59: goto tr43;
600
+ case 60: goto st0;
601
+ case 62: goto st0;
602
+ case 63: goto tr44;
603
+ case 127: goto st0;
604
+ }
605
+ if ( 0 <= (*p) && (*p) <= 31 )
606
+ goto st0;
607
+ goto st28;
608
+ st29:
609
+ if ( ++p == pe )
610
+ goto _out29;
611
+ case 29:
612
+ if ( (*p) < 65 ) {
613
+ if ( 48 <= (*p) && (*p) <= 57 )
614
+ goto st30;
615
+ } else if ( (*p) > 70 ) {
616
+ if ( 97 <= (*p) && (*p) <= 102 )
617
+ goto st30;
618
+ } else
619
+ goto st30;
620
+ goto st0;
621
+ st30:
622
+ if ( ++p == pe )
623
+ goto _out30;
624
+ case 30:
625
+ if ( (*p) < 65 ) {
626
+ if ( 48 <= (*p) && (*p) <= 57 )
627
+ goto st28;
628
+ } else if ( (*p) > 70 ) {
629
+ if ( 97 <= (*p) && (*p) <= 102 )
630
+ goto st28;
631
+ } else
632
+ goto st28;
633
+ goto st0;
634
+ tr43:
635
+ #line 53 "parser.rl"
636
+ {
637
+ parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
638
+ }
639
+ goto st31;
640
+ st31:
641
+ if ( ++p == pe )
642
+ goto _out31;
643
+ case 31:
644
+ #line 645 "parser.c"
645
+ switch( (*p) ) {
646
+ case 32: goto tr8;
647
+ case 34: goto st0;
648
+ case 35: goto tr9;
649
+ case 37: goto st32;
650
+ case 60: goto st0;
651
+ case 62: goto st0;
652
+ case 63: goto st34;
653
+ case 127: goto st0;
654
+ }
655
+ if ( 0 <= (*p) && (*p) <= 31 )
656
+ goto st0;
657
+ goto st31;
658
+ st32:
659
+ if ( ++p == pe )
660
+ goto _out32;
661
+ case 32:
662
+ if ( (*p) < 65 ) {
663
+ if ( 48 <= (*p) && (*p) <= 57 )
664
+ goto st33;
665
+ } else if ( (*p) > 70 ) {
666
+ if ( 97 <= (*p) && (*p) <= 102 )
667
+ goto st33;
668
+ } else
669
+ goto st33;
670
+ goto st0;
671
+ st33:
672
+ if ( ++p == pe )
673
+ goto _out33;
674
+ case 33:
675
+ if ( (*p) < 65 ) {
676
+ if ( 48 <= (*p) && (*p) <= 57 )
677
+ goto st31;
678
+ } else if ( (*p) > 70 ) {
679
+ if ( 97 <= (*p) && (*p) <= 102 )
680
+ goto st31;
681
+ } else
682
+ goto st31;
683
+ goto st0;
684
+ tr44:
685
+ #line 53 "parser.rl"
686
+ {
687
+ parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
688
+ }
689
+ goto st34;
690
+ st34:
691
+ if ( ++p == pe )
692
+ goto _out34;
693
+ case 34:
694
+ #line 695 "parser.c"
695
+ switch( (*p) ) {
696
+ case 32: goto tr51;
697
+ case 34: goto st0;
698
+ case 35: goto tr52;
699
+ case 37: goto tr53;
700
+ case 60: goto st0;
701
+ case 62: goto st0;
702
+ case 127: goto st0;
703
+ }
704
+ if ( 0 <= (*p) && (*p) <= 31 )
705
+ goto st0;
706
+ goto tr50;
707
+ tr50:
708
+ #line 44 "parser.rl"
709
+ {MARK(query_start, p); }
710
+ goto st35;
711
+ st35:
712
+ if ( ++p == pe )
713
+ goto _out35;
714
+ case 35:
715
+ #line 716 "parser.c"
716
+ switch( (*p) ) {
717
+ case 32: goto tr55;
718
+ case 34: goto st0;
719
+ case 35: goto tr56;
720
+ case 37: goto st36;
721
+ case 60: goto st0;
722
+ case 62: goto st0;
723
+ case 127: goto st0;
724
+ }
725
+ if ( 0 <= (*p) && (*p) <= 31 )
726
+ goto st0;
727
+ goto st35;
728
+ tr53:
729
+ #line 44 "parser.rl"
730
+ {MARK(query_start, p); }
731
+ goto st36;
732
+ st36:
733
+ if ( ++p == pe )
734
+ goto _out36;
735
+ case 36:
736
+ #line 737 "parser.c"
737
+ if ( (*p) < 65 ) {
738
+ if ( 48 <= (*p) && (*p) <= 57 )
739
+ goto st37;
740
+ } else if ( (*p) > 70 ) {
741
+ if ( 97 <= (*p) && (*p) <= 102 )
742
+ goto st37;
743
+ } else
744
+ goto st37;
745
+ goto st0;
746
+ st37:
747
+ if ( ++p == pe )
748
+ goto _out37;
749
+ case 37:
750
+ if ( (*p) < 65 ) {
751
+ if ( 48 <= (*p) && (*p) <= 57 )
752
+ goto st35;
753
+ } else if ( (*p) > 70 ) {
754
+ if ( 97 <= (*p) && (*p) <= 102 )
755
+ goto st35;
756
+ } else
757
+ goto st35;
758
+ goto st0;
759
+ st38:
760
+ if ( ++p == pe )
761
+ goto _out38;
762
+ case 38:
763
+ switch( (*p) ) {
764
+ case 32: goto tr2;
765
+ case 36: goto st39;
766
+ case 95: goto st39;
767
+ }
768
+ if ( (*p) < 48 ) {
769
+ if ( 45 <= (*p) && (*p) <= 46 )
770
+ goto st39;
771
+ } else if ( (*p) > 57 ) {
772
+ if ( 65 <= (*p) && (*p) <= 90 )
773
+ goto st39;
774
+ } else
775
+ goto st39;
776
+ goto st0;
777
+ st39:
778
+ if ( ++p == pe )
779
+ goto _out39;
780
+ case 39:
781
+ switch( (*p) ) {
782
+ case 32: goto tr2;
783
+ case 36: goto st40;
784
+ case 95: goto st40;
785
+ }
786
+ if ( (*p) < 48 ) {
787
+ if ( 45 <= (*p) && (*p) <= 46 )
788
+ goto st40;
789
+ } else if ( (*p) > 57 ) {
790
+ if ( 65 <= (*p) && (*p) <= 90 )
791
+ goto st40;
792
+ } else
793
+ goto st40;
794
+ goto st0;
795
+ st40:
796
+ if ( ++p == pe )
797
+ goto _out40;
798
+ case 40:
799
+ switch( (*p) ) {
800
+ case 32: goto tr2;
801
+ case 36: goto st41;
802
+ case 95: goto st41;
803
+ }
804
+ if ( (*p) < 48 ) {
805
+ if ( 45 <= (*p) && (*p) <= 46 )
806
+ goto st41;
807
+ } else if ( (*p) > 57 ) {
808
+ if ( 65 <= (*p) && (*p) <= 90 )
809
+ goto st41;
810
+ } else
811
+ goto st41;
812
+ goto st0;
813
+ st41:
814
+ if ( ++p == pe )
815
+ goto _out41;
816
+ case 41:
817
+ switch( (*p) ) {
818
+ case 32: goto tr2;
819
+ case 36: goto st42;
820
+ case 95: goto st42;
821
+ }
822
+ if ( (*p) < 48 ) {
823
+ if ( 45 <= (*p) && (*p) <= 46 )
824
+ goto st42;
825
+ } else if ( (*p) > 57 ) {
826
+ if ( 65 <= (*p) && (*p) <= 90 )
827
+ goto st42;
828
+ } else
829
+ goto st42;
830
+ goto st0;
831
+ st42:
832
+ if ( ++p == pe )
833
+ goto _out42;
834
+ case 42:
835
+ switch( (*p) ) {
836
+ case 32: goto tr2;
837
+ case 36: goto st43;
838
+ case 95: goto st43;
839
+ }
840
+ if ( (*p) < 48 ) {
841
+ if ( 45 <= (*p) && (*p) <= 46 )
842
+ goto st43;
843
+ } else if ( (*p) > 57 ) {
844
+ if ( 65 <= (*p) && (*p) <= 90 )
845
+ goto st43;
846
+ } else
847
+ goto st43;
848
+ goto st0;
849
+ st43:
850
+ if ( ++p == pe )
851
+ goto _out43;
852
+ case 43:
853
+ switch( (*p) ) {
854
+ case 32: goto tr2;
855
+ case 36: goto st44;
856
+ case 95: goto st44;
857
+ }
858
+ if ( (*p) < 48 ) {
859
+ if ( 45 <= (*p) && (*p) <= 46 )
860
+ goto st44;
861
+ } else if ( (*p) > 57 ) {
862
+ if ( 65 <= (*p) && (*p) <= 90 )
863
+ goto st44;
864
+ } else
865
+ goto st44;
866
+ goto st0;
867
+ st44:
868
+ if ( ++p == pe )
869
+ goto _out44;
870
+ case 44:
871
+ switch( (*p) ) {
872
+ case 32: goto tr2;
873
+ case 36: goto st45;
874
+ case 95: goto st45;
875
+ }
876
+ if ( (*p) < 48 ) {
877
+ if ( 45 <= (*p) && (*p) <= 46 )
878
+ goto st45;
879
+ } else if ( (*p) > 57 ) {
880
+ if ( 65 <= (*p) && (*p) <= 90 )
881
+ goto st45;
882
+ } else
883
+ goto st45;
884
+ goto st0;
885
+ st45:
886
+ if ( ++p == pe )
887
+ goto _out45;
888
+ case 45:
889
+ switch( (*p) ) {
890
+ case 32: goto tr2;
891
+ case 36: goto st46;
892
+ case 95: goto st46;
893
+ }
894
+ if ( (*p) < 48 ) {
895
+ if ( 45 <= (*p) && (*p) <= 46 )
896
+ goto st46;
897
+ } else if ( (*p) > 57 ) {
898
+ if ( 65 <= (*p) && (*p) <= 90 )
899
+ goto st46;
900
+ } else
901
+ goto st46;
902
+ goto st0;
903
+ st46:
904
+ if ( ++p == pe )
905
+ goto _out46;
906
+ case 46:
907
+ switch( (*p) ) {
908
+ case 32: goto tr2;
909
+ case 36: goto st47;
910
+ case 95: goto st47;
911
+ }
912
+ if ( (*p) < 48 ) {
913
+ if ( 45 <= (*p) && (*p) <= 46 )
914
+ goto st47;
915
+ } else if ( (*p) > 57 ) {
916
+ if ( 65 <= (*p) && (*p) <= 90 )
917
+ goto st47;
918
+ } else
919
+ goto st47;
920
+ goto st0;
921
+ st47:
922
+ if ( ++p == pe )
923
+ goto _out47;
924
+ case 47:
925
+ switch( (*p) ) {
926
+ case 32: goto tr2;
927
+ case 36: goto st48;
928
+ case 95: goto st48;
929
+ }
930
+ if ( (*p) < 48 ) {
931
+ if ( 45 <= (*p) && (*p) <= 46 )
932
+ goto st48;
933
+ } else if ( (*p) > 57 ) {
934
+ if ( 65 <= (*p) && (*p) <= 90 )
935
+ goto st48;
936
+ } else
937
+ goto st48;
938
+ goto st0;
939
+ st48:
940
+ if ( ++p == pe )
941
+ goto _out48;
942
+ case 48:
943
+ switch( (*p) ) {
944
+ case 32: goto tr2;
945
+ case 36: goto st49;
946
+ case 95: goto st49;
947
+ }
948
+ if ( (*p) < 48 ) {
949
+ if ( 45 <= (*p) && (*p) <= 46 )
950
+ goto st49;
951
+ } else if ( (*p) > 57 ) {
952
+ if ( 65 <= (*p) && (*p) <= 90 )
953
+ goto st49;
954
+ } else
955
+ goto st49;
956
+ goto st0;
957
+ st49:
958
+ if ( ++p == pe )
959
+ goto _out49;
960
+ case 49:
961
+ switch( (*p) ) {
962
+ case 32: goto tr2;
963
+ case 36: goto st50;
964
+ case 95: goto st50;
965
+ }
966
+ if ( (*p) < 48 ) {
967
+ if ( 45 <= (*p) && (*p) <= 46 )
968
+ goto st50;
969
+ } else if ( (*p) > 57 ) {
970
+ if ( 65 <= (*p) && (*p) <= 90 )
971
+ goto st50;
972
+ } else
973
+ goto st50;
974
+ goto st0;
975
+ st50:
976
+ if ( ++p == pe )
977
+ goto _out50;
978
+ case 50:
979
+ switch( (*p) ) {
980
+ case 32: goto tr2;
981
+ case 36: goto st51;
982
+ case 95: goto st51;
983
+ }
984
+ if ( (*p) < 48 ) {
985
+ if ( 45 <= (*p) && (*p) <= 46 )
986
+ goto st51;
987
+ } else if ( (*p) > 57 ) {
988
+ if ( 65 <= (*p) && (*p) <= 90 )
989
+ goto st51;
990
+ } else
991
+ goto st51;
992
+ goto st0;
993
+ st51:
994
+ if ( ++p == pe )
995
+ goto _out51;
996
+ case 51:
997
+ switch( (*p) ) {
998
+ case 32: goto tr2;
999
+ case 36: goto st52;
1000
+ case 95: goto st52;
1001
+ }
1002
+ if ( (*p) < 48 ) {
1003
+ if ( 45 <= (*p) && (*p) <= 46 )
1004
+ goto st52;
1005
+ } else if ( (*p) > 57 ) {
1006
+ if ( 65 <= (*p) && (*p) <= 90 )
1007
+ goto st52;
1008
+ } else
1009
+ goto st52;
1010
+ goto st0;
1011
+ st52:
1012
+ if ( ++p == pe )
1013
+ goto _out52;
1014
+ case 52:
1015
+ switch( (*p) ) {
1016
+ case 32: goto tr2;
1017
+ case 36: goto st53;
1018
+ case 95: goto st53;
1019
+ }
1020
+ if ( (*p) < 48 ) {
1021
+ if ( 45 <= (*p) && (*p) <= 46 )
1022
+ goto st53;
1023
+ } else if ( (*p) > 57 ) {
1024
+ if ( 65 <= (*p) && (*p) <= 90 )
1025
+ goto st53;
1026
+ } else
1027
+ goto st53;
1028
+ goto st0;
1029
+ st53:
1030
+ if ( ++p == pe )
1031
+ goto _out53;
1032
+ case 53:
1033
+ switch( (*p) ) {
1034
+ case 32: goto tr2;
1035
+ case 36: goto st54;
1036
+ case 95: goto st54;
1037
+ }
1038
+ if ( (*p) < 48 ) {
1039
+ if ( 45 <= (*p) && (*p) <= 46 )
1040
+ goto st54;
1041
+ } else if ( (*p) > 57 ) {
1042
+ if ( 65 <= (*p) && (*p) <= 90 )
1043
+ goto st54;
1044
+ } else
1045
+ goto st54;
1046
+ goto st0;
1047
+ st54:
1048
+ if ( ++p == pe )
1049
+ goto _out54;
1050
+ case 54:
1051
+ switch( (*p) ) {
1052
+ case 32: goto tr2;
1053
+ case 36: goto st55;
1054
+ case 95: goto st55;
1055
+ }
1056
+ if ( (*p) < 48 ) {
1057
+ if ( 45 <= (*p) && (*p) <= 46 )
1058
+ goto st55;
1059
+ } else if ( (*p) > 57 ) {
1060
+ if ( 65 <= (*p) && (*p) <= 90 )
1061
+ goto st55;
1062
+ } else
1063
+ goto st55;
1064
+ goto st0;
1065
+ st55:
1066
+ if ( ++p == pe )
1067
+ goto _out55;
1068
+ case 55:
1069
+ switch( (*p) ) {
1070
+ case 32: goto tr2;
1071
+ case 36: goto st56;
1072
+ case 95: goto st56;
1073
+ }
1074
+ if ( (*p) < 48 ) {
1075
+ if ( 45 <= (*p) && (*p) <= 46 )
1076
+ goto st56;
1077
+ } else if ( (*p) > 57 ) {
1078
+ if ( 65 <= (*p) && (*p) <= 90 )
1079
+ goto st56;
1080
+ } else
1081
+ goto st56;
1082
+ goto st0;
1083
+ st56:
1084
+ if ( ++p == pe )
1085
+ goto _out56;
1086
+ case 56:
1087
+ if ( (*p) == 32 )
1088
+ goto tr2;
1089
+ goto st0;
1090
+ }
1091
+ _out0: cs = 0; goto _out;
1092
+ _out2: cs = 2; goto _out;
1093
+ _out3: cs = 3; goto _out;
1094
+ _out4: cs = 4; goto _out;
1095
+ _out5: cs = 5; goto _out;
1096
+ _out6: cs = 6; goto _out;
1097
+ _out7: cs = 7; goto _out;
1098
+ _out8: cs = 8; goto _out;
1099
+ _out9: cs = 9; goto _out;
1100
+ _out10: cs = 10; goto _out;
1101
+ _out11: cs = 11; goto _out;
1102
+ _out12: cs = 12; goto _out;
1103
+ _out13: cs = 13; goto _out;
1104
+ _out14: cs = 14; goto _out;
1105
+ _out15: cs = 15; goto _out;
1106
+ _out16: cs = 16; goto _out;
1107
+ _out57: cs = 57; goto _out;
1108
+ _out17: cs = 17; goto _out;
1109
+ _out18: cs = 18; goto _out;
1110
+ _out19: cs = 19; goto _out;
1111
+ _out20: cs = 20; goto _out;
1112
+ _out21: cs = 21; goto _out;
1113
+ _out22: cs = 22; goto _out;
1114
+ _out23: cs = 23; goto _out;
1115
+ _out24: cs = 24; goto _out;
1116
+ _out25: cs = 25; goto _out;
1117
+ _out26: cs = 26; goto _out;
1118
+ _out27: cs = 27; goto _out;
1119
+ _out28: cs = 28; goto _out;
1120
+ _out29: cs = 29; goto _out;
1121
+ _out30: cs = 30; goto _out;
1122
+ _out31: cs = 31; goto _out;
1123
+ _out32: cs = 32; goto _out;
1124
+ _out33: cs = 33; goto _out;
1125
+ _out34: cs = 34; goto _out;
1126
+ _out35: cs = 35; goto _out;
1127
+ _out36: cs = 36; goto _out;
1128
+ _out37: cs = 37; goto _out;
1129
+ _out38: cs = 38; goto _out;
1130
+ _out39: cs = 39; goto _out;
1131
+ _out40: cs = 40; goto _out;
1132
+ _out41: cs = 41; goto _out;
1133
+ _out42: cs = 42; goto _out;
1134
+ _out43: cs = 43; goto _out;
1135
+ _out44: cs = 44; goto _out;
1136
+ _out45: cs = 45; goto _out;
1137
+ _out46: cs = 46; goto _out;
1138
+ _out47: cs = 47; goto _out;
1139
+ _out48: cs = 48; goto _out;
1140
+ _out49: cs = 49; goto _out;
1141
+ _out50: cs = 50; goto _out;
1142
+ _out51: cs = 51; goto _out;
1143
+ _out52: cs = 52; goto _out;
1144
+ _out53: cs = 53; goto _out;
1145
+ _out54: cs = 54; goto _out;
1146
+ _out55: cs = 55; goto _out;
1147
+ _out56: cs = 56; goto _out;
1148
+
1149
+ _out: {}
1150
+ }
1151
+ #line 100 "parser.rl"
1152
+
1153
+ parser->cs = cs;
1154
+ parser->nread += p - (buffer + off);
1155
+
1156
+ assert(p <= pe && "buffer overflow after parsing execute");
1157
+ assert(parser->nread <= len && "nread longer than length");
1158
+ assert(parser->body_start <= len && "body starts after buffer end");
1159
+ assert(parser->mark < len && "mark is after buffer end");
1160
+ assert(parser->field_len <= len && "field has length longer than whole buffer");
1161
+ assert(parser->field_start < len && "field starts after buffer end");
1162
+
1163
+ if(parser->body_start) {
1164
+ /* final \r\n combo encountered so stop right here */
1165
+
1166
+ #line 1167 "parser.c"
1167
+ #line 114 "parser.rl"
1168
+ parser->nread++;
1169
+ }
1170
+
1171
+ return(parser->nread);
1172
+ }
1173
+
1174
+ int http_parser_finish(http_parser *parser)
1175
+ {
1176
+ int cs = parser->cs;
1177
+
1178
+
1179
+ #line 1180 "parser.c"
1180
+ #line 125 "parser.rl"
1181
+
1182
+ parser->cs = cs;
1183
+
1184
+ if (http_parser_has_error(parser) ) {
1185
+ return -1;
1186
+ } else if (http_parser_is_finished(parser) ) {
1187
+ return 1;
1188
+ } else {
1189
+ return 0;
1190
+ }
1191
+ }
1192
+
1193
+ int http_parser_has_error(http_parser *parser) {
1194
+ return parser->cs == http_parser_error;
1195
+ }
1196
+
1197
+ int http_parser_is_finished(http_parser *parser) {
1198
+ return parser->cs == http_parser_first_final;
1199
+ }