thin 1.2.6-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +273 -0
- data/COPYING +18 -0
- data/README +69 -0
- data/Rakefile +39 -0
- data/benchmark/abc +51 -0
- data/benchmark/benchmarker.rb +80 -0
- data/benchmark/runner +82 -0
- data/bin/thin +6 -0
- data/example/adapter.rb +32 -0
- data/example/async_app.ru +126 -0
- data/example/async_chat.ru +247 -0
- data/example/async_tailer.ru +100 -0
- data/example/config.ru +22 -0
- data/example/monit_sockets +20 -0
- data/example/monit_unixsock +20 -0
- data/example/myapp.rb +1 -0
- data/example/ramaze.ru +12 -0
- data/example/thin.god +80 -0
- data/example/thin_solaris_smf.erb +36 -0
- data/example/thin_solaris_smf.readme.txt +150 -0
- data/example/vlad.rake +64 -0
- data/ext/thin_parser/common.rl +55 -0
- data/ext/thin_parser/ext_help.h +14 -0
- data/ext/thin_parser/extconf.rb +6 -0
- data/ext/thin_parser/parser.c +1185 -0
- data/ext/thin_parser/parser.h +49 -0
- data/ext/thin_parser/parser.rl +157 -0
- data/ext/thin_parser/thin.c +436 -0
- data/lib/rack/adapter/loader.rb +91 -0
- data/lib/rack/adapter/rails.rb +180 -0
- data/lib/thin.rb +46 -0
- data/lib/thin/backends/base.rb +141 -0
- data/lib/thin/backends/swiftiply_client.rb +56 -0
- data/lib/thin/backends/tcp_server.rb +29 -0
- data/lib/thin/backends/unix_server.rb +51 -0
- data/lib/thin/command.rb +53 -0
- data/lib/thin/connection.rb +222 -0
- data/lib/thin/controllers/cluster.rb +178 -0
- data/lib/thin/controllers/controller.rb +182 -0
- data/lib/thin/controllers/service.rb +75 -0
- data/lib/thin/controllers/service.sh.erb +39 -0
- data/lib/thin/daemonizing.rb +176 -0
- data/lib/thin/headers.rb +39 -0
- data/lib/thin/logging.rb +54 -0
- data/lib/thin/request.rb +157 -0
- data/lib/thin/response.rb +101 -0
- data/lib/thin/runner.rb +212 -0
- data/lib/thin/server.rb +248 -0
- data/lib/thin/stats.html.erb +216 -0
- data/lib/thin/stats.rb +52 -0
- data/lib/thin/statuses.rb +43 -0
- data/lib/thin/version.rb +32 -0
- data/lib/thin_parser.so +0 -0
- data/spec/backends/swiftiply_client_spec.rb +66 -0
- data/spec/backends/tcp_server_spec.rb +33 -0
- data/spec/backends/unix_server_spec.rb +37 -0
- data/spec/command_spec.rb +25 -0
- data/spec/configs/cluster.yml +9 -0
- data/spec/configs/single.yml +9 -0
- data/spec/connection_spec.rb +106 -0
- data/spec/controllers/cluster_spec.rb +267 -0
- data/spec/controllers/controller_spec.rb +129 -0
- data/spec/controllers/service_spec.rb +50 -0
- data/spec/daemonizing_spec.rb +192 -0
- data/spec/headers_spec.rb +40 -0
- data/spec/logging_spec.rb +46 -0
- data/spec/perf/request_perf_spec.rb +50 -0
- data/spec/perf/response_perf_spec.rb +19 -0
- data/spec/perf/server_perf_spec.rb +39 -0
- data/spec/rack/loader_spec.rb +42 -0
- data/spec/rack/rails_adapter_spec.rb +106 -0
- data/spec/rails_app/app/controllers/application.rb +10 -0
- data/spec/rails_app/app/controllers/simple_controller.rb +19 -0
- data/spec/rails_app/app/helpers/application_helper.rb +3 -0
- data/spec/rails_app/app/views/simple/index.html.erb +15 -0
- data/spec/rails_app/config/boot.rb +109 -0
- data/spec/rails_app/config/environment.rb +64 -0
- data/spec/rails_app/config/environments/development.rb +18 -0
- data/spec/rails_app/config/environments/production.rb +19 -0
- data/spec/rails_app/config/environments/test.rb +22 -0
- data/spec/rails_app/config/initializers/inflections.rb +10 -0
- data/spec/rails_app/config/initializers/mime_types.rb +5 -0
- data/spec/rails_app/config/routes.rb +35 -0
- data/spec/rails_app/public/404.html +30 -0
- data/spec/rails_app/public/422.html +30 -0
- data/spec/rails_app/public/500.html +30 -0
- data/spec/rails_app/public/dispatch.cgi +10 -0
- data/spec/rails_app/public/dispatch.fcgi +24 -0
- data/spec/rails_app/public/dispatch.rb +10 -0
- data/spec/rails_app/public/favicon.ico +0 -0
- data/spec/rails_app/public/images/rails.png +0 -0
- data/spec/rails_app/public/index.html +277 -0
- data/spec/rails_app/public/javascripts/application.js +2 -0
- data/spec/rails_app/public/javascripts/controls.js +963 -0
- data/spec/rails_app/public/javascripts/dragdrop.js +972 -0
- data/spec/rails_app/public/javascripts/effects.js +1120 -0
- data/spec/rails_app/public/javascripts/prototype.js +4225 -0
- data/spec/rails_app/public/robots.txt +5 -0
- data/spec/rails_app/script/about +3 -0
- data/spec/rails_app/script/console +3 -0
- data/spec/rails_app/script/destroy +3 -0
- data/spec/rails_app/script/generate +3 -0
- data/spec/rails_app/script/performance/benchmarker +3 -0
- data/spec/rails_app/script/performance/profiler +3 -0
- data/spec/rails_app/script/performance/request +3 -0
- data/spec/rails_app/script/plugin +3 -0
- data/spec/rails_app/script/process/inspector +3 -0
- data/spec/rails_app/script/process/reaper +3 -0
- data/spec/rails_app/script/process/spawner +3 -0
- data/spec/rails_app/script/runner +3 -0
- data/spec/rails_app/script/server +3 -0
- data/spec/request/mongrel_spec.rb +39 -0
- data/spec/request/parser_spec.rb +243 -0
- data/spec/request/persistent_spec.rb +35 -0
- data/spec/request/processing_spec.rb +50 -0
- data/spec/response_spec.rb +91 -0
- data/spec/runner_spec.rb +168 -0
- data/spec/server/builder_spec.rb +44 -0
- data/spec/server/pipelining_spec.rb +110 -0
- data/spec/server/robustness_spec.rb +34 -0
- data/spec/server/stopping_spec.rb +55 -0
- data/spec/server/swiftiply.yml +6 -0
- data/spec/server/swiftiply_spec.rb +32 -0
- data/spec/server/tcp_spec.rb +57 -0
- data/spec/server/threaded_spec.rb +27 -0
- data/spec/server/unix_socket_spec.rb +26 -0
- data/spec/server_spec.rb +100 -0
- data/spec/spec_helper.rb +219 -0
- data/tasks/announce.rake +22 -0
- data/tasks/deploy.rake +13 -0
- data/tasks/email.erb +30 -0
- data/tasks/gem.rake +66 -0
- data/tasks/rdoc.rake +25 -0
- data/tasks/site.rake +15 -0
- data/tasks/spec.rake +43 -0
- data/tasks/stats.rake +28 -0
- metadata +219 -0
data/example/vlad.rake
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# $GEM_HOME/gems/vlad-1.2.0/lib/vlad/thin.rb
|
2
|
+
# Thin tasks for Vlad the Deployer
|
3
|
+
# By cnantais
|
4
|
+
require 'vlad'
|
5
|
+
|
6
|
+
namespace :vlad do
|
7
|
+
##
|
8
|
+
# Thin app server
|
9
|
+
|
10
|
+
set :thin_address, "127.0.0.1"
|
11
|
+
set :thin_command, 'thin'
|
12
|
+
set(:thin_conf) { "#{shared_path}/thin_cluster.conf" }
|
13
|
+
set :thin_environment, "production"
|
14
|
+
set :thin_group, nil
|
15
|
+
set :thin_log_file, nil
|
16
|
+
set :thin_pid_file, nil
|
17
|
+
set :thin_port, nil
|
18
|
+
set :thin_socket, nil
|
19
|
+
set :thin_prefix, nil
|
20
|
+
set :thin_servers, 2
|
21
|
+
set :thin_user, nil
|
22
|
+
|
23
|
+
desc "Prepares application servers for deployment. thin
|
24
|
+
configuration is set via the thin_* variables.".cleanup
|
25
|
+
|
26
|
+
remote_task :setup_app, :roles => :app do
|
27
|
+
|
28
|
+
raise(ArgumentError, "Please provide either thin_socket or thin_port") if thin_port.nil? && thin_socket.nil?
|
29
|
+
|
30
|
+
cmd = [
|
31
|
+
"#{thin_command} config",
|
32
|
+
"-s #{thin_servers}",
|
33
|
+
("-S #{thin_socket}" if thin_socket),
|
34
|
+
"-e #{thin_environment}",
|
35
|
+
"-a #{thin_address}",
|
36
|
+
"-c #{current_path}",
|
37
|
+
"-C #{thin_conf}",
|
38
|
+
("-P #{thin_pid_file}" if thin_pid_file),
|
39
|
+
("-l #{thin_log_file}" if thin_log_file),
|
40
|
+
("--user #{thin_user}" if thin_user),
|
41
|
+
("--group #{thin_group}" if thin_group),
|
42
|
+
("--prefix #{thin_prefix}" if thin_prefix),
|
43
|
+
("-p #{thin_port}" if thin_port),
|
44
|
+
].compact.join ' '
|
45
|
+
|
46
|
+
run cmd
|
47
|
+
end
|
48
|
+
|
49
|
+
def thin(cmd) # :nodoc:
|
50
|
+
"#{thin_command} #{cmd} -C #{thin_conf}"
|
51
|
+
end
|
52
|
+
|
53
|
+
desc "Restart the app servers"
|
54
|
+
|
55
|
+
remote_task :start_app, :roles => :app do
|
56
|
+
run thin("restart -s #{thin_servers}")
|
57
|
+
end
|
58
|
+
|
59
|
+
desc "Stop the app servers"
|
60
|
+
|
61
|
+
remote_task :stop_app, :roles => :app do
|
62
|
+
run thin("stop -s #{thin_servers}")
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,55 @@
|
|
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
|
+
sorta_safe = ("\"" | "<" | ">");
|
15
|
+
unsafe = (CTL | " " | "#" | "%" | sorta_safe);
|
16
|
+
national = any -- (alpha | digit | reserved | extra | safe | unsafe);
|
17
|
+
unreserved = (alpha | digit | safe | extra | national);
|
18
|
+
escape = ("%" xdigit xdigit);
|
19
|
+
uchar = (unreserved | escape | sorta_safe);
|
20
|
+
pchar = (uchar | ":" | "@" | "&" | "=" | "+");
|
21
|
+
tspecials = ("(" | ")" | "<" | ">" | "@" | "," | ";" | ":" | "\\" | "\"" | "/" | "[" | "]" | "?" | "=" | "{" | "}" | " " | "\t");
|
22
|
+
|
23
|
+
# elements
|
24
|
+
token = (ascii -- (CTL | tspecials));
|
25
|
+
|
26
|
+
# URI schemes and absolute paths
|
27
|
+
scheme = ( alpha | digit | "+" | "-" | "." )* ;
|
28
|
+
absolute_uri = (scheme ":" (uchar | reserved )*);
|
29
|
+
|
30
|
+
path = ( pchar+ ( "/" pchar* )* ) ;
|
31
|
+
query = ( uchar | reserved )* %query_string ;
|
32
|
+
param = ( pchar | "/" )* ;
|
33
|
+
params = ( param ( ";" param )* ) ;
|
34
|
+
rel_path = ( path? (";" params)? %request_path) ("?" %start_query query)?;
|
35
|
+
absolute_path = ( "/"+ rel_path );
|
36
|
+
|
37
|
+
Request_URI = ( "*" | absolute_uri | absolute_path ) >mark %request_uri;
|
38
|
+
Fragment = ( uchar | reserved )* >mark %fragment;
|
39
|
+
Method = ( upper | digit | safe ){1,20} >mark %request_method;
|
40
|
+
|
41
|
+
http_number = ( digit+ "." digit+ ) ;
|
42
|
+
HTTP_Version = ( "HTTP/" http_number ) >mark %http_version ;
|
43
|
+
Request_Line = ( Method " " Request_URI ("#" Fragment){0,1} " " HTTP_Version CRLF ) ;
|
44
|
+
|
45
|
+
field_name = ( token -- ":" )+ >start_field %write_field;
|
46
|
+
|
47
|
+
field_value = any* >start_value %write_value;
|
48
|
+
|
49
|
+
message_header = field_name ":" " "* field_value :> CRLF;
|
50
|
+
|
51
|
+
Request = Request_Line ( message_header )* ( CRLF @done );
|
52
|
+
|
53
|
+
main := Request;
|
54
|
+
|
55
|
+
}%%
|
@@ -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,1185 @@
|
|
1
|
+
|
2
|
+
#line 1 "parser.rl"
|
3
|
+
/**
|
4
|
+
* Copyright (c) 2005 Zed A. Shaw
|
5
|
+
* You can redistribute it and/or modify it under the same terms as Ruby.
|
6
|
+
*/
|
7
|
+
#include "parser.h"
|
8
|
+
#include <stdio.h>
|
9
|
+
#include <assert.h>
|
10
|
+
#include <stdlib.h>
|
11
|
+
#include <ctype.h>
|
12
|
+
#include <string.h>
|
13
|
+
|
14
|
+
#define LEN(AT, FPC) (FPC - buffer - parser->AT)
|
15
|
+
#define MARK(M,FPC) (parser->M = (FPC) - buffer)
|
16
|
+
#define PTR_TO(F) (buffer + parser->F)
|
17
|
+
|
18
|
+
/** Machine **/
|
19
|
+
|
20
|
+
|
21
|
+
#line 81 "parser.rl"
|
22
|
+
|
23
|
+
|
24
|
+
/** Data **/
|
25
|
+
|
26
|
+
#line 27 "parser.c"
|
27
|
+
static const int http_parser_start = 1;
|
28
|
+
static const int http_parser_first_final = 54;
|
29
|
+
static const int http_parser_error = 0;
|
30
|
+
|
31
|
+
static const int http_parser_en_main = 1;
|
32
|
+
|
33
|
+
|
34
|
+
#line 85 "parser.rl"
|
35
|
+
|
36
|
+
int thin_http_parser_init(http_parser *parser) {
|
37
|
+
int cs = 0;
|
38
|
+
|
39
|
+
#line 40 "parser.c"
|
40
|
+
{
|
41
|
+
cs = http_parser_start;
|
42
|
+
}
|
43
|
+
|
44
|
+
#line 89 "parser.rl"
|
45
|
+
parser->cs = cs;
|
46
|
+
parser->body_start = 0;
|
47
|
+
parser->content_len = 0;
|
48
|
+
parser->mark = 0;
|
49
|
+
parser->nread = 0;
|
50
|
+
parser->field_len = 0;
|
51
|
+
parser->field_start = 0;
|
52
|
+
|
53
|
+
return(1);
|
54
|
+
}
|
55
|
+
|
56
|
+
|
57
|
+
/** exec **/
|
58
|
+
size_t thin_http_parser_execute(http_parser *parser, const char *buffer, size_t len, size_t off) {
|
59
|
+
const char *p, *pe;
|
60
|
+
int cs = parser->cs;
|
61
|
+
|
62
|
+
assert(off <= len && "offset past end of buffer");
|
63
|
+
|
64
|
+
p = buffer+off;
|
65
|
+
pe = buffer+len;
|
66
|
+
|
67
|
+
assert(*pe == '\0' && "pointer does not end on NUL");
|
68
|
+
assert(pe - p == len - off && "pointers aren't same distance");
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
#line 73 "parser.c"
|
73
|
+
{
|
74
|
+
if ( p == pe )
|
75
|
+
goto _test_eof;
|
76
|
+
switch ( cs )
|
77
|
+
{
|
78
|
+
case 1:
|
79
|
+
switch( (*p) ) {
|
80
|
+
case 36: goto tr0;
|
81
|
+
case 95: goto tr0;
|
82
|
+
}
|
83
|
+
if ( (*p) < 48 ) {
|
84
|
+
if ( 45 <= (*p) && (*p) <= 46 )
|
85
|
+
goto tr0;
|
86
|
+
} else if ( (*p) > 57 ) {
|
87
|
+
if ( 65 <= (*p) && (*p) <= 90 )
|
88
|
+
goto tr0;
|
89
|
+
} else
|
90
|
+
goto tr0;
|
91
|
+
goto st0;
|
92
|
+
st0:
|
93
|
+
cs = 0;
|
94
|
+
goto _out;
|
95
|
+
tr0:
|
96
|
+
#line 22 "parser.rl"
|
97
|
+
{MARK(mark, p); }
|
98
|
+
goto st2;
|
99
|
+
st2:
|
100
|
+
if ( ++p == pe )
|
101
|
+
goto _test_eof2;
|
102
|
+
case 2:
|
103
|
+
#line 104 "parser.c"
|
104
|
+
switch( (*p) ) {
|
105
|
+
case 32: goto tr2;
|
106
|
+
case 36: goto st35;
|
107
|
+
case 95: goto st35;
|
108
|
+
}
|
109
|
+
if ( (*p) < 48 ) {
|
110
|
+
if ( 45 <= (*p) && (*p) <= 46 )
|
111
|
+
goto st35;
|
112
|
+
} else if ( (*p) > 57 ) {
|
113
|
+
if ( 65 <= (*p) && (*p) <= 90 )
|
114
|
+
goto st35;
|
115
|
+
} else
|
116
|
+
goto st35;
|
117
|
+
goto st0;
|
118
|
+
tr2:
|
119
|
+
#line 36 "parser.rl"
|
120
|
+
{
|
121
|
+
if (parser->request_method != NULL) {
|
122
|
+
parser->request_method(parser->data, PTR_TO(mark), LEN(mark, p));
|
123
|
+
}
|
124
|
+
}
|
125
|
+
goto st3;
|
126
|
+
st3:
|
127
|
+
if ( ++p == pe )
|
128
|
+
goto _test_eof3;
|
129
|
+
case 3:
|
130
|
+
#line 131 "parser.c"
|
131
|
+
switch( (*p) ) {
|
132
|
+
case 42: goto tr4;
|
133
|
+
case 43: goto tr5;
|
134
|
+
case 47: goto tr6;
|
135
|
+
case 58: goto tr7;
|
136
|
+
}
|
137
|
+
if ( (*p) < 65 ) {
|
138
|
+
if ( 45 <= (*p) && (*p) <= 57 )
|
139
|
+
goto tr5;
|
140
|
+
} else if ( (*p) > 90 ) {
|
141
|
+
if ( 97 <= (*p) && (*p) <= 122 )
|
142
|
+
goto tr5;
|
143
|
+
} else
|
144
|
+
goto tr5;
|
145
|
+
goto st0;
|
146
|
+
tr4:
|
147
|
+
#line 22 "parser.rl"
|
148
|
+
{MARK(mark, p); }
|
149
|
+
goto st4;
|
150
|
+
st4:
|
151
|
+
if ( ++p == pe )
|
152
|
+
goto _test_eof4;
|
153
|
+
case 4:
|
154
|
+
#line 155 "parser.c"
|
155
|
+
switch( (*p) ) {
|
156
|
+
case 32: goto tr8;
|
157
|
+
case 35: goto tr9;
|
158
|
+
}
|
159
|
+
goto st0;
|
160
|
+
tr8:
|
161
|
+
#line 41 "parser.rl"
|
162
|
+
{
|
163
|
+
if (parser->request_uri != NULL) {
|
164
|
+
parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
|
165
|
+
}
|
166
|
+
}
|
167
|
+
goto st5;
|
168
|
+
tr31:
|
169
|
+
#line 22 "parser.rl"
|
170
|
+
{MARK(mark, p); }
|
171
|
+
#line 46 "parser.rl"
|
172
|
+
{
|
173
|
+
if (parser->fragment != NULL) {
|
174
|
+
parser->fragment(parser->data, PTR_TO(mark), LEN(mark, p));
|
175
|
+
}
|
176
|
+
}
|
177
|
+
goto st5;
|
178
|
+
tr34:
|
179
|
+
#line 46 "parser.rl"
|
180
|
+
{
|
181
|
+
if (parser->fragment != NULL) {
|
182
|
+
parser->fragment(parser->data, PTR_TO(mark), LEN(mark, p));
|
183
|
+
}
|
184
|
+
}
|
185
|
+
goto st5;
|
186
|
+
tr42:
|
187
|
+
#line 65 "parser.rl"
|
188
|
+
{
|
189
|
+
if (parser->request_path != NULL) {
|
190
|
+
parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
|
191
|
+
}
|
192
|
+
}
|
193
|
+
#line 41 "parser.rl"
|
194
|
+
{
|
195
|
+
if (parser->request_uri != NULL) {
|
196
|
+
parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
|
197
|
+
}
|
198
|
+
}
|
199
|
+
goto st5;
|
200
|
+
tr48:
|
201
|
+
#line 52 "parser.rl"
|
202
|
+
{MARK(query_start, p); }
|
203
|
+
#line 53 "parser.rl"
|
204
|
+
{
|
205
|
+
if (parser->query_string != NULL) {
|
206
|
+
parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
|
207
|
+
}
|
208
|
+
}
|
209
|
+
#line 41 "parser.rl"
|
210
|
+
{
|
211
|
+
if (parser->request_uri != NULL) {
|
212
|
+
parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
|
213
|
+
}
|
214
|
+
}
|
215
|
+
goto st5;
|
216
|
+
tr52:
|
217
|
+
#line 53 "parser.rl"
|
218
|
+
{
|
219
|
+
if (parser->query_string != NULL) {
|
220
|
+
parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
|
221
|
+
}
|
222
|
+
}
|
223
|
+
#line 41 "parser.rl"
|
224
|
+
{
|
225
|
+
if (parser->request_uri != NULL) {
|
226
|
+
parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
|
227
|
+
}
|
228
|
+
}
|
229
|
+
goto st5;
|
230
|
+
st5:
|
231
|
+
if ( ++p == pe )
|
232
|
+
goto _test_eof5;
|
233
|
+
case 5:
|
234
|
+
#line 235 "parser.c"
|
235
|
+
if ( (*p) == 72 )
|
236
|
+
goto tr10;
|
237
|
+
goto st0;
|
238
|
+
tr10:
|
239
|
+
#line 22 "parser.rl"
|
240
|
+
{MARK(mark, p); }
|
241
|
+
goto st6;
|
242
|
+
st6:
|
243
|
+
if ( ++p == pe )
|
244
|
+
goto _test_eof6;
|
245
|
+
case 6:
|
246
|
+
#line 247 "parser.c"
|
247
|
+
if ( (*p) == 84 )
|
248
|
+
goto st7;
|
249
|
+
goto st0;
|
250
|
+
st7:
|
251
|
+
if ( ++p == pe )
|
252
|
+
goto _test_eof7;
|
253
|
+
case 7:
|
254
|
+
if ( (*p) == 84 )
|
255
|
+
goto st8;
|
256
|
+
goto st0;
|
257
|
+
st8:
|
258
|
+
if ( ++p == pe )
|
259
|
+
goto _test_eof8;
|
260
|
+
case 8:
|
261
|
+
if ( (*p) == 80 )
|
262
|
+
goto st9;
|
263
|
+
goto st0;
|
264
|
+
st9:
|
265
|
+
if ( ++p == pe )
|
266
|
+
goto _test_eof9;
|
267
|
+
case 9:
|
268
|
+
if ( (*p) == 47 )
|
269
|
+
goto st10;
|
270
|
+
goto st0;
|
271
|
+
st10:
|
272
|
+
if ( ++p == pe )
|
273
|
+
goto _test_eof10;
|
274
|
+
case 10:
|
275
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
276
|
+
goto st11;
|
277
|
+
goto st0;
|
278
|
+
st11:
|
279
|
+
if ( ++p == pe )
|
280
|
+
goto _test_eof11;
|
281
|
+
case 11:
|
282
|
+
if ( (*p) == 46 )
|
283
|
+
goto st12;
|
284
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
285
|
+
goto st11;
|
286
|
+
goto st0;
|
287
|
+
st12:
|
288
|
+
if ( ++p == pe )
|
289
|
+
goto _test_eof12;
|
290
|
+
case 12:
|
291
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
292
|
+
goto st13;
|
293
|
+
goto st0;
|
294
|
+
st13:
|
295
|
+
if ( ++p == pe )
|
296
|
+
goto _test_eof13;
|
297
|
+
case 13:
|
298
|
+
if ( (*p) == 13 )
|
299
|
+
goto tr18;
|
300
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
301
|
+
goto st13;
|
302
|
+
goto st0;
|
303
|
+
tr18:
|
304
|
+
#line 59 "parser.rl"
|
305
|
+
{
|
306
|
+
if (parser->http_version != NULL) {
|
307
|
+
parser->http_version(parser->data, PTR_TO(mark), LEN(mark, p));
|
308
|
+
}
|
309
|
+
}
|
310
|
+
goto st14;
|
311
|
+
tr26:
|
312
|
+
#line 30 "parser.rl"
|
313
|
+
{ MARK(mark, p); }
|
314
|
+
#line 31 "parser.rl"
|
315
|
+
{
|
316
|
+
if (parser->http_field != NULL) {
|
317
|
+
parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
|
318
|
+
}
|
319
|
+
}
|
320
|
+
goto st14;
|
321
|
+
tr29:
|
322
|
+
#line 31 "parser.rl"
|
323
|
+
{
|
324
|
+
if (parser->http_field != NULL) {
|
325
|
+
parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
|
326
|
+
}
|
327
|
+
}
|
328
|
+
goto st14;
|
329
|
+
st14:
|
330
|
+
if ( ++p == pe )
|
331
|
+
goto _test_eof14;
|
332
|
+
case 14:
|
333
|
+
#line 334 "parser.c"
|
334
|
+
if ( (*p) == 10 )
|
335
|
+
goto st15;
|
336
|
+
goto st0;
|
337
|
+
st15:
|
338
|
+
if ( ++p == pe )
|
339
|
+
goto _test_eof15;
|
340
|
+
case 15:
|
341
|
+
switch( (*p) ) {
|
342
|
+
case 13: goto st16;
|
343
|
+
case 33: goto tr21;
|
344
|
+
case 124: goto tr21;
|
345
|
+
case 126: goto tr21;
|
346
|
+
}
|
347
|
+
if ( (*p) < 45 ) {
|
348
|
+
if ( (*p) > 39 ) {
|
349
|
+
if ( 42 <= (*p) && (*p) <= 43 )
|
350
|
+
goto tr21;
|
351
|
+
} else if ( (*p) >= 35 )
|
352
|
+
goto tr21;
|
353
|
+
} else if ( (*p) > 46 ) {
|
354
|
+
if ( (*p) < 65 ) {
|
355
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
356
|
+
goto tr21;
|
357
|
+
} else if ( (*p) > 90 ) {
|
358
|
+
if ( 94 <= (*p) && (*p) <= 122 )
|
359
|
+
goto tr21;
|
360
|
+
} else
|
361
|
+
goto tr21;
|
362
|
+
} else
|
363
|
+
goto tr21;
|
364
|
+
goto st0;
|
365
|
+
st16:
|
366
|
+
if ( ++p == pe )
|
367
|
+
goto _test_eof16;
|
368
|
+
case 16:
|
369
|
+
if ( (*p) == 10 )
|
370
|
+
goto tr22;
|
371
|
+
goto st0;
|
372
|
+
tr22:
|
373
|
+
#line 71 "parser.rl"
|
374
|
+
{
|
375
|
+
parser->body_start = p - buffer + 1;
|
376
|
+
if (parser->header_done != NULL) {
|
377
|
+
parser->header_done(parser->data, p + 1, pe - p - 1);
|
378
|
+
}
|
379
|
+
{p++; cs = 54; goto _out;}
|
380
|
+
}
|
381
|
+
goto st54;
|
382
|
+
st54:
|
383
|
+
if ( ++p == pe )
|
384
|
+
goto _test_eof54;
|
385
|
+
case 54:
|
386
|
+
#line 387 "parser.c"
|
387
|
+
goto st0;
|
388
|
+
tr21:
|
389
|
+
#line 25 "parser.rl"
|
390
|
+
{ MARK(field_start, p); }
|
391
|
+
goto st17;
|
392
|
+
st17:
|
393
|
+
if ( ++p == pe )
|
394
|
+
goto _test_eof17;
|
395
|
+
case 17:
|
396
|
+
#line 397 "parser.c"
|
397
|
+
switch( (*p) ) {
|
398
|
+
case 33: goto st17;
|
399
|
+
case 58: goto tr24;
|
400
|
+
case 124: goto st17;
|
401
|
+
case 126: goto st17;
|
402
|
+
}
|
403
|
+
if ( (*p) < 45 ) {
|
404
|
+
if ( (*p) > 39 ) {
|
405
|
+
if ( 42 <= (*p) && (*p) <= 43 )
|
406
|
+
goto st17;
|
407
|
+
} else if ( (*p) >= 35 )
|
408
|
+
goto st17;
|
409
|
+
} else if ( (*p) > 46 ) {
|
410
|
+
if ( (*p) < 65 ) {
|
411
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
412
|
+
goto st17;
|
413
|
+
} else if ( (*p) > 90 ) {
|
414
|
+
if ( 94 <= (*p) && (*p) <= 122 )
|
415
|
+
goto st17;
|
416
|
+
} else
|
417
|
+
goto st17;
|
418
|
+
} else
|
419
|
+
goto st17;
|
420
|
+
goto st0;
|
421
|
+
tr24:
|
422
|
+
#line 26 "parser.rl"
|
423
|
+
{
|
424
|
+
parser->field_len = LEN(field_start, p);
|
425
|
+
}
|
426
|
+
goto st18;
|
427
|
+
tr27:
|
428
|
+
#line 30 "parser.rl"
|
429
|
+
{ MARK(mark, p); }
|
430
|
+
goto st18;
|
431
|
+
st18:
|
432
|
+
if ( ++p == pe )
|
433
|
+
goto _test_eof18;
|
434
|
+
case 18:
|
435
|
+
#line 436 "parser.c"
|
436
|
+
switch( (*p) ) {
|
437
|
+
case 13: goto tr26;
|
438
|
+
case 32: goto tr27;
|
439
|
+
}
|
440
|
+
goto tr25;
|
441
|
+
tr25:
|
442
|
+
#line 30 "parser.rl"
|
443
|
+
{ MARK(mark, p); }
|
444
|
+
goto st19;
|
445
|
+
st19:
|
446
|
+
if ( ++p == pe )
|
447
|
+
goto _test_eof19;
|
448
|
+
case 19:
|
449
|
+
#line 450 "parser.c"
|
450
|
+
if ( (*p) == 13 )
|
451
|
+
goto tr29;
|
452
|
+
goto st19;
|
453
|
+
tr9:
|
454
|
+
#line 41 "parser.rl"
|
455
|
+
{
|
456
|
+
if (parser->request_uri != NULL) {
|
457
|
+
parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
|
458
|
+
}
|
459
|
+
}
|
460
|
+
goto st20;
|
461
|
+
tr43:
|
462
|
+
#line 65 "parser.rl"
|
463
|
+
{
|
464
|
+
if (parser->request_path != NULL) {
|
465
|
+
parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
|
466
|
+
}
|
467
|
+
}
|
468
|
+
#line 41 "parser.rl"
|
469
|
+
{
|
470
|
+
if (parser->request_uri != NULL) {
|
471
|
+
parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
|
472
|
+
}
|
473
|
+
}
|
474
|
+
goto st20;
|
475
|
+
tr49:
|
476
|
+
#line 52 "parser.rl"
|
477
|
+
{MARK(query_start, p); }
|
478
|
+
#line 53 "parser.rl"
|
479
|
+
{
|
480
|
+
if (parser->query_string != NULL) {
|
481
|
+
parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
|
482
|
+
}
|
483
|
+
}
|
484
|
+
#line 41 "parser.rl"
|
485
|
+
{
|
486
|
+
if (parser->request_uri != NULL) {
|
487
|
+
parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
|
488
|
+
}
|
489
|
+
}
|
490
|
+
goto st20;
|
491
|
+
tr53:
|
492
|
+
#line 53 "parser.rl"
|
493
|
+
{
|
494
|
+
if (parser->query_string != NULL) {
|
495
|
+
parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
|
496
|
+
}
|
497
|
+
}
|
498
|
+
#line 41 "parser.rl"
|
499
|
+
{
|
500
|
+
if (parser->request_uri != NULL) {
|
501
|
+
parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
|
502
|
+
}
|
503
|
+
}
|
504
|
+
goto st20;
|
505
|
+
st20:
|
506
|
+
if ( ++p == pe )
|
507
|
+
goto _test_eof20;
|
508
|
+
case 20:
|
509
|
+
#line 510 "parser.c"
|
510
|
+
switch( (*p) ) {
|
511
|
+
case 32: goto tr31;
|
512
|
+
case 35: goto st0;
|
513
|
+
case 37: goto tr32;
|
514
|
+
case 127: goto st0;
|
515
|
+
}
|
516
|
+
if ( 0 <= (*p) && (*p) <= 31 )
|
517
|
+
goto st0;
|
518
|
+
goto tr30;
|
519
|
+
tr30:
|
520
|
+
#line 22 "parser.rl"
|
521
|
+
{MARK(mark, p); }
|
522
|
+
goto st21;
|
523
|
+
st21:
|
524
|
+
if ( ++p == pe )
|
525
|
+
goto _test_eof21;
|
526
|
+
case 21:
|
527
|
+
#line 528 "parser.c"
|
528
|
+
switch( (*p) ) {
|
529
|
+
case 32: goto tr34;
|
530
|
+
case 35: goto st0;
|
531
|
+
case 37: goto st22;
|
532
|
+
case 127: goto st0;
|
533
|
+
}
|
534
|
+
if ( 0 <= (*p) && (*p) <= 31 )
|
535
|
+
goto st0;
|
536
|
+
goto st21;
|
537
|
+
tr32:
|
538
|
+
#line 22 "parser.rl"
|
539
|
+
{MARK(mark, p); }
|
540
|
+
goto st22;
|
541
|
+
st22:
|
542
|
+
if ( ++p == pe )
|
543
|
+
goto _test_eof22;
|
544
|
+
case 22:
|
545
|
+
#line 546 "parser.c"
|
546
|
+
if ( (*p) < 65 ) {
|
547
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
548
|
+
goto st23;
|
549
|
+
} else if ( (*p) > 70 ) {
|
550
|
+
if ( 97 <= (*p) && (*p) <= 102 )
|
551
|
+
goto st23;
|
552
|
+
} else
|
553
|
+
goto st23;
|
554
|
+
goto st0;
|
555
|
+
st23:
|
556
|
+
if ( ++p == pe )
|
557
|
+
goto _test_eof23;
|
558
|
+
case 23:
|
559
|
+
if ( (*p) < 65 ) {
|
560
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
561
|
+
goto st21;
|
562
|
+
} else if ( (*p) > 70 ) {
|
563
|
+
if ( 97 <= (*p) && (*p) <= 102 )
|
564
|
+
goto st21;
|
565
|
+
} else
|
566
|
+
goto st21;
|
567
|
+
goto st0;
|
568
|
+
tr5:
|
569
|
+
#line 22 "parser.rl"
|
570
|
+
{MARK(mark, p); }
|
571
|
+
goto st24;
|
572
|
+
st24:
|
573
|
+
if ( ++p == pe )
|
574
|
+
goto _test_eof24;
|
575
|
+
case 24:
|
576
|
+
#line 577 "parser.c"
|
577
|
+
switch( (*p) ) {
|
578
|
+
case 43: goto st24;
|
579
|
+
case 58: goto st25;
|
580
|
+
}
|
581
|
+
if ( (*p) < 48 ) {
|
582
|
+
if ( 45 <= (*p) && (*p) <= 46 )
|
583
|
+
goto st24;
|
584
|
+
} else if ( (*p) > 57 ) {
|
585
|
+
if ( (*p) > 90 ) {
|
586
|
+
if ( 97 <= (*p) && (*p) <= 122 )
|
587
|
+
goto st24;
|
588
|
+
} else if ( (*p) >= 65 )
|
589
|
+
goto st24;
|
590
|
+
} else
|
591
|
+
goto st24;
|
592
|
+
goto st0;
|
593
|
+
tr7:
|
594
|
+
#line 22 "parser.rl"
|
595
|
+
{MARK(mark, p); }
|
596
|
+
goto st25;
|
597
|
+
st25:
|
598
|
+
if ( ++p == pe )
|
599
|
+
goto _test_eof25;
|
600
|
+
case 25:
|
601
|
+
#line 602 "parser.c"
|
602
|
+
switch( (*p) ) {
|
603
|
+
case 32: goto tr8;
|
604
|
+
case 35: goto tr9;
|
605
|
+
case 37: goto st26;
|
606
|
+
case 127: goto st0;
|
607
|
+
}
|
608
|
+
if ( 0 <= (*p) && (*p) <= 31 )
|
609
|
+
goto st0;
|
610
|
+
goto st25;
|
611
|
+
st26:
|
612
|
+
if ( ++p == pe )
|
613
|
+
goto _test_eof26;
|
614
|
+
case 26:
|
615
|
+
if ( (*p) < 65 ) {
|
616
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
617
|
+
goto st27;
|
618
|
+
} else if ( (*p) > 70 ) {
|
619
|
+
if ( 97 <= (*p) && (*p) <= 102 )
|
620
|
+
goto st27;
|
621
|
+
} else
|
622
|
+
goto st27;
|
623
|
+
goto st0;
|
624
|
+
st27:
|
625
|
+
if ( ++p == pe )
|
626
|
+
goto _test_eof27;
|
627
|
+
case 27:
|
628
|
+
if ( (*p) < 65 ) {
|
629
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
630
|
+
goto st25;
|
631
|
+
} else if ( (*p) > 70 ) {
|
632
|
+
if ( 97 <= (*p) && (*p) <= 102 )
|
633
|
+
goto st25;
|
634
|
+
} else
|
635
|
+
goto st25;
|
636
|
+
goto st0;
|
637
|
+
tr6:
|
638
|
+
#line 22 "parser.rl"
|
639
|
+
{MARK(mark, p); }
|
640
|
+
goto st28;
|
641
|
+
st28:
|
642
|
+
if ( ++p == pe )
|
643
|
+
goto _test_eof28;
|
644
|
+
case 28:
|
645
|
+
#line 646 "parser.c"
|
646
|
+
switch( (*p) ) {
|
647
|
+
case 32: goto tr42;
|
648
|
+
case 35: goto tr43;
|
649
|
+
case 37: goto st29;
|
650
|
+
case 63: goto tr45;
|
651
|
+
case 127: goto st0;
|
652
|
+
}
|
653
|
+
if ( 0 <= (*p) && (*p) <= 31 )
|
654
|
+
goto st0;
|
655
|
+
goto st28;
|
656
|
+
st29:
|
657
|
+
if ( ++p == pe )
|
658
|
+
goto _test_eof29;
|
659
|
+
case 29:
|
660
|
+
if ( (*p) < 65 ) {
|
661
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
662
|
+
goto st30;
|
663
|
+
} else if ( (*p) > 70 ) {
|
664
|
+
if ( 97 <= (*p) && (*p) <= 102 )
|
665
|
+
goto st30;
|
666
|
+
} else
|
667
|
+
goto st30;
|
668
|
+
goto st0;
|
669
|
+
st30:
|
670
|
+
if ( ++p == pe )
|
671
|
+
goto _test_eof30;
|
672
|
+
case 30:
|
673
|
+
if ( (*p) < 65 ) {
|
674
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
675
|
+
goto st28;
|
676
|
+
} else if ( (*p) > 70 ) {
|
677
|
+
if ( 97 <= (*p) && (*p) <= 102 )
|
678
|
+
goto st28;
|
679
|
+
} else
|
680
|
+
goto st28;
|
681
|
+
goto st0;
|
682
|
+
tr45:
|
683
|
+
#line 65 "parser.rl"
|
684
|
+
{
|
685
|
+
if (parser->request_path != NULL) {
|
686
|
+
parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
|
687
|
+
}
|
688
|
+
}
|
689
|
+
goto st31;
|
690
|
+
st31:
|
691
|
+
if ( ++p == pe )
|
692
|
+
goto _test_eof31;
|
693
|
+
case 31:
|
694
|
+
#line 695 "parser.c"
|
695
|
+
switch( (*p) ) {
|
696
|
+
case 32: goto tr48;
|
697
|
+
case 35: goto tr49;
|
698
|
+
case 37: goto tr50;
|
699
|
+
case 127: goto st0;
|
700
|
+
}
|
701
|
+
if ( 0 <= (*p) && (*p) <= 31 )
|
702
|
+
goto st0;
|
703
|
+
goto tr47;
|
704
|
+
tr47:
|
705
|
+
#line 52 "parser.rl"
|
706
|
+
{MARK(query_start, p); }
|
707
|
+
goto st32;
|
708
|
+
st32:
|
709
|
+
if ( ++p == pe )
|
710
|
+
goto _test_eof32;
|
711
|
+
case 32:
|
712
|
+
#line 713 "parser.c"
|
713
|
+
switch( (*p) ) {
|
714
|
+
case 32: goto tr52;
|
715
|
+
case 35: goto tr53;
|
716
|
+
case 37: goto st33;
|
717
|
+
case 127: goto st0;
|
718
|
+
}
|
719
|
+
if ( 0 <= (*p) && (*p) <= 31 )
|
720
|
+
goto st0;
|
721
|
+
goto st32;
|
722
|
+
tr50:
|
723
|
+
#line 52 "parser.rl"
|
724
|
+
{MARK(query_start, p); }
|
725
|
+
goto st33;
|
726
|
+
st33:
|
727
|
+
if ( ++p == pe )
|
728
|
+
goto _test_eof33;
|
729
|
+
case 33:
|
730
|
+
#line 731 "parser.c"
|
731
|
+
if ( (*p) < 65 ) {
|
732
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
733
|
+
goto st34;
|
734
|
+
} else if ( (*p) > 70 ) {
|
735
|
+
if ( 97 <= (*p) && (*p) <= 102 )
|
736
|
+
goto st34;
|
737
|
+
} else
|
738
|
+
goto st34;
|
739
|
+
goto st0;
|
740
|
+
st34:
|
741
|
+
if ( ++p == pe )
|
742
|
+
goto _test_eof34;
|
743
|
+
case 34:
|
744
|
+
if ( (*p) < 65 ) {
|
745
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
746
|
+
goto st32;
|
747
|
+
} else if ( (*p) > 70 ) {
|
748
|
+
if ( 97 <= (*p) && (*p) <= 102 )
|
749
|
+
goto st32;
|
750
|
+
} else
|
751
|
+
goto st32;
|
752
|
+
goto st0;
|
753
|
+
st35:
|
754
|
+
if ( ++p == pe )
|
755
|
+
goto _test_eof35;
|
756
|
+
case 35:
|
757
|
+
switch( (*p) ) {
|
758
|
+
case 32: goto tr2;
|
759
|
+
case 36: goto st36;
|
760
|
+
case 95: goto st36;
|
761
|
+
}
|
762
|
+
if ( (*p) < 48 ) {
|
763
|
+
if ( 45 <= (*p) && (*p) <= 46 )
|
764
|
+
goto st36;
|
765
|
+
} else if ( (*p) > 57 ) {
|
766
|
+
if ( 65 <= (*p) && (*p) <= 90 )
|
767
|
+
goto st36;
|
768
|
+
} else
|
769
|
+
goto st36;
|
770
|
+
goto st0;
|
771
|
+
st36:
|
772
|
+
if ( ++p == pe )
|
773
|
+
goto _test_eof36;
|
774
|
+
case 36:
|
775
|
+
switch( (*p) ) {
|
776
|
+
case 32: goto tr2;
|
777
|
+
case 36: goto st37;
|
778
|
+
case 95: goto st37;
|
779
|
+
}
|
780
|
+
if ( (*p) < 48 ) {
|
781
|
+
if ( 45 <= (*p) && (*p) <= 46 )
|
782
|
+
goto st37;
|
783
|
+
} else if ( (*p) > 57 ) {
|
784
|
+
if ( 65 <= (*p) && (*p) <= 90 )
|
785
|
+
goto st37;
|
786
|
+
} else
|
787
|
+
goto st37;
|
788
|
+
goto st0;
|
789
|
+
st37:
|
790
|
+
if ( ++p == pe )
|
791
|
+
goto _test_eof37;
|
792
|
+
case 37:
|
793
|
+
switch( (*p) ) {
|
794
|
+
case 32: goto tr2;
|
795
|
+
case 36: goto st38;
|
796
|
+
case 95: goto st38;
|
797
|
+
}
|
798
|
+
if ( (*p) < 48 ) {
|
799
|
+
if ( 45 <= (*p) && (*p) <= 46 )
|
800
|
+
goto st38;
|
801
|
+
} else if ( (*p) > 57 ) {
|
802
|
+
if ( 65 <= (*p) && (*p) <= 90 )
|
803
|
+
goto st38;
|
804
|
+
} else
|
805
|
+
goto st38;
|
806
|
+
goto st0;
|
807
|
+
st38:
|
808
|
+
if ( ++p == pe )
|
809
|
+
goto _test_eof38;
|
810
|
+
case 38:
|
811
|
+
switch( (*p) ) {
|
812
|
+
case 32: goto tr2;
|
813
|
+
case 36: goto st39;
|
814
|
+
case 95: goto st39;
|
815
|
+
}
|
816
|
+
if ( (*p) < 48 ) {
|
817
|
+
if ( 45 <= (*p) && (*p) <= 46 )
|
818
|
+
goto st39;
|
819
|
+
} else if ( (*p) > 57 ) {
|
820
|
+
if ( 65 <= (*p) && (*p) <= 90 )
|
821
|
+
goto st39;
|
822
|
+
} else
|
823
|
+
goto st39;
|
824
|
+
goto st0;
|
825
|
+
st39:
|
826
|
+
if ( ++p == pe )
|
827
|
+
goto _test_eof39;
|
828
|
+
case 39:
|
829
|
+
switch( (*p) ) {
|
830
|
+
case 32: goto tr2;
|
831
|
+
case 36: goto st40;
|
832
|
+
case 95: goto st40;
|
833
|
+
}
|
834
|
+
if ( (*p) < 48 ) {
|
835
|
+
if ( 45 <= (*p) && (*p) <= 46 )
|
836
|
+
goto st40;
|
837
|
+
} else if ( (*p) > 57 ) {
|
838
|
+
if ( 65 <= (*p) && (*p) <= 90 )
|
839
|
+
goto st40;
|
840
|
+
} else
|
841
|
+
goto st40;
|
842
|
+
goto st0;
|
843
|
+
st40:
|
844
|
+
if ( ++p == pe )
|
845
|
+
goto _test_eof40;
|
846
|
+
case 40:
|
847
|
+
switch( (*p) ) {
|
848
|
+
case 32: goto tr2;
|
849
|
+
case 36: goto st41;
|
850
|
+
case 95: goto st41;
|
851
|
+
}
|
852
|
+
if ( (*p) < 48 ) {
|
853
|
+
if ( 45 <= (*p) && (*p) <= 46 )
|
854
|
+
goto st41;
|
855
|
+
} else if ( (*p) > 57 ) {
|
856
|
+
if ( 65 <= (*p) && (*p) <= 90 )
|
857
|
+
goto st41;
|
858
|
+
} else
|
859
|
+
goto st41;
|
860
|
+
goto st0;
|
861
|
+
st41:
|
862
|
+
if ( ++p == pe )
|
863
|
+
goto _test_eof41;
|
864
|
+
case 41:
|
865
|
+
switch( (*p) ) {
|
866
|
+
case 32: goto tr2;
|
867
|
+
case 36: goto st42;
|
868
|
+
case 95: goto st42;
|
869
|
+
}
|
870
|
+
if ( (*p) < 48 ) {
|
871
|
+
if ( 45 <= (*p) && (*p) <= 46 )
|
872
|
+
goto st42;
|
873
|
+
} else if ( (*p) > 57 ) {
|
874
|
+
if ( 65 <= (*p) && (*p) <= 90 )
|
875
|
+
goto st42;
|
876
|
+
} else
|
877
|
+
goto st42;
|
878
|
+
goto st0;
|
879
|
+
st42:
|
880
|
+
if ( ++p == pe )
|
881
|
+
goto _test_eof42;
|
882
|
+
case 42:
|
883
|
+
switch( (*p) ) {
|
884
|
+
case 32: goto tr2;
|
885
|
+
case 36: goto st43;
|
886
|
+
case 95: goto st43;
|
887
|
+
}
|
888
|
+
if ( (*p) < 48 ) {
|
889
|
+
if ( 45 <= (*p) && (*p) <= 46 )
|
890
|
+
goto st43;
|
891
|
+
} else if ( (*p) > 57 ) {
|
892
|
+
if ( 65 <= (*p) && (*p) <= 90 )
|
893
|
+
goto st43;
|
894
|
+
} else
|
895
|
+
goto st43;
|
896
|
+
goto st0;
|
897
|
+
st43:
|
898
|
+
if ( ++p == pe )
|
899
|
+
goto _test_eof43;
|
900
|
+
case 43:
|
901
|
+
switch( (*p) ) {
|
902
|
+
case 32: goto tr2;
|
903
|
+
case 36: goto st44;
|
904
|
+
case 95: goto st44;
|
905
|
+
}
|
906
|
+
if ( (*p) < 48 ) {
|
907
|
+
if ( 45 <= (*p) && (*p) <= 46 )
|
908
|
+
goto st44;
|
909
|
+
} else if ( (*p) > 57 ) {
|
910
|
+
if ( 65 <= (*p) && (*p) <= 90 )
|
911
|
+
goto st44;
|
912
|
+
} else
|
913
|
+
goto st44;
|
914
|
+
goto st0;
|
915
|
+
st44:
|
916
|
+
if ( ++p == pe )
|
917
|
+
goto _test_eof44;
|
918
|
+
case 44:
|
919
|
+
switch( (*p) ) {
|
920
|
+
case 32: goto tr2;
|
921
|
+
case 36: goto st45;
|
922
|
+
case 95: goto st45;
|
923
|
+
}
|
924
|
+
if ( (*p) < 48 ) {
|
925
|
+
if ( 45 <= (*p) && (*p) <= 46 )
|
926
|
+
goto st45;
|
927
|
+
} else if ( (*p) > 57 ) {
|
928
|
+
if ( 65 <= (*p) && (*p) <= 90 )
|
929
|
+
goto st45;
|
930
|
+
} else
|
931
|
+
goto st45;
|
932
|
+
goto st0;
|
933
|
+
st45:
|
934
|
+
if ( ++p == pe )
|
935
|
+
goto _test_eof45;
|
936
|
+
case 45:
|
937
|
+
switch( (*p) ) {
|
938
|
+
case 32: goto tr2;
|
939
|
+
case 36: goto st46;
|
940
|
+
case 95: goto st46;
|
941
|
+
}
|
942
|
+
if ( (*p) < 48 ) {
|
943
|
+
if ( 45 <= (*p) && (*p) <= 46 )
|
944
|
+
goto st46;
|
945
|
+
} else if ( (*p) > 57 ) {
|
946
|
+
if ( 65 <= (*p) && (*p) <= 90 )
|
947
|
+
goto st46;
|
948
|
+
} else
|
949
|
+
goto st46;
|
950
|
+
goto st0;
|
951
|
+
st46:
|
952
|
+
if ( ++p == pe )
|
953
|
+
goto _test_eof46;
|
954
|
+
case 46:
|
955
|
+
switch( (*p) ) {
|
956
|
+
case 32: goto tr2;
|
957
|
+
case 36: goto st47;
|
958
|
+
case 95: goto st47;
|
959
|
+
}
|
960
|
+
if ( (*p) < 48 ) {
|
961
|
+
if ( 45 <= (*p) && (*p) <= 46 )
|
962
|
+
goto st47;
|
963
|
+
} else if ( (*p) > 57 ) {
|
964
|
+
if ( 65 <= (*p) && (*p) <= 90 )
|
965
|
+
goto st47;
|
966
|
+
} else
|
967
|
+
goto st47;
|
968
|
+
goto st0;
|
969
|
+
st47:
|
970
|
+
if ( ++p == pe )
|
971
|
+
goto _test_eof47;
|
972
|
+
case 47:
|
973
|
+
switch( (*p) ) {
|
974
|
+
case 32: goto tr2;
|
975
|
+
case 36: goto st48;
|
976
|
+
case 95: goto st48;
|
977
|
+
}
|
978
|
+
if ( (*p) < 48 ) {
|
979
|
+
if ( 45 <= (*p) && (*p) <= 46 )
|
980
|
+
goto st48;
|
981
|
+
} else if ( (*p) > 57 ) {
|
982
|
+
if ( 65 <= (*p) && (*p) <= 90 )
|
983
|
+
goto st48;
|
984
|
+
} else
|
985
|
+
goto st48;
|
986
|
+
goto st0;
|
987
|
+
st48:
|
988
|
+
if ( ++p == pe )
|
989
|
+
goto _test_eof48;
|
990
|
+
case 48:
|
991
|
+
switch( (*p) ) {
|
992
|
+
case 32: goto tr2;
|
993
|
+
case 36: goto st49;
|
994
|
+
case 95: goto st49;
|
995
|
+
}
|
996
|
+
if ( (*p) < 48 ) {
|
997
|
+
if ( 45 <= (*p) && (*p) <= 46 )
|
998
|
+
goto st49;
|
999
|
+
} else if ( (*p) > 57 ) {
|
1000
|
+
if ( 65 <= (*p) && (*p) <= 90 )
|
1001
|
+
goto st49;
|
1002
|
+
} else
|
1003
|
+
goto st49;
|
1004
|
+
goto st0;
|
1005
|
+
st49:
|
1006
|
+
if ( ++p == pe )
|
1007
|
+
goto _test_eof49;
|
1008
|
+
case 49:
|
1009
|
+
switch( (*p) ) {
|
1010
|
+
case 32: goto tr2;
|
1011
|
+
case 36: goto st50;
|
1012
|
+
case 95: goto st50;
|
1013
|
+
}
|
1014
|
+
if ( (*p) < 48 ) {
|
1015
|
+
if ( 45 <= (*p) && (*p) <= 46 )
|
1016
|
+
goto st50;
|
1017
|
+
} else if ( (*p) > 57 ) {
|
1018
|
+
if ( 65 <= (*p) && (*p) <= 90 )
|
1019
|
+
goto st50;
|
1020
|
+
} else
|
1021
|
+
goto st50;
|
1022
|
+
goto st0;
|
1023
|
+
st50:
|
1024
|
+
if ( ++p == pe )
|
1025
|
+
goto _test_eof50;
|
1026
|
+
case 50:
|
1027
|
+
switch( (*p) ) {
|
1028
|
+
case 32: goto tr2;
|
1029
|
+
case 36: goto st51;
|
1030
|
+
case 95: goto st51;
|
1031
|
+
}
|
1032
|
+
if ( (*p) < 48 ) {
|
1033
|
+
if ( 45 <= (*p) && (*p) <= 46 )
|
1034
|
+
goto st51;
|
1035
|
+
} else if ( (*p) > 57 ) {
|
1036
|
+
if ( 65 <= (*p) && (*p) <= 90 )
|
1037
|
+
goto st51;
|
1038
|
+
} else
|
1039
|
+
goto st51;
|
1040
|
+
goto st0;
|
1041
|
+
st51:
|
1042
|
+
if ( ++p == pe )
|
1043
|
+
goto _test_eof51;
|
1044
|
+
case 51:
|
1045
|
+
switch( (*p) ) {
|
1046
|
+
case 32: goto tr2;
|
1047
|
+
case 36: goto st52;
|
1048
|
+
case 95: goto st52;
|
1049
|
+
}
|
1050
|
+
if ( (*p) < 48 ) {
|
1051
|
+
if ( 45 <= (*p) && (*p) <= 46 )
|
1052
|
+
goto st52;
|
1053
|
+
} else if ( (*p) > 57 ) {
|
1054
|
+
if ( 65 <= (*p) && (*p) <= 90 )
|
1055
|
+
goto st52;
|
1056
|
+
} else
|
1057
|
+
goto st52;
|
1058
|
+
goto st0;
|
1059
|
+
st52:
|
1060
|
+
if ( ++p == pe )
|
1061
|
+
goto _test_eof52;
|
1062
|
+
case 52:
|
1063
|
+
switch( (*p) ) {
|
1064
|
+
case 32: goto tr2;
|
1065
|
+
case 36: goto st53;
|
1066
|
+
case 95: goto st53;
|
1067
|
+
}
|
1068
|
+
if ( (*p) < 48 ) {
|
1069
|
+
if ( 45 <= (*p) && (*p) <= 46 )
|
1070
|
+
goto st53;
|
1071
|
+
} else if ( (*p) > 57 ) {
|
1072
|
+
if ( 65 <= (*p) && (*p) <= 90 )
|
1073
|
+
goto st53;
|
1074
|
+
} else
|
1075
|
+
goto st53;
|
1076
|
+
goto st0;
|
1077
|
+
st53:
|
1078
|
+
if ( ++p == pe )
|
1079
|
+
goto _test_eof53;
|
1080
|
+
case 53:
|
1081
|
+
if ( (*p) == 32 )
|
1082
|
+
goto tr2;
|
1083
|
+
goto st0;
|
1084
|
+
}
|
1085
|
+
_test_eof2: cs = 2; goto _test_eof;
|
1086
|
+
_test_eof3: cs = 3; goto _test_eof;
|
1087
|
+
_test_eof4: cs = 4; goto _test_eof;
|
1088
|
+
_test_eof5: cs = 5; goto _test_eof;
|
1089
|
+
_test_eof6: cs = 6; goto _test_eof;
|
1090
|
+
_test_eof7: cs = 7; goto _test_eof;
|
1091
|
+
_test_eof8: cs = 8; goto _test_eof;
|
1092
|
+
_test_eof9: cs = 9; goto _test_eof;
|
1093
|
+
_test_eof10: cs = 10; goto _test_eof;
|
1094
|
+
_test_eof11: cs = 11; goto _test_eof;
|
1095
|
+
_test_eof12: cs = 12; goto _test_eof;
|
1096
|
+
_test_eof13: cs = 13; goto _test_eof;
|
1097
|
+
_test_eof14: cs = 14; goto _test_eof;
|
1098
|
+
_test_eof15: cs = 15; goto _test_eof;
|
1099
|
+
_test_eof16: cs = 16; goto _test_eof;
|
1100
|
+
_test_eof54: cs = 54; goto _test_eof;
|
1101
|
+
_test_eof17: cs = 17; goto _test_eof;
|
1102
|
+
_test_eof18: cs = 18; goto _test_eof;
|
1103
|
+
_test_eof19: cs = 19; goto _test_eof;
|
1104
|
+
_test_eof20: cs = 20; goto _test_eof;
|
1105
|
+
_test_eof21: cs = 21; goto _test_eof;
|
1106
|
+
_test_eof22: cs = 22; goto _test_eof;
|
1107
|
+
_test_eof23: cs = 23; goto _test_eof;
|
1108
|
+
_test_eof24: cs = 24; goto _test_eof;
|
1109
|
+
_test_eof25: cs = 25; goto _test_eof;
|
1110
|
+
_test_eof26: cs = 26; goto _test_eof;
|
1111
|
+
_test_eof27: cs = 27; goto _test_eof;
|
1112
|
+
_test_eof28: cs = 28; goto _test_eof;
|
1113
|
+
_test_eof29: cs = 29; goto _test_eof;
|
1114
|
+
_test_eof30: cs = 30; goto _test_eof;
|
1115
|
+
_test_eof31: cs = 31; goto _test_eof;
|
1116
|
+
_test_eof32: cs = 32; goto _test_eof;
|
1117
|
+
_test_eof33: cs = 33; goto _test_eof;
|
1118
|
+
_test_eof34: cs = 34; goto _test_eof;
|
1119
|
+
_test_eof35: cs = 35; goto _test_eof;
|
1120
|
+
_test_eof36: cs = 36; goto _test_eof;
|
1121
|
+
_test_eof37: cs = 37; goto _test_eof;
|
1122
|
+
_test_eof38: cs = 38; goto _test_eof;
|
1123
|
+
_test_eof39: cs = 39; goto _test_eof;
|
1124
|
+
_test_eof40: cs = 40; goto _test_eof;
|
1125
|
+
_test_eof41: cs = 41; goto _test_eof;
|
1126
|
+
_test_eof42: cs = 42; goto _test_eof;
|
1127
|
+
_test_eof43: cs = 43; goto _test_eof;
|
1128
|
+
_test_eof44: cs = 44; goto _test_eof;
|
1129
|
+
_test_eof45: cs = 45; goto _test_eof;
|
1130
|
+
_test_eof46: cs = 46; goto _test_eof;
|
1131
|
+
_test_eof47: cs = 47; goto _test_eof;
|
1132
|
+
_test_eof48: cs = 48; goto _test_eof;
|
1133
|
+
_test_eof49: cs = 49; goto _test_eof;
|
1134
|
+
_test_eof50: cs = 50; goto _test_eof;
|
1135
|
+
_test_eof51: cs = 51; goto _test_eof;
|
1136
|
+
_test_eof52: cs = 52; goto _test_eof;
|
1137
|
+
_test_eof53: cs = 53; goto _test_eof;
|
1138
|
+
|
1139
|
+
_test_eof: {}
|
1140
|
+
_out: {}
|
1141
|
+
}
|
1142
|
+
|
1143
|
+
#line 116 "parser.rl"
|
1144
|
+
|
1145
|
+
parser->cs = cs;
|
1146
|
+
parser->nread += p - (buffer + off);
|
1147
|
+
|
1148
|
+
assert(p <= pe && "buffer overflow after parsing execute");
|
1149
|
+
assert(parser->nread <= len && "nread longer than length");
|
1150
|
+
assert(parser->body_start <= len && "body starts after buffer end");
|
1151
|
+
assert(parser->mark < len && "mark is after buffer end");
|
1152
|
+
assert(parser->field_len <= len && "field has length longer than whole buffer");
|
1153
|
+
assert(parser->field_start < len && "field starts after buffer end");
|
1154
|
+
|
1155
|
+
if(parser->body_start) {
|
1156
|
+
/* final \r\n combo encountered so stop right here */
|
1157
|
+
parser->nread++;
|
1158
|
+
}
|
1159
|
+
|
1160
|
+
return(parser->nread);
|
1161
|
+
}
|
1162
|
+
|
1163
|
+
int thin_http_parser_finish(http_parser *parser)
|
1164
|
+
{
|
1165
|
+
int cs = parser->cs;
|
1166
|
+
|
1167
|
+
|
1168
|
+
parser->cs = cs;
|
1169
|
+
|
1170
|
+
if (thin_http_parser_has_error(parser) ) {
|
1171
|
+
return -1;
|
1172
|
+
} else if (thin_http_parser_is_finished(parser) ) {
|
1173
|
+
return 1;
|
1174
|
+
} else {
|
1175
|
+
return 0;
|
1176
|
+
}
|
1177
|
+
}
|
1178
|
+
|
1179
|
+
int thin_http_parser_has_error(http_parser *parser) {
|
1180
|
+
return parser->cs == http_parser_error;
|
1181
|
+
}
|
1182
|
+
|
1183
|
+
int thin_http_parser_is_finished(http_parser *parser) {
|
1184
|
+
return parser->cs == http_parser_first_final;
|
1185
|
+
}
|