thin 1.8.0 → 2.0.0.pre
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.
- data/.gitignore +9 -0
- data/CHANGELOG +29 -107
- data/Gemfile +8 -0
- data/README.md +44 -78
- data/Rakefile +28 -18
- data/bin/thin +4 -4
- data/examples/async.ru +21 -0
- data/examples/thin.conf.rb +39 -0
- data/lib/thin.rb +2 -44
- data/lib/thin/async.rb +108 -0
- data/lib/thin/backends/prefork.rb +44 -0
- data/lib/thin/backends/single_process.rb +28 -0
- data/lib/thin/chunked_body.rb +28 -0
- data/lib/thin/configurator.rb +118 -0
- data/lib/thin/connection.rb +246 -172
- data/lib/thin/listener.rb +114 -0
- data/lib/thin/request.rb +94 -76
- data/lib/thin/response.rb +112 -45
- data/lib/thin/runner.rb +134 -197
- data/lib/thin/server.rb +203 -252
- data/lib/thin/system.rb +49 -0
- data/lib/thin/version.rb +11 -26
- data/man/index.txt +3 -0
- data/man/thin-conf.5.ronn +121 -0
- data/man/thin.1.ronn +105 -0
- data/site/.gitignore +2 -0
- data/site/README.md +21 -0
- data/site/Rakefile +20 -0
- data/site/config.ru +4 -0
- data/site/public/images/grid.png +0 -0
- data/site/public/javascripts/dd_belatedpng.js +13 -0
- data/site/public/javascripts/modernizr-1.6.min.js +30 -0
- data/site/public/man/thin-conf.5.html +220 -0
- data/site/public/man/thin.1.html +177 -0
- data/site/site/assets/javascripts/main.coffee +2 -0
- data/site/site/assets/stylesheets/_config.scss +55 -0
- data/site/site/assets/stylesheets/main.scss +24 -0
- data/site/site/helpers.rb +17 -0
- data/site/site/layouts/base.erb +55 -0
- data/site/site/layouts/default.erb +17 -0
- data/site/site/pages/about.md +5 -0
- data/site/site/pages/index.erb +10 -0
- data/site/site/partials/.gitkeep +0 -0
- data/test/fixtures/big.txt +1 -0
- data/test/fixtures/small.txt +1 -0
- data/test/fixtures/thin.conf.rb +15 -0
- data/test/integration/async_test.rb +35 -0
- data/test/integration/big_request_test.rb +30 -0
- data/test/integration/config.ru +57 -0
- data/test/integration/daemonize_test.rb +26 -0
- data/test/integration/env_test.rb +44 -0
- data/test/integration/error_test.rb +37 -0
- data/test/integration/file_sending_test.rb +24 -0
- data/test/integration/keep_alive_test.rb +35 -0
- data/test/integration/robustness_test.rb +37 -0
- data/test/integration/single_process_test.rb +15 -0
- data/test/integration/socket_family_test.rb +38 -0
- data/test/integration/worker_test.rb +22 -0
- data/test/test_helper.rb +195 -0
- data/test/unit/configurator_test.rb +43 -0
- data/test/unit/connection_test.rb +94 -0
- data/test/unit/listener_test.rb +74 -0
- data/test/unit/request_test.rb +74 -0
- data/test/unit/response_test.rb +90 -0
- data/test/unit/server_test.rb +29 -0
- data/test/unit/system_test.rb +17 -0
- data/thin.gemspec +26 -0
- data/v2.todo +21 -0
- metadata +138 -93
- checksums.yaml +0 -7
- data/example/adapter.rb +0 -32
- data/example/async_app.ru +0 -126
- data/example/async_chat.ru +0 -247
- data/example/async_tailer.ru +0 -100
- data/example/config.ru +0 -22
- data/example/monit_sockets +0 -20
- data/example/monit_unixsock +0 -20
- data/example/myapp.rb +0 -1
- data/example/ramaze.ru +0 -12
- data/example/thin.god +0 -80
- data/example/thin_solaris_smf.erb +0 -36
- data/example/thin_solaris_smf.readme.txt +0 -150
- data/example/vlad.rake +0 -72
- data/ext/thin_parser/common.rl +0 -59
- data/ext/thin_parser/ext_help.h +0 -14
- data/ext/thin_parser/extconf.rb +0 -6
- data/ext/thin_parser/parser.c +0 -1447
- data/ext/thin_parser/parser.h +0 -49
- data/ext/thin_parser/parser.rl +0 -152
- data/ext/thin_parser/thin.c +0 -435
- data/lib/rack/adapter/loader.rb +0 -75
- data/lib/rack/adapter/rails.rb +0 -178
- data/lib/rack/handler/thin.rb +0 -38
- data/lib/thin/backends/base.rb +0 -169
- data/lib/thin/backends/swiftiply_client.rb +0 -56
- data/lib/thin/backends/tcp_server.rb +0 -34
- data/lib/thin/backends/unix_server.rb +0 -56
- data/lib/thin/command.rb +0 -53
- data/lib/thin/controllers/cluster.rb +0 -178
- data/lib/thin/controllers/controller.rb +0 -189
- data/lib/thin/controllers/service.rb +0 -76
- data/lib/thin/controllers/service.sh.erb +0 -39
- data/lib/thin/daemonizing.rb +0 -199
- data/lib/thin/headers.rb +0 -40
- data/lib/thin/logging.rb +0 -174
- data/lib/thin/stats.html.erb +0 -216
- data/lib/thin/stats.rb +0 -52
- data/lib/thin/statuses.rb +0 -48
@@ -1,36 +0,0 @@
|
|
1
|
-
<?xml version='1.0'?>
|
2
|
-
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
|
3
|
-
<service_bundle type='manifest' name='thin/<%= service_name %>-production'>
|
4
|
-
<service name='network/thin/<%= service_name %>-production' type='service' version='0'>
|
5
|
-
<!-- Dependancies for all Thin servers. -->
|
6
|
-
<dependency name='fs' grouping='require_all' restart_on='none' type='service'>
|
7
|
-
<service_fmri value='svc:/system/filesystem/local'/>
|
8
|
-
</dependency>
|
9
|
-
<dependency name='net' grouping='require_all' restart_on='none' type='service'>
|
10
|
-
<service_fmri value='svc:/network/loopback'/>
|
11
|
-
<!-- uncomment the following line if you are on an L+ Accelerator since /home is mounted through nfs -->
|
12
|
-
<!--<service_fmri value='svc:/network/nfs/client'/>-->
|
13
|
-
</dependency>
|
14
|
-
<% 0.upto(thin_max_instances - 1) do |instance| %>
|
15
|
-
<!-- instance names can't start with digits. Bummer. -->
|
16
|
-
<instance name='i_<%= instance.to_s %>' enabled='false'>
|
17
|
-
<!-- Cause the multi-user milestone to bring these services up -->
|
18
|
-
<dependent name='<%= service_name %>_<%= instance.to_s %>_multi-user' restart_on='none' grouping='optional_all'>
|
19
|
-
<service_fmri value='svc:/milestone/multi-user'/>
|
20
|
-
</dependent>
|
21
|
-
<exec_method name='start' type='method'
|
22
|
-
exec='/opt/csw/bin/thin -C config/thin.yml --only <%= instance.to_s %> start'
|
23
|
-
timeout_seconds='10'>
|
24
|
-
<method_context working_directory='<%= working_directory %>'>
|
25
|
-
<method_credential user='<%= user %>' group='<%= group %>' />
|
26
|
-
<method_environment>
|
27
|
-
<envvar name='PATH' value='/usr/bin:/bin:/opt/csw/bin' />
|
28
|
-
</method_environment>
|
29
|
-
</method_context>
|
30
|
-
</exec_method>
|
31
|
-
<exec_method name='stop' type='method' exec=':kill' timeout_seconds='10' />
|
32
|
-
</instance>
|
33
|
-
<% end %>
|
34
|
-
</service>
|
35
|
-
</service_bundle>
|
36
|
-
|
@@ -1,150 +0,0 @@
|
|
1
|
-
Using Thin with Solaris' SMF Monitoring Framework
|
2
|
-
- - - - - - - - - - - - - - - - - - - - - - - - -
|
3
|
-
|
4
|
-
Solaris uses the Service Management Framework (SMF) at the OS level to manage, monitor, and restart long running processes. This replaces init scripts, and tools like monit and god.
|
5
|
-
|
6
|
-
The sample XML file (thin_solaris_smf.erb) is an example SMF manifest which I use on a Joyent accelerator which runs on OpenSolaris.
|
7
|
-
|
8
|
-
This setup will:
|
9
|
-
|
10
|
-
- ensure the right dependencies are loaded
|
11
|
-
- start n instances of Thin, and monitor each individually. If any single one dies it will be restarted instantly (test it by killing a single thin instance and it will be back alive before you can type 'ps -ef').
|
12
|
-
|
13
|
-
This is better than using clustering since if you start the cluster with SMF it will only notice a problem and restart individual Thin's if ALL of them are dead, at which point it will restart the whole cluster. This approach makes sure that all of your Thins start together and are monitored and managed independant of each other. This problem likely exists if you are using god or monit to monitor only the start of the master cluster, and don't then monitor the individual processes started.
|
14
|
-
|
15
|
-
This example is in .erb format instead of plain XML since I dynamically generate this file as part of a Capistrano deployment. In my deploy.rb file I define the variables found in this erb. Of course you don't need to use this with Capistrano. Just replace the few ERB variables from the xml file, change its extension, and load that directly in Solaris if you prefer.
|
16
|
-
|
17
|
-
Here are some examples for usage to get you started with Capistrano, and Thin:
|
18
|
-
|
19
|
-
FILE : config/deploy.rb
|
20
|
-
--
|
21
|
-
|
22
|
-
require 'config/accelerator/accelerator_tasks'
|
23
|
-
|
24
|
-
set :application, "yourapp"
|
25
|
-
set :svcadm_bin, "/usr/sbin/svcadm"
|
26
|
-
set :svccfg_bin, "/usr/sbin/svccfg"
|
27
|
-
set :svcs_bin, "/usr/bin/svcs"
|
28
|
-
|
29
|
-
# gets the list of remote service SMF names that we need to start
|
30
|
-
# like (depending on thin_max_instances settings):
|
31
|
-
# svc:/network/thin/yourapp-production:i_0
|
32
|
-
# svc:/network/thin/yourapp-production:i_1
|
33
|
-
# svc:/network/thin/yourapp-production:i_2
|
34
|
-
set :service_list, "`svcs -H -o FMRI svc:network/thin/#{application}-production`"
|
35
|
-
|
36
|
-
# how many Thin instances should be setup to run?
|
37
|
-
# this affects the generated thin smf file, and the nginx vhost conf
|
38
|
-
# need to re-run setup for thin smf and nginx vhost conf when changed
|
39
|
-
set :thin_max_instances, 3
|
40
|
-
|
41
|
-
# OVERRIDE STANDARD TASKS
|
42
|
-
desc "Restart the entire application"
|
43
|
-
deploy.task :restart do
|
44
|
-
accelerator.thin.restart
|
45
|
-
accelerator.nginx.restart
|
46
|
-
end
|
47
|
-
|
48
|
-
desc "Start the entire application"
|
49
|
-
deploy.task :start do
|
50
|
-
accelerator.thin.restart
|
51
|
-
accelerator.nginx.restart
|
52
|
-
end
|
53
|
-
|
54
|
-
desc "Stop the entire application"
|
55
|
-
deploy.task :stop do
|
56
|
-
accelerator.thin.disable
|
57
|
-
accelerator.nginx.disable
|
58
|
-
end
|
59
|
-
|
60
|
-
|
61
|
-
FILE : config/accelerator/accelerator_tasks.rb
|
62
|
-
--
|
63
|
-
|
64
|
-
desc "Create and deploy Thin SMF config"
|
65
|
-
task :create_thin_smf, :roles => :app do
|
66
|
-
service_name = application
|
67
|
-
working_directory = current_path
|
68
|
-
template = File.read("config/accelerator/thin_solaris_smf.erb")
|
69
|
-
buffer = ERB.new(template).result(binding)
|
70
|
-
put buffer, "#{shared_path}/#{application}-thin-smf.xml"
|
71
|
-
sudo "#{svccfg_bin} import #{shared_path}/#{application}-thin-smf.xml"
|
72
|
-
end
|
73
|
-
|
74
|
-
desc "Delete Thin SMF config"
|
75
|
-
task :delete_thin_smf, :roles => :app do
|
76
|
-
accelerator.thin.disable
|
77
|
-
sudo "#{svccfg_bin} delete /network/thin/#{application}-production"
|
78
|
-
end
|
79
|
-
|
80
|
-
desc "Show all SMF services"
|
81
|
-
task :svcs do
|
82
|
-
run "#{svcs_bin} -a" do |ch, st, data|
|
83
|
-
puts data
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
desc "Shows all non-functional SMF services"
|
88
|
-
task :svcs_broken do
|
89
|
-
run "#{svcs_bin} -vx" do |ch, st, data|
|
90
|
-
puts data
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
|
95
|
-
namespace :thin do
|
96
|
-
|
97
|
-
desc "Disable all Thin servers"
|
98
|
-
task :disable, :roles => :app do
|
99
|
-
# temporarily disable, until next reboot (-t)
|
100
|
-
sudo "#{svcadm_bin} disable -t #{service_list}"
|
101
|
-
end
|
102
|
-
|
103
|
-
desc "Enable all Thin servers"
|
104
|
-
task :enable, :roles => :app do
|
105
|
-
# start the app with all recursive dependencies
|
106
|
-
sudo "#{svcadm_bin} enable -r #{service_list}"
|
107
|
-
end
|
108
|
-
|
109
|
-
desc "Restart all Thin servers"
|
110
|
-
task :restart, :roles => :app do
|
111
|
-
# svcadm restart doesn't seem to work right, so we'll brute force it
|
112
|
-
disable
|
113
|
-
enable
|
114
|
-
end
|
115
|
-
|
116
|
-
end # namespace thin
|
117
|
-
|
118
|
-
|
119
|
-
FILE : config/thin.yml
|
120
|
-
--
|
121
|
-
|
122
|
-
---
|
123
|
-
pid: tmp/pids/thin.pid
|
124
|
-
socket: /tmp/thin.sock
|
125
|
-
log: log/thin.log
|
126
|
-
max_conns: 1024
|
127
|
-
timeout: 30
|
128
|
-
chdir: /your/app/dir/rails/root
|
129
|
-
environment: production
|
130
|
-
max_persistent_conns: 512
|
131
|
-
daemonize: true
|
132
|
-
servers: 3
|
133
|
-
|
134
|
-
|
135
|
-
FILE : config/accelerator/thin_solaris_smf.erb
|
136
|
-
--
|
137
|
-
This is of course an example. It works for me, but YMMV
|
138
|
-
|
139
|
-
You may need to change this line to match your environment and config:
|
140
|
-
exec='/opt/csw/bin/thin -C config/thin.yml --only <%= instance.to_s %> start'
|
141
|
-
|
142
|
-
|
143
|
-
CONTRIBUTE:
|
144
|
-
|
145
|
-
If you see problems or enhancements for this approach please send me an email at glenn [at] rempe dot us. Sadly, I won't be able to provide support for this example as time and my limited Solaris admin skills won't allow.
|
146
|
-
|
147
|
-
Cheers,
|
148
|
-
|
149
|
-
Glenn Rempe
|
150
|
-
2008/03/20
|
data/example/vlad.rake
DELETED
@@ -1,72 +0,0 @@
|
|
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, nil
|
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
|
-
set :thin_uses_bundler, true
|
24
|
-
|
25
|
-
desc "Prepares application servers for deployment. thin
|
26
|
-
configuration is set via the thin_* variables.".cleanup
|
27
|
-
|
28
|
-
remote_task :setup_app, :roles => :app do
|
29
|
-
|
30
|
-
raise(ArgumentError, "Please provide either thin_socket or thin_port") if thin_port.nil? && thin_socket.nil?
|
31
|
-
|
32
|
-
cmd = [
|
33
|
-
"config",
|
34
|
-
(%(-s "#{thin_servers}") if thin_servers),
|
35
|
-
(%(-S "#{thin_socket}") if thin_socket),
|
36
|
-
(%(-e "#{thin_environment}") if thin_environment),
|
37
|
-
(%(-a "#{thin_address}") if thin_address),
|
38
|
-
%(-c "#{current_path}"),
|
39
|
-
(%(-C "#{thin_conf}") if thin_conf),
|
40
|
-
(%(-P "#{thin_pid_file}") if thin_pid_file),
|
41
|
-
(%(-l "#{thin_log_file}") if thin_log_file),
|
42
|
-
(%(--user "#{thin_user}") if thin_user),
|
43
|
-
(%(--group "#{thin_group}") if thin_group),
|
44
|
-
(%(--prefix "#{thin_prefix}") if thin_prefix),
|
45
|
-
(%(-p "#{thin_port}") if thin_port),
|
46
|
-
].compact.join ' '
|
47
|
-
|
48
|
-
thin(cmd)
|
49
|
-
end
|
50
|
-
|
51
|
-
def thin(cmd) # :nodoc:
|
52
|
-
command = if thin_uses_bundler
|
53
|
-
%(BUNDLE_GEMFILE="#{current_path}/Gemfile" bundle exec #{thin_command} #{cmd} -C "#{thin_conf}")
|
54
|
-
else
|
55
|
-
%(#{thin_command} #{cmd} -C "#{thin_conf}")
|
56
|
-
end
|
57
|
-
|
58
|
-
%(cd "#{current_path}" && #{command})
|
59
|
-
end
|
60
|
-
|
61
|
-
desc "Restart the app servers"
|
62
|
-
|
63
|
-
remote_task :start_app, :roles => :app do
|
64
|
-
run thin(%(restart -O -s "#{thin_servers}"))
|
65
|
-
end
|
66
|
-
|
67
|
-
desc "Stop the app servers"
|
68
|
-
|
69
|
-
remote_task :stop_app, :roles => :app do
|
70
|
-
run thin(%(stop -s "#{thin_servers}"))
|
71
|
-
end
|
72
|
-
end
|
data/ext/thin_parser/common.rl
DELETED
@@ -1,59 +0,0 @@
|
|
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 = ("%" "u"? 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 = ( "http"i ("s"i)? );
|
28
|
-
hostname = ((alnum | "-" | "." | "_")+ | ("[" (":" | xdigit)+ "]"));
|
29
|
-
host_with_port = (hostname (":" digit*)?);
|
30
|
-
userinfo = ((unreserved | escape | ";" | ":" | "&" | "=" | "+")+ "@")*;
|
31
|
-
|
32
|
-
path = ( pchar+ ( "/" pchar* )* ) ;
|
33
|
-
query = ( uchar | reserved )* %query_string ;
|
34
|
-
param = ( pchar | "/" )* ;
|
35
|
-
params = ( param ( ";" param )* ) ;
|
36
|
-
rel_path = (path? (";" params)? %request_path) ("?" %start_query query)?;
|
37
|
-
absolute_path = ( "/"+ rel_path );
|
38
|
-
path_uri = absolute_path > mark %request_uri;
|
39
|
-
Absolute_URI = (scheme "://" userinfo host_with_port path_uri);
|
40
|
-
|
41
|
-
Request_URI = ((absolute_path | "*") >mark %request_uri) | Absolute_URI;
|
42
|
-
Fragment = ( uchar | reserved )* >mark %fragment;
|
43
|
-
Method = ( upper | digit | safe ){1,20} >mark %request_method;
|
44
|
-
|
45
|
-
http_number = ( digit+ "." digit+ ) ;
|
46
|
-
HTTP_Version = ( "HTTP/" http_number ) >mark %http_version ;
|
47
|
-
Request_Line = ( Method " " Request_URI ("#" Fragment){0,1} " " HTTP_Version CRLF ) ;
|
48
|
-
|
49
|
-
field_name = ( token -- ":" )+ >start_field %write_field;
|
50
|
-
|
51
|
-
field_value = any* >start_value %write_value;
|
52
|
-
|
53
|
-
message_header = field_name ":" " "* field_value :> CRLF;
|
54
|
-
|
55
|
-
Request = Request_Line ( message_header )* ( CRLF @done );
|
56
|
-
|
57
|
-
main := Request;
|
58
|
-
|
59
|
-
}%%
|
data/ext/thin_parser/ext_help.h
DELETED
@@ -1,14 +0,0 @@
|
|
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
|
data/ext/thin_parser/extconf.rb
DELETED
data/ext/thin_parser/parser.c
DELETED
@@ -1,1447 +0,0 @@
|
|
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 = 70;
|
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 == (long)(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 st51;
|
107
|
-
case 95: goto st51;
|
108
|
-
}
|
109
|
-
if ( (*p) < 48 ) {
|
110
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
111
|
-
goto st51;
|
112
|
-
} else if ( (*p) > 57 ) {
|
113
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
114
|
-
goto st51;
|
115
|
-
} else
|
116
|
-
goto st51;
|
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 47: goto tr5;
|
134
|
-
case 72: goto st34;
|
135
|
-
case 104: goto st34;
|
136
|
-
}
|
137
|
-
goto st0;
|
138
|
-
tr4:
|
139
|
-
#line 22 "parser.rl"
|
140
|
-
{MARK(mark, p); }
|
141
|
-
goto st4;
|
142
|
-
st4:
|
143
|
-
if ( ++p == pe )
|
144
|
-
goto _test_eof4;
|
145
|
-
case 4:
|
146
|
-
#line 147 "parser.c"
|
147
|
-
switch( (*p) ) {
|
148
|
-
case 32: goto tr7;
|
149
|
-
case 35: goto tr8;
|
150
|
-
}
|
151
|
-
goto st0;
|
152
|
-
tr7:
|
153
|
-
#line 41 "parser.rl"
|
154
|
-
{
|
155
|
-
if (parser->request_uri != NULL) {
|
156
|
-
parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
|
157
|
-
}
|
158
|
-
}
|
159
|
-
goto st5;
|
160
|
-
tr30:
|
161
|
-
#line 22 "parser.rl"
|
162
|
-
{MARK(mark, p); }
|
163
|
-
#line 46 "parser.rl"
|
164
|
-
{
|
165
|
-
if (parser->fragment != NULL) {
|
166
|
-
parser->fragment(parser->data, PTR_TO(mark), LEN(mark, p));
|
167
|
-
}
|
168
|
-
}
|
169
|
-
goto st5;
|
170
|
-
tr33:
|
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
|
-
tr38:
|
179
|
-
#line 65 "parser.rl"
|
180
|
-
{
|
181
|
-
if (parser->request_path != NULL) {
|
182
|
-
parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
|
183
|
-
}
|
184
|
-
}
|
185
|
-
#line 41 "parser.rl"
|
186
|
-
{
|
187
|
-
if (parser->request_uri != NULL) {
|
188
|
-
parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
|
189
|
-
}
|
190
|
-
}
|
191
|
-
goto st5;
|
192
|
-
tr45:
|
193
|
-
#line 52 "parser.rl"
|
194
|
-
{MARK(query_start, p); }
|
195
|
-
#line 53 "parser.rl"
|
196
|
-
{
|
197
|
-
if (parser->query_string != NULL) {
|
198
|
-
parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
|
199
|
-
}
|
200
|
-
}
|
201
|
-
#line 41 "parser.rl"
|
202
|
-
{
|
203
|
-
if (parser->request_uri != NULL) {
|
204
|
-
parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
|
205
|
-
}
|
206
|
-
}
|
207
|
-
goto st5;
|
208
|
-
tr49:
|
209
|
-
#line 53 "parser.rl"
|
210
|
-
{
|
211
|
-
if (parser->query_string != NULL) {
|
212
|
-
parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
|
213
|
-
}
|
214
|
-
}
|
215
|
-
#line 41 "parser.rl"
|
216
|
-
{
|
217
|
-
if (parser->request_uri != NULL) {
|
218
|
-
parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
|
219
|
-
}
|
220
|
-
}
|
221
|
-
goto st5;
|
222
|
-
st5:
|
223
|
-
if ( ++p == pe )
|
224
|
-
goto _test_eof5;
|
225
|
-
case 5:
|
226
|
-
#line 227 "parser.c"
|
227
|
-
if ( (*p) == 72 )
|
228
|
-
goto tr9;
|
229
|
-
goto st0;
|
230
|
-
tr9:
|
231
|
-
#line 22 "parser.rl"
|
232
|
-
{MARK(mark, p); }
|
233
|
-
goto st6;
|
234
|
-
st6:
|
235
|
-
if ( ++p == pe )
|
236
|
-
goto _test_eof6;
|
237
|
-
case 6:
|
238
|
-
#line 239 "parser.c"
|
239
|
-
if ( (*p) == 84 )
|
240
|
-
goto st7;
|
241
|
-
goto st0;
|
242
|
-
st7:
|
243
|
-
if ( ++p == pe )
|
244
|
-
goto _test_eof7;
|
245
|
-
case 7:
|
246
|
-
if ( (*p) == 84 )
|
247
|
-
goto st8;
|
248
|
-
goto st0;
|
249
|
-
st8:
|
250
|
-
if ( ++p == pe )
|
251
|
-
goto _test_eof8;
|
252
|
-
case 8:
|
253
|
-
if ( (*p) == 80 )
|
254
|
-
goto st9;
|
255
|
-
goto st0;
|
256
|
-
st9:
|
257
|
-
if ( ++p == pe )
|
258
|
-
goto _test_eof9;
|
259
|
-
case 9:
|
260
|
-
if ( (*p) == 47 )
|
261
|
-
goto st10;
|
262
|
-
goto st0;
|
263
|
-
st10:
|
264
|
-
if ( ++p == pe )
|
265
|
-
goto _test_eof10;
|
266
|
-
case 10:
|
267
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
268
|
-
goto st11;
|
269
|
-
goto st0;
|
270
|
-
st11:
|
271
|
-
if ( ++p == pe )
|
272
|
-
goto _test_eof11;
|
273
|
-
case 11:
|
274
|
-
if ( (*p) == 46 )
|
275
|
-
goto st12;
|
276
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
277
|
-
goto st11;
|
278
|
-
goto st0;
|
279
|
-
st12:
|
280
|
-
if ( ++p == pe )
|
281
|
-
goto _test_eof12;
|
282
|
-
case 12:
|
283
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
284
|
-
goto st13;
|
285
|
-
goto st0;
|
286
|
-
st13:
|
287
|
-
if ( ++p == pe )
|
288
|
-
goto _test_eof13;
|
289
|
-
case 13:
|
290
|
-
if ( (*p) == 13 )
|
291
|
-
goto tr17;
|
292
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
293
|
-
goto st13;
|
294
|
-
goto st0;
|
295
|
-
tr17:
|
296
|
-
#line 59 "parser.rl"
|
297
|
-
{
|
298
|
-
if (parser->http_version != NULL) {
|
299
|
-
parser->http_version(parser->data, PTR_TO(mark), LEN(mark, p));
|
300
|
-
}
|
301
|
-
}
|
302
|
-
goto st14;
|
303
|
-
tr25:
|
304
|
-
#line 30 "parser.rl"
|
305
|
-
{ MARK(mark, p); }
|
306
|
-
#line 31 "parser.rl"
|
307
|
-
{
|
308
|
-
if (parser->http_field != NULL) {
|
309
|
-
parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
|
310
|
-
}
|
311
|
-
}
|
312
|
-
goto st14;
|
313
|
-
tr28:
|
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
|
-
st14:
|
322
|
-
if ( ++p == pe )
|
323
|
-
goto _test_eof14;
|
324
|
-
case 14:
|
325
|
-
#line 326 "parser.c"
|
326
|
-
if ( (*p) == 10 )
|
327
|
-
goto st15;
|
328
|
-
goto st0;
|
329
|
-
st15:
|
330
|
-
if ( ++p == pe )
|
331
|
-
goto _test_eof15;
|
332
|
-
case 15:
|
333
|
-
switch( (*p) ) {
|
334
|
-
case 13: goto st16;
|
335
|
-
case 33: goto tr20;
|
336
|
-
case 124: goto tr20;
|
337
|
-
case 126: goto tr20;
|
338
|
-
}
|
339
|
-
if ( (*p) < 45 ) {
|
340
|
-
if ( (*p) > 39 ) {
|
341
|
-
if ( 42 <= (*p) && (*p) <= 43 )
|
342
|
-
goto tr20;
|
343
|
-
} else if ( (*p) >= 35 )
|
344
|
-
goto tr20;
|
345
|
-
} else if ( (*p) > 46 ) {
|
346
|
-
if ( (*p) < 65 ) {
|
347
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
348
|
-
goto tr20;
|
349
|
-
} else if ( (*p) > 90 ) {
|
350
|
-
if ( 94 <= (*p) && (*p) <= 122 )
|
351
|
-
goto tr20;
|
352
|
-
} else
|
353
|
-
goto tr20;
|
354
|
-
} else
|
355
|
-
goto tr20;
|
356
|
-
goto st0;
|
357
|
-
st16:
|
358
|
-
if ( ++p == pe )
|
359
|
-
goto _test_eof16;
|
360
|
-
case 16:
|
361
|
-
if ( (*p) == 10 )
|
362
|
-
goto tr21;
|
363
|
-
goto st0;
|
364
|
-
tr21:
|
365
|
-
#line 71 "parser.rl"
|
366
|
-
{
|
367
|
-
parser->body_start = p - buffer + 1;
|
368
|
-
if (parser->header_done != NULL) {
|
369
|
-
parser->header_done(parser->data, p + 1, pe - p - 1);
|
370
|
-
}
|
371
|
-
{p++; cs = 70; goto _out;}
|
372
|
-
}
|
373
|
-
goto st70;
|
374
|
-
st70:
|
375
|
-
if ( ++p == pe )
|
376
|
-
goto _test_eof70;
|
377
|
-
case 70:
|
378
|
-
#line 379 "parser.c"
|
379
|
-
goto st0;
|
380
|
-
tr20:
|
381
|
-
#line 25 "parser.rl"
|
382
|
-
{ MARK(field_start, p); }
|
383
|
-
goto st17;
|
384
|
-
st17:
|
385
|
-
if ( ++p == pe )
|
386
|
-
goto _test_eof17;
|
387
|
-
case 17:
|
388
|
-
#line 389 "parser.c"
|
389
|
-
switch( (*p) ) {
|
390
|
-
case 33: goto st17;
|
391
|
-
case 58: goto tr23;
|
392
|
-
case 124: goto st17;
|
393
|
-
case 126: goto st17;
|
394
|
-
}
|
395
|
-
if ( (*p) < 45 ) {
|
396
|
-
if ( (*p) > 39 ) {
|
397
|
-
if ( 42 <= (*p) && (*p) <= 43 )
|
398
|
-
goto st17;
|
399
|
-
} else if ( (*p) >= 35 )
|
400
|
-
goto st17;
|
401
|
-
} else if ( (*p) > 46 ) {
|
402
|
-
if ( (*p) < 65 ) {
|
403
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
404
|
-
goto st17;
|
405
|
-
} else if ( (*p) > 90 ) {
|
406
|
-
if ( 94 <= (*p) && (*p) <= 122 )
|
407
|
-
goto st17;
|
408
|
-
} else
|
409
|
-
goto st17;
|
410
|
-
} else
|
411
|
-
goto st17;
|
412
|
-
goto st0;
|
413
|
-
tr23:
|
414
|
-
#line 26 "parser.rl"
|
415
|
-
{
|
416
|
-
parser->field_len = LEN(field_start, p);
|
417
|
-
}
|
418
|
-
goto st18;
|
419
|
-
tr26:
|
420
|
-
#line 30 "parser.rl"
|
421
|
-
{ MARK(mark, p); }
|
422
|
-
goto st18;
|
423
|
-
st18:
|
424
|
-
if ( ++p == pe )
|
425
|
-
goto _test_eof18;
|
426
|
-
case 18:
|
427
|
-
#line 428 "parser.c"
|
428
|
-
switch( (*p) ) {
|
429
|
-
case 13: goto tr25;
|
430
|
-
case 32: goto tr26;
|
431
|
-
}
|
432
|
-
goto tr24;
|
433
|
-
tr24:
|
434
|
-
#line 30 "parser.rl"
|
435
|
-
{ MARK(mark, p); }
|
436
|
-
goto st19;
|
437
|
-
st19:
|
438
|
-
if ( ++p == pe )
|
439
|
-
goto _test_eof19;
|
440
|
-
case 19:
|
441
|
-
#line 442 "parser.c"
|
442
|
-
if ( (*p) == 13 )
|
443
|
-
goto tr28;
|
444
|
-
goto st19;
|
445
|
-
tr8:
|
446
|
-
#line 41 "parser.rl"
|
447
|
-
{
|
448
|
-
if (parser->request_uri != NULL) {
|
449
|
-
parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
|
450
|
-
}
|
451
|
-
}
|
452
|
-
goto st20;
|
453
|
-
tr39:
|
454
|
-
#line 65 "parser.rl"
|
455
|
-
{
|
456
|
-
if (parser->request_path != NULL) {
|
457
|
-
parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
|
458
|
-
}
|
459
|
-
}
|
460
|
-
#line 41 "parser.rl"
|
461
|
-
{
|
462
|
-
if (parser->request_uri != NULL) {
|
463
|
-
parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
|
464
|
-
}
|
465
|
-
}
|
466
|
-
goto st20;
|
467
|
-
tr46:
|
468
|
-
#line 52 "parser.rl"
|
469
|
-
{MARK(query_start, p); }
|
470
|
-
#line 53 "parser.rl"
|
471
|
-
{
|
472
|
-
if (parser->query_string != NULL) {
|
473
|
-
parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
|
474
|
-
}
|
475
|
-
}
|
476
|
-
#line 41 "parser.rl"
|
477
|
-
{
|
478
|
-
if (parser->request_uri != NULL) {
|
479
|
-
parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
|
480
|
-
}
|
481
|
-
}
|
482
|
-
goto st20;
|
483
|
-
tr50:
|
484
|
-
#line 53 "parser.rl"
|
485
|
-
{
|
486
|
-
if (parser->query_string != NULL) {
|
487
|
-
parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
|
488
|
-
}
|
489
|
-
}
|
490
|
-
#line 41 "parser.rl"
|
491
|
-
{
|
492
|
-
if (parser->request_uri != NULL) {
|
493
|
-
parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
|
494
|
-
}
|
495
|
-
}
|
496
|
-
goto st20;
|
497
|
-
st20:
|
498
|
-
if ( ++p == pe )
|
499
|
-
goto _test_eof20;
|
500
|
-
case 20:
|
501
|
-
#line 502 "parser.c"
|
502
|
-
switch( (*p) ) {
|
503
|
-
case 32: goto tr30;
|
504
|
-
case 35: goto st0;
|
505
|
-
case 37: goto tr31;
|
506
|
-
case 127: goto st0;
|
507
|
-
}
|
508
|
-
if ( 0 <= (*p) && (*p) <= 31 )
|
509
|
-
goto st0;
|
510
|
-
goto tr29;
|
511
|
-
tr29:
|
512
|
-
#line 22 "parser.rl"
|
513
|
-
{MARK(mark, p); }
|
514
|
-
goto st21;
|
515
|
-
st21:
|
516
|
-
if ( ++p == pe )
|
517
|
-
goto _test_eof21;
|
518
|
-
case 21:
|
519
|
-
#line 520 "parser.c"
|
520
|
-
switch( (*p) ) {
|
521
|
-
case 32: goto tr33;
|
522
|
-
case 35: goto st0;
|
523
|
-
case 37: goto st22;
|
524
|
-
case 127: goto st0;
|
525
|
-
}
|
526
|
-
if ( 0 <= (*p) && (*p) <= 31 )
|
527
|
-
goto st0;
|
528
|
-
goto st21;
|
529
|
-
tr31:
|
530
|
-
#line 22 "parser.rl"
|
531
|
-
{MARK(mark, p); }
|
532
|
-
goto st22;
|
533
|
-
st22:
|
534
|
-
if ( ++p == pe )
|
535
|
-
goto _test_eof22;
|
536
|
-
case 22:
|
537
|
-
#line 538 "parser.c"
|
538
|
-
if ( (*p) == 117 )
|
539
|
-
goto st24;
|
540
|
-
if ( (*p) < 65 ) {
|
541
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
542
|
-
goto st23;
|
543
|
-
} else if ( (*p) > 70 ) {
|
544
|
-
if ( 97 <= (*p) && (*p) <= 102 )
|
545
|
-
goto st23;
|
546
|
-
} else
|
547
|
-
goto st23;
|
548
|
-
goto st0;
|
549
|
-
st23:
|
550
|
-
if ( ++p == pe )
|
551
|
-
goto _test_eof23;
|
552
|
-
case 23:
|
553
|
-
if ( (*p) < 65 ) {
|
554
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
555
|
-
goto st21;
|
556
|
-
} else if ( (*p) > 70 ) {
|
557
|
-
if ( 97 <= (*p) && (*p) <= 102 )
|
558
|
-
goto st21;
|
559
|
-
} else
|
560
|
-
goto st21;
|
561
|
-
goto st0;
|
562
|
-
st24:
|
563
|
-
if ( ++p == pe )
|
564
|
-
goto _test_eof24;
|
565
|
-
case 24:
|
566
|
-
if ( (*p) < 65 ) {
|
567
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
568
|
-
goto st23;
|
569
|
-
} else if ( (*p) > 70 ) {
|
570
|
-
if ( 97 <= (*p) && (*p) <= 102 )
|
571
|
-
goto st23;
|
572
|
-
} else
|
573
|
-
goto st23;
|
574
|
-
goto st0;
|
575
|
-
tr5:
|
576
|
-
#line 22 "parser.rl"
|
577
|
-
{MARK(mark, p); }
|
578
|
-
goto st25;
|
579
|
-
st25:
|
580
|
-
if ( ++p == pe )
|
581
|
-
goto _test_eof25;
|
582
|
-
case 25:
|
583
|
-
#line 584 "parser.c"
|
584
|
-
switch( (*p) ) {
|
585
|
-
case 32: goto tr38;
|
586
|
-
case 35: goto tr39;
|
587
|
-
case 37: goto st26;
|
588
|
-
case 63: goto tr41;
|
589
|
-
case 127: goto st0;
|
590
|
-
}
|
591
|
-
if ( 0 <= (*p) && (*p) <= 31 )
|
592
|
-
goto st0;
|
593
|
-
goto st25;
|
594
|
-
st26:
|
595
|
-
if ( ++p == pe )
|
596
|
-
goto _test_eof26;
|
597
|
-
case 26:
|
598
|
-
if ( (*p) == 117 )
|
599
|
-
goto st28;
|
600
|
-
if ( (*p) < 65 ) {
|
601
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
602
|
-
goto st27;
|
603
|
-
} else if ( (*p) > 70 ) {
|
604
|
-
if ( 97 <= (*p) && (*p) <= 102 )
|
605
|
-
goto st27;
|
606
|
-
} else
|
607
|
-
goto st27;
|
608
|
-
goto st0;
|
609
|
-
st27:
|
610
|
-
if ( ++p == pe )
|
611
|
-
goto _test_eof27;
|
612
|
-
case 27:
|
613
|
-
if ( (*p) < 65 ) {
|
614
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
615
|
-
goto st25;
|
616
|
-
} else if ( (*p) > 70 ) {
|
617
|
-
if ( 97 <= (*p) && (*p) <= 102 )
|
618
|
-
goto st25;
|
619
|
-
} else
|
620
|
-
goto st25;
|
621
|
-
goto st0;
|
622
|
-
st28:
|
623
|
-
if ( ++p == pe )
|
624
|
-
goto _test_eof28;
|
625
|
-
case 28:
|
626
|
-
if ( (*p) < 65 ) {
|
627
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
628
|
-
goto st27;
|
629
|
-
} else if ( (*p) > 70 ) {
|
630
|
-
if ( 97 <= (*p) && (*p) <= 102 )
|
631
|
-
goto st27;
|
632
|
-
} else
|
633
|
-
goto st27;
|
634
|
-
goto st0;
|
635
|
-
tr41:
|
636
|
-
#line 65 "parser.rl"
|
637
|
-
{
|
638
|
-
if (parser->request_path != NULL) {
|
639
|
-
parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
|
640
|
-
}
|
641
|
-
}
|
642
|
-
goto st29;
|
643
|
-
st29:
|
644
|
-
if ( ++p == pe )
|
645
|
-
goto _test_eof29;
|
646
|
-
case 29:
|
647
|
-
#line 648 "parser.c"
|
648
|
-
switch( (*p) ) {
|
649
|
-
case 32: goto tr45;
|
650
|
-
case 35: goto tr46;
|
651
|
-
case 37: goto tr47;
|
652
|
-
case 127: goto st0;
|
653
|
-
}
|
654
|
-
if ( 0 <= (*p) && (*p) <= 31 )
|
655
|
-
goto st0;
|
656
|
-
goto tr44;
|
657
|
-
tr44:
|
658
|
-
#line 52 "parser.rl"
|
659
|
-
{MARK(query_start, p); }
|
660
|
-
goto st30;
|
661
|
-
st30:
|
662
|
-
if ( ++p == pe )
|
663
|
-
goto _test_eof30;
|
664
|
-
case 30:
|
665
|
-
#line 666 "parser.c"
|
666
|
-
switch( (*p) ) {
|
667
|
-
case 32: goto tr49;
|
668
|
-
case 35: goto tr50;
|
669
|
-
case 37: goto st31;
|
670
|
-
case 127: goto st0;
|
671
|
-
}
|
672
|
-
if ( 0 <= (*p) && (*p) <= 31 )
|
673
|
-
goto st0;
|
674
|
-
goto st30;
|
675
|
-
tr47:
|
676
|
-
#line 52 "parser.rl"
|
677
|
-
{MARK(query_start, p); }
|
678
|
-
goto st31;
|
679
|
-
st31:
|
680
|
-
if ( ++p == pe )
|
681
|
-
goto _test_eof31;
|
682
|
-
case 31:
|
683
|
-
#line 684 "parser.c"
|
684
|
-
if ( (*p) == 117 )
|
685
|
-
goto st33;
|
686
|
-
if ( (*p) < 65 ) {
|
687
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
688
|
-
goto st32;
|
689
|
-
} else if ( (*p) > 70 ) {
|
690
|
-
if ( 97 <= (*p) && (*p) <= 102 )
|
691
|
-
goto st32;
|
692
|
-
} else
|
693
|
-
goto st32;
|
694
|
-
goto st0;
|
695
|
-
st32:
|
696
|
-
if ( ++p == pe )
|
697
|
-
goto _test_eof32;
|
698
|
-
case 32:
|
699
|
-
if ( (*p) < 65 ) {
|
700
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
701
|
-
goto st30;
|
702
|
-
} else if ( (*p) > 70 ) {
|
703
|
-
if ( 97 <= (*p) && (*p) <= 102 )
|
704
|
-
goto st30;
|
705
|
-
} else
|
706
|
-
goto st30;
|
707
|
-
goto st0;
|
708
|
-
st33:
|
709
|
-
if ( ++p == pe )
|
710
|
-
goto _test_eof33;
|
711
|
-
case 33:
|
712
|
-
if ( (*p) < 65 ) {
|
713
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
714
|
-
goto st32;
|
715
|
-
} else if ( (*p) > 70 ) {
|
716
|
-
if ( 97 <= (*p) && (*p) <= 102 )
|
717
|
-
goto st32;
|
718
|
-
} else
|
719
|
-
goto st32;
|
720
|
-
goto st0;
|
721
|
-
st34:
|
722
|
-
if ( ++p == pe )
|
723
|
-
goto _test_eof34;
|
724
|
-
case 34:
|
725
|
-
switch( (*p) ) {
|
726
|
-
case 84: goto st35;
|
727
|
-
case 116: goto st35;
|
728
|
-
}
|
729
|
-
goto st0;
|
730
|
-
st35:
|
731
|
-
if ( ++p == pe )
|
732
|
-
goto _test_eof35;
|
733
|
-
case 35:
|
734
|
-
switch( (*p) ) {
|
735
|
-
case 84: goto st36;
|
736
|
-
case 116: goto st36;
|
737
|
-
}
|
738
|
-
goto st0;
|
739
|
-
st36:
|
740
|
-
if ( ++p == pe )
|
741
|
-
goto _test_eof36;
|
742
|
-
case 36:
|
743
|
-
switch( (*p) ) {
|
744
|
-
case 80: goto st37;
|
745
|
-
case 112: goto st37;
|
746
|
-
}
|
747
|
-
goto st0;
|
748
|
-
st37:
|
749
|
-
if ( ++p == pe )
|
750
|
-
goto _test_eof37;
|
751
|
-
case 37:
|
752
|
-
switch( (*p) ) {
|
753
|
-
case 58: goto st38;
|
754
|
-
case 83: goto st50;
|
755
|
-
case 115: goto st50;
|
756
|
-
}
|
757
|
-
goto st0;
|
758
|
-
st38:
|
759
|
-
if ( ++p == pe )
|
760
|
-
goto _test_eof38;
|
761
|
-
case 38:
|
762
|
-
if ( (*p) == 47 )
|
763
|
-
goto st39;
|
764
|
-
goto st0;
|
765
|
-
st39:
|
766
|
-
if ( ++p == pe )
|
767
|
-
goto _test_eof39;
|
768
|
-
case 39:
|
769
|
-
if ( (*p) == 47 )
|
770
|
-
goto st40;
|
771
|
-
goto st0;
|
772
|
-
st40:
|
773
|
-
if ( ++p == pe )
|
774
|
-
goto _test_eof40;
|
775
|
-
case 40:
|
776
|
-
switch( (*p) ) {
|
777
|
-
case 37: goto st42;
|
778
|
-
case 47: goto st0;
|
779
|
-
case 60: goto st0;
|
780
|
-
case 91: goto st47;
|
781
|
-
case 95: goto st45;
|
782
|
-
case 127: goto st0;
|
783
|
-
}
|
784
|
-
if ( (*p) < 45 ) {
|
785
|
-
if ( (*p) > 32 ) {
|
786
|
-
if ( 34 <= (*p) && (*p) <= 35 )
|
787
|
-
goto st0;
|
788
|
-
} else if ( (*p) >= 0 )
|
789
|
-
goto st0;
|
790
|
-
} else if ( (*p) > 57 ) {
|
791
|
-
if ( (*p) < 65 ) {
|
792
|
-
if ( 62 <= (*p) && (*p) <= 64 )
|
793
|
-
goto st0;
|
794
|
-
} else if ( (*p) > 90 ) {
|
795
|
-
if ( 97 <= (*p) && (*p) <= 122 )
|
796
|
-
goto st45;
|
797
|
-
} else
|
798
|
-
goto st45;
|
799
|
-
} else
|
800
|
-
goto st45;
|
801
|
-
goto st41;
|
802
|
-
st41:
|
803
|
-
if ( ++p == pe )
|
804
|
-
goto _test_eof41;
|
805
|
-
case 41:
|
806
|
-
switch( (*p) ) {
|
807
|
-
case 37: goto st42;
|
808
|
-
case 47: goto st0;
|
809
|
-
case 60: goto st0;
|
810
|
-
case 64: goto st40;
|
811
|
-
case 127: goto st0;
|
812
|
-
}
|
813
|
-
if ( (*p) < 34 ) {
|
814
|
-
if ( 0 <= (*p) && (*p) <= 32 )
|
815
|
-
goto st0;
|
816
|
-
} else if ( (*p) > 35 ) {
|
817
|
-
if ( 62 <= (*p) && (*p) <= 63 )
|
818
|
-
goto st0;
|
819
|
-
} else
|
820
|
-
goto st0;
|
821
|
-
goto st41;
|
822
|
-
st42:
|
823
|
-
if ( ++p == pe )
|
824
|
-
goto _test_eof42;
|
825
|
-
case 42:
|
826
|
-
if ( (*p) == 117 )
|
827
|
-
goto st44;
|
828
|
-
if ( (*p) < 65 ) {
|
829
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
830
|
-
goto st43;
|
831
|
-
} else if ( (*p) > 70 ) {
|
832
|
-
if ( 97 <= (*p) && (*p) <= 102 )
|
833
|
-
goto st43;
|
834
|
-
} else
|
835
|
-
goto st43;
|
836
|
-
goto st0;
|
837
|
-
st43:
|
838
|
-
if ( ++p == pe )
|
839
|
-
goto _test_eof43;
|
840
|
-
case 43:
|
841
|
-
if ( (*p) < 65 ) {
|
842
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
843
|
-
goto st41;
|
844
|
-
} else if ( (*p) > 70 ) {
|
845
|
-
if ( 97 <= (*p) && (*p) <= 102 )
|
846
|
-
goto st41;
|
847
|
-
} else
|
848
|
-
goto st41;
|
849
|
-
goto st0;
|
850
|
-
st44:
|
851
|
-
if ( ++p == pe )
|
852
|
-
goto _test_eof44;
|
853
|
-
case 44:
|
854
|
-
if ( (*p) < 65 ) {
|
855
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
856
|
-
goto st43;
|
857
|
-
} else if ( (*p) > 70 ) {
|
858
|
-
if ( 97 <= (*p) && (*p) <= 102 )
|
859
|
-
goto st43;
|
860
|
-
} else
|
861
|
-
goto st43;
|
862
|
-
goto st0;
|
863
|
-
st45:
|
864
|
-
if ( ++p == pe )
|
865
|
-
goto _test_eof45;
|
866
|
-
case 45:
|
867
|
-
switch( (*p) ) {
|
868
|
-
case 37: goto st42;
|
869
|
-
case 47: goto tr5;
|
870
|
-
case 58: goto st46;
|
871
|
-
case 60: goto st0;
|
872
|
-
case 64: goto st40;
|
873
|
-
case 95: goto st45;
|
874
|
-
case 127: goto st0;
|
875
|
-
}
|
876
|
-
if ( (*p) < 45 ) {
|
877
|
-
if ( (*p) > 32 ) {
|
878
|
-
if ( 34 <= (*p) && (*p) <= 35 )
|
879
|
-
goto st0;
|
880
|
-
} else if ( (*p) >= 0 )
|
881
|
-
goto st0;
|
882
|
-
} else if ( (*p) > 57 ) {
|
883
|
-
if ( (*p) < 65 ) {
|
884
|
-
if ( 62 <= (*p) && (*p) <= 63 )
|
885
|
-
goto st0;
|
886
|
-
} else if ( (*p) > 90 ) {
|
887
|
-
if ( 97 <= (*p) && (*p) <= 122 )
|
888
|
-
goto st45;
|
889
|
-
} else
|
890
|
-
goto st45;
|
891
|
-
} else
|
892
|
-
goto st45;
|
893
|
-
goto st41;
|
894
|
-
st46:
|
895
|
-
if ( ++p == pe )
|
896
|
-
goto _test_eof46;
|
897
|
-
case 46:
|
898
|
-
switch( (*p) ) {
|
899
|
-
case 37: goto st42;
|
900
|
-
case 47: goto tr5;
|
901
|
-
case 60: goto st0;
|
902
|
-
case 64: goto st40;
|
903
|
-
case 127: goto st0;
|
904
|
-
}
|
905
|
-
if ( (*p) < 34 ) {
|
906
|
-
if ( 0 <= (*p) && (*p) <= 32 )
|
907
|
-
goto st0;
|
908
|
-
} else if ( (*p) > 35 ) {
|
909
|
-
if ( (*p) > 57 ) {
|
910
|
-
if ( 62 <= (*p) && (*p) <= 63 )
|
911
|
-
goto st0;
|
912
|
-
} else if ( (*p) >= 48 )
|
913
|
-
goto st46;
|
914
|
-
} else
|
915
|
-
goto st0;
|
916
|
-
goto st41;
|
917
|
-
st47:
|
918
|
-
if ( ++p == pe )
|
919
|
-
goto _test_eof47;
|
920
|
-
case 47:
|
921
|
-
switch( (*p) ) {
|
922
|
-
case 37: goto st42;
|
923
|
-
case 47: goto st0;
|
924
|
-
case 60: goto st0;
|
925
|
-
case 64: goto st40;
|
926
|
-
case 127: goto st0;
|
927
|
-
}
|
928
|
-
if ( (*p) < 48 ) {
|
929
|
-
if ( (*p) > 32 ) {
|
930
|
-
if ( 34 <= (*p) && (*p) <= 35 )
|
931
|
-
goto st0;
|
932
|
-
} else if ( (*p) >= 0 )
|
933
|
-
goto st0;
|
934
|
-
} else if ( (*p) > 58 ) {
|
935
|
-
if ( (*p) < 65 ) {
|
936
|
-
if ( 62 <= (*p) && (*p) <= 63 )
|
937
|
-
goto st0;
|
938
|
-
} else if ( (*p) > 70 ) {
|
939
|
-
if ( 97 <= (*p) && (*p) <= 102 )
|
940
|
-
goto st48;
|
941
|
-
} else
|
942
|
-
goto st48;
|
943
|
-
} else
|
944
|
-
goto st48;
|
945
|
-
goto st41;
|
946
|
-
st48:
|
947
|
-
if ( ++p == pe )
|
948
|
-
goto _test_eof48;
|
949
|
-
case 48:
|
950
|
-
switch( (*p) ) {
|
951
|
-
case 37: goto st42;
|
952
|
-
case 47: goto st0;
|
953
|
-
case 60: goto st0;
|
954
|
-
case 64: goto st40;
|
955
|
-
case 93: goto st49;
|
956
|
-
case 127: goto st0;
|
957
|
-
}
|
958
|
-
if ( (*p) < 48 ) {
|
959
|
-
if ( (*p) > 32 ) {
|
960
|
-
if ( 34 <= (*p) && (*p) <= 35 )
|
961
|
-
goto st0;
|
962
|
-
} else if ( (*p) >= 0 )
|
963
|
-
goto st0;
|
964
|
-
} else if ( (*p) > 58 ) {
|
965
|
-
if ( (*p) < 65 ) {
|
966
|
-
if ( 62 <= (*p) && (*p) <= 63 )
|
967
|
-
goto st0;
|
968
|
-
} else if ( (*p) > 70 ) {
|
969
|
-
if ( 97 <= (*p) && (*p) <= 102 )
|
970
|
-
goto st48;
|
971
|
-
} else
|
972
|
-
goto st48;
|
973
|
-
} else
|
974
|
-
goto st48;
|
975
|
-
goto st41;
|
976
|
-
st49:
|
977
|
-
if ( ++p == pe )
|
978
|
-
goto _test_eof49;
|
979
|
-
case 49:
|
980
|
-
switch( (*p) ) {
|
981
|
-
case 37: goto st42;
|
982
|
-
case 47: goto tr5;
|
983
|
-
case 58: goto st46;
|
984
|
-
case 60: goto st0;
|
985
|
-
case 64: goto st40;
|
986
|
-
case 127: goto st0;
|
987
|
-
}
|
988
|
-
if ( (*p) < 34 ) {
|
989
|
-
if ( 0 <= (*p) && (*p) <= 32 )
|
990
|
-
goto st0;
|
991
|
-
} else if ( (*p) > 35 ) {
|
992
|
-
if ( 62 <= (*p) && (*p) <= 63 )
|
993
|
-
goto st0;
|
994
|
-
} else
|
995
|
-
goto st0;
|
996
|
-
goto st41;
|
997
|
-
st50:
|
998
|
-
if ( ++p == pe )
|
999
|
-
goto _test_eof50;
|
1000
|
-
case 50:
|
1001
|
-
if ( (*p) == 58 )
|
1002
|
-
goto st38;
|
1003
|
-
goto st0;
|
1004
|
-
st51:
|
1005
|
-
if ( ++p == pe )
|
1006
|
-
goto _test_eof51;
|
1007
|
-
case 51:
|
1008
|
-
switch( (*p) ) {
|
1009
|
-
case 32: goto tr2;
|
1010
|
-
case 36: goto st52;
|
1011
|
-
case 95: goto st52;
|
1012
|
-
}
|
1013
|
-
if ( (*p) < 48 ) {
|
1014
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
1015
|
-
goto st52;
|
1016
|
-
} else if ( (*p) > 57 ) {
|
1017
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
1018
|
-
goto st52;
|
1019
|
-
} else
|
1020
|
-
goto st52;
|
1021
|
-
goto st0;
|
1022
|
-
st52:
|
1023
|
-
if ( ++p == pe )
|
1024
|
-
goto _test_eof52;
|
1025
|
-
case 52:
|
1026
|
-
switch( (*p) ) {
|
1027
|
-
case 32: goto tr2;
|
1028
|
-
case 36: goto st53;
|
1029
|
-
case 95: goto st53;
|
1030
|
-
}
|
1031
|
-
if ( (*p) < 48 ) {
|
1032
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
1033
|
-
goto st53;
|
1034
|
-
} else if ( (*p) > 57 ) {
|
1035
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
1036
|
-
goto st53;
|
1037
|
-
} else
|
1038
|
-
goto st53;
|
1039
|
-
goto st0;
|
1040
|
-
st53:
|
1041
|
-
if ( ++p == pe )
|
1042
|
-
goto _test_eof53;
|
1043
|
-
case 53:
|
1044
|
-
switch( (*p) ) {
|
1045
|
-
case 32: goto tr2;
|
1046
|
-
case 36: goto st54;
|
1047
|
-
case 95: goto st54;
|
1048
|
-
}
|
1049
|
-
if ( (*p) < 48 ) {
|
1050
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
1051
|
-
goto st54;
|
1052
|
-
} else if ( (*p) > 57 ) {
|
1053
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
1054
|
-
goto st54;
|
1055
|
-
} else
|
1056
|
-
goto st54;
|
1057
|
-
goto st0;
|
1058
|
-
st54:
|
1059
|
-
if ( ++p == pe )
|
1060
|
-
goto _test_eof54;
|
1061
|
-
case 54:
|
1062
|
-
switch( (*p) ) {
|
1063
|
-
case 32: goto tr2;
|
1064
|
-
case 36: goto st55;
|
1065
|
-
case 95: goto st55;
|
1066
|
-
}
|
1067
|
-
if ( (*p) < 48 ) {
|
1068
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
1069
|
-
goto st55;
|
1070
|
-
} else if ( (*p) > 57 ) {
|
1071
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
1072
|
-
goto st55;
|
1073
|
-
} else
|
1074
|
-
goto st55;
|
1075
|
-
goto st0;
|
1076
|
-
st55:
|
1077
|
-
if ( ++p == pe )
|
1078
|
-
goto _test_eof55;
|
1079
|
-
case 55:
|
1080
|
-
switch( (*p) ) {
|
1081
|
-
case 32: goto tr2;
|
1082
|
-
case 36: goto st56;
|
1083
|
-
case 95: goto st56;
|
1084
|
-
}
|
1085
|
-
if ( (*p) < 48 ) {
|
1086
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
1087
|
-
goto st56;
|
1088
|
-
} else if ( (*p) > 57 ) {
|
1089
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
1090
|
-
goto st56;
|
1091
|
-
} else
|
1092
|
-
goto st56;
|
1093
|
-
goto st0;
|
1094
|
-
st56:
|
1095
|
-
if ( ++p == pe )
|
1096
|
-
goto _test_eof56;
|
1097
|
-
case 56:
|
1098
|
-
switch( (*p) ) {
|
1099
|
-
case 32: goto tr2;
|
1100
|
-
case 36: goto st57;
|
1101
|
-
case 95: goto st57;
|
1102
|
-
}
|
1103
|
-
if ( (*p) < 48 ) {
|
1104
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
1105
|
-
goto st57;
|
1106
|
-
} else if ( (*p) > 57 ) {
|
1107
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
1108
|
-
goto st57;
|
1109
|
-
} else
|
1110
|
-
goto st57;
|
1111
|
-
goto st0;
|
1112
|
-
st57:
|
1113
|
-
if ( ++p == pe )
|
1114
|
-
goto _test_eof57;
|
1115
|
-
case 57:
|
1116
|
-
switch( (*p) ) {
|
1117
|
-
case 32: goto tr2;
|
1118
|
-
case 36: goto st58;
|
1119
|
-
case 95: goto st58;
|
1120
|
-
}
|
1121
|
-
if ( (*p) < 48 ) {
|
1122
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
1123
|
-
goto st58;
|
1124
|
-
} else if ( (*p) > 57 ) {
|
1125
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
1126
|
-
goto st58;
|
1127
|
-
} else
|
1128
|
-
goto st58;
|
1129
|
-
goto st0;
|
1130
|
-
st58:
|
1131
|
-
if ( ++p == pe )
|
1132
|
-
goto _test_eof58;
|
1133
|
-
case 58:
|
1134
|
-
switch( (*p) ) {
|
1135
|
-
case 32: goto tr2;
|
1136
|
-
case 36: goto st59;
|
1137
|
-
case 95: goto st59;
|
1138
|
-
}
|
1139
|
-
if ( (*p) < 48 ) {
|
1140
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
1141
|
-
goto st59;
|
1142
|
-
} else if ( (*p) > 57 ) {
|
1143
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
1144
|
-
goto st59;
|
1145
|
-
} else
|
1146
|
-
goto st59;
|
1147
|
-
goto st0;
|
1148
|
-
st59:
|
1149
|
-
if ( ++p == pe )
|
1150
|
-
goto _test_eof59;
|
1151
|
-
case 59:
|
1152
|
-
switch( (*p) ) {
|
1153
|
-
case 32: goto tr2;
|
1154
|
-
case 36: goto st60;
|
1155
|
-
case 95: goto st60;
|
1156
|
-
}
|
1157
|
-
if ( (*p) < 48 ) {
|
1158
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
1159
|
-
goto st60;
|
1160
|
-
} else if ( (*p) > 57 ) {
|
1161
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
1162
|
-
goto st60;
|
1163
|
-
} else
|
1164
|
-
goto st60;
|
1165
|
-
goto st0;
|
1166
|
-
st60:
|
1167
|
-
if ( ++p == pe )
|
1168
|
-
goto _test_eof60;
|
1169
|
-
case 60:
|
1170
|
-
switch( (*p) ) {
|
1171
|
-
case 32: goto tr2;
|
1172
|
-
case 36: goto st61;
|
1173
|
-
case 95: goto st61;
|
1174
|
-
}
|
1175
|
-
if ( (*p) < 48 ) {
|
1176
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
1177
|
-
goto st61;
|
1178
|
-
} else if ( (*p) > 57 ) {
|
1179
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
1180
|
-
goto st61;
|
1181
|
-
} else
|
1182
|
-
goto st61;
|
1183
|
-
goto st0;
|
1184
|
-
st61:
|
1185
|
-
if ( ++p == pe )
|
1186
|
-
goto _test_eof61;
|
1187
|
-
case 61:
|
1188
|
-
switch( (*p) ) {
|
1189
|
-
case 32: goto tr2;
|
1190
|
-
case 36: goto st62;
|
1191
|
-
case 95: goto st62;
|
1192
|
-
}
|
1193
|
-
if ( (*p) < 48 ) {
|
1194
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
1195
|
-
goto st62;
|
1196
|
-
} else if ( (*p) > 57 ) {
|
1197
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
1198
|
-
goto st62;
|
1199
|
-
} else
|
1200
|
-
goto st62;
|
1201
|
-
goto st0;
|
1202
|
-
st62:
|
1203
|
-
if ( ++p == pe )
|
1204
|
-
goto _test_eof62;
|
1205
|
-
case 62:
|
1206
|
-
switch( (*p) ) {
|
1207
|
-
case 32: goto tr2;
|
1208
|
-
case 36: goto st63;
|
1209
|
-
case 95: goto st63;
|
1210
|
-
}
|
1211
|
-
if ( (*p) < 48 ) {
|
1212
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
1213
|
-
goto st63;
|
1214
|
-
} else if ( (*p) > 57 ) {
|
1215
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
1216
|
-
goto st63;
|
1217
|
-
} else
|
1218
|
-
goto st63;
|
1219
|
-
goto st0;
|
1220
|
-
st63:
|
1221
|
-
if ( ++p == pe )
|
1222
|
-
goto _test_eof63;
|
1223
|
-
case 63:
|
1224
|
-
switch( (*p) ) {
|
1225
|
-
case 32: goto tr2;
|
1226
|
-
case 36: goto st64;
|
1227
|
-
case 95: goto st64;
|
1228
|
-
}
|
1229
|
-
if ( (*p) < 48 ) {
|
1230
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
1231
|
-
goto st64;
|
1232
|
-
} else if ( (*p) > 57 ) {
|
1233
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
1234
|
-
goto st64;
|
1235
|
-
} else
|
1236
|
-
goto st64;
|
1237
|
-
goto st0;
|
1238
|
-
st64:
|
1239
|
-
if ( ++p == pe )
|
1240
|
-
goto _test_eof64;
|
1241
|
-
case 64:
|
1242
|
-
switch( (*p) ) {
|
1243
|
-
case 32: goto tr2;
|
1244
|
-
case 36: goto st65;
|
1245
|
-
case 95: goto st65;
|
1246
|
-
}
|
1247
|
-
if ( (*p) < 48 ) {
|
1248
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
1249
|
-
goto st65;
|
1250
|
-
} else if ( (*p) > 57 ) {
|
1251
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
1252
|
-
goto st65;
|
1253
|
-
} else
|
1254
|
-
goto st65;
|
1255
|
-
goto st0;
|
1256
|
-
st65:
|
1257
|
-
if ( ++p == pe )
|
1258
|
-
goto _test_eof65;
|
1259
|
-
case 65:
|
1260
|
-
switch( (*p) ) {
|
1261
|
-
case 32: goto tr2;
|
1262
|
-
case 36: goto st66;
|
1263
|
-
case 95: goto st66;
|
1264
|
-
}
|
1265
|
-
if ( (*p) < 48 ) {
|
1266
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
1267
|
-
goto st66;
|
1268
|
-
} else if ( (*p) > 57 ) {
|
1269
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
1270
|
-
goto st66;
|
1271
|
-
} else
|
1272
|
-
goto st66;
|
1273
|
-
goto st0;
|
1274
|
-
st66:
|
1275
|
-
if ( ++p == pe )
|
1276
|
-
goto _test_eof66;
|
1277
|
-
case 66:
|
1278
|
-
switch( (*p) ) {
|
1279
|
-
case 32: goto tr2;
|
1280
|
-
case 36: goto st67;
|
1281
|
-
case 95: goto st67;
|
1282
|
-
}
|
1283
|
-
if ( (*p) < 48 ) {
|
1284
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
1285
|
-
goto st67;
|
1286
|
-
} else if ( (*p) > 57 ) {
|
1287
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
1288
|
-
goto st67;
|
1289
|
-
} else
|
1290
|
-
goto st67;
|
1291
|
-
goto st0;
|
1292
|
-
st67:
|
1293
|
-
if ( ++p == pe )
|
1294
|
-
goto _test_eof67;
|
1295
|
-
case 67:
|
1296
|
-
switch( (*p) ) {
|
1297
|
-
case 32: goto tr2;
|
1298
|
-
case 36: goto st68;
|
1299
|
-
case 95: goto st68;
|
1300
|
-
}
|
1301
|
-
if ( (*p) < 48 ) {
|
1302
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
1303
|
-
goto st68;
|
1304
|
-
} else if ( (*p) > 57 ) {
|
1305
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
1306
|
-
goto st68;
|
1307
|
-
} else
|
1308
|
-
goto st68;
|
1309
|
-
goto st0;
|
1310
|
-
st68:
|
1311
|
-
if ( ++p == pe )
|
1312
|
-
goto _test_eof68;
|
1313
|
-
case 68:
|
1314
|
-
switch( (*p) ) {
|
1315
|
-
case 32: goto tr2;
|
1316
|
-
case 36: goto st69;
|
1317
|
-
case 95: goto st69;
|
1318
|
-
}
|
1319
|
-
if ( (*p) < 48 ) {
|
1320
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
1321
|
-
goto st69;
|
1322
|
-
} else if ( (*p) > 57 ) {
|
1323
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
1324
|
-
goto st69;
|
1325
|
-
} else
|
1326
|
-
goto st69;
|
1327
|
-
goto st0;
|
1328
|
-
st69:
|
1329
|
-
if ( ++p == pe )
|
1330
|
-
goto _test_eof69;
|
1331
|
-
case 69:
|
1332
|
-
if ( (*p) == 32 )
|
1333
|
-
goto tr2;
|
1334
|
-
goto st0;
|
1335
|
-
}
|
1336
|
-
_test_eof2: cs = 2; goto _test_eof;
|
1337
|
-
_test_eof3: cs = 3; goto _test_eof;
|
1338
|
-
_test_eof4: cs = 4; goto _test_eof;
|
1339
|
-
_test_eof5: cs = 5; goto _test_eof;
|
1340
|
-
_test_eof6: cs = 6; goto _test_eof;
|
1341
|
-
_test_eof7: cs = 7; goto _test_eof;
|
1342
|
-
_test_eof8: cs = 8; goto _test_eof;
|
1343
|
-
_test_eof9: cs = 9; goto _test_eof;
|
1344
|
-
_test_eof10: cs = 10; goto _test_eof;
|
1345
|
-
_test_eof11: cs = 11; goto _test_eof;
|
1346
|
-
_test_eof12: cs = 12; goto _test_eof;
|
1347
|
-
_test_eof13: cs = 13; goto _test_eof;
|
1348
|
-
_test_eof14: cs = 14; goto _test_eof;
|
1349
|
-
_test_eof15: cs = 15; goto _test_eof;
|
1350
|
-
_test_eof16: cs = 16; goto _test_eof;
|
1351
|
-
_test_eof70: cs = 70; goto _test_eof;
|
1352
|
-
_test_eof17: cs = 17; goto _test_eof;
|
1353
|
-
_test_eof18: cs = 18; goto _test_eof;
|
1354
|
-
_test_eof19: cs = 19; goto _test_eof;
|
1355
|
-
_test_eof20: cs = 20; goto _test_eof;
|
1356
|
-
_test_eof21: cs = 21; goto _test_eof;
|
1357
|
-
_test_eof22: cs = 22; goto _test_eof;
|
1358
|
-
_test_eof23: cs = 23; goto _test_eof;
|
1359
|
-
_test_eof24: cs = 24; goto _test_eof;
|
1360
|
-
_test_eof25: cs = 25; goto _test_eof;
|
1361
|
-
_test_eof26: cs = 26; goto _test_eof;
|
1362
|
-
_test_eof27: cs = 27; goto _test_eof;
|
1363
|
-
_test_eof28: cs = 28; goto _test_eof;
|
1364
|
-
_test_eof29: cs = 29; goto _test_eof;
|
1365
|
-
_test_eof30: cs = 30; goto _test_eof;
|
1366
|
-
_test_eof31: cs = 31; goto _test_eof;
|
1367
|
-
_test_eof32: cs = 32; goto _test_eof;
|
1368
|
-
_test_eof33: cs = 33; goto _test_eof;
|
1369
|
-
_test_eof34: cs = 34; goto _test_eof;
|
1370
|
-
_test_eof35: cs = 35; goto _test_eof;
|
1371
|
-
_test_eof36: cs = 36; goto _test_eof;
|
1372
|
-
_test_eof37: cs = 37; goto _test_eof;
|
1373
|
-
_test_eof38: cs = 38; goto _test_eof;
|
1374
|
-
_test_eof39: cs = 39; goto _test_eof;
|
1375
|
-
_test_eof40: cs = 40; goto _test_eof;
|
1376
|
-
_test_eof41: cs = 41; goto _test_eof;
|
1377
|
-
_test_eof42: cs = 42; goto _test_eof;
|
1378
|
-
_test_eof43: cs = 43; goto _test_eof;
|
1379
|
-
_test_eof44: cs = 44; goto _test_eof;
|
1380
|
-
_test_eof45: cs = 45; goto _test_eof;
|
1381
|
-
_test_eof46: cs = 46; goto _test_eof;
|
1382
|
-
_test_eof47: cs = 47; goto _test_eof;
|
1383
|
-
_test_eof48: cs = 48; goto _test_eof;
|
1384
|
-
_test_eof49: cs = 49; goto _test_eof;
|
1385
|
-
_test_eof50: cs = 50; goto _test_eof;
|
1386
|
-
_test_eof51: cs = 51; goto _test_eof;
|
1387
|
-
_test_eof52: cs = 52; goto _test_eof;
|
1388
|
-
_test_eof53: cs = 53; goto _test_eof;
|
1389
|
-
_test_eof54: cs = 54; goto _test_eof;
|
1390
|
-
_test_eof55: cs = 55; goto _test_eof;
|
1391
|
-
_test_eof56: cs = 56; goto _test_eof;
|
1392
|
-
_test_eof57: cs = 57; goto _test_eof;
|
1393
|
-
_test_eof58: cs = 58; goto _test_eof;
|
1394
|
-
_test_eof59: cs = 59; goto _test_eof;
|
1395
|
-
_test_eof60: cs = 60; goto _test_eof;
|
1396
|
-
_test_eof61: cs = 61; goto _test_eof;
|
1397
|
-
_test_eof62: cs = 62; goto _test_eof;
|
1398
|
-
_test_eof63: cs = 63; goto _test_eof;
|
1399
|
-
_test_eof64: cs = 64; goto _test_eof;
|
1400
|
-
_test_eof65: cs = 65; goto _test_eof;
|
1401
|
-
_test_eof66: cs = 66; goto _test_eof;
|
1402
|
-
_test_eof67: cs = 67; goto _test_eof;
|
1403
|
-
_test_eof68: cs = 68; goto _test_eof;
|
1404
|
-
_test_eof69: cs = 69; goto _test_eof;
|
1405
|
-
|
1406
|
-
_test_eof: {}
|
1407
|
-
_out: {}
|
1408
|
-
}
|
1409
|
-
|
1410
|
-
#line 116 "parser.rl"
|
1411
|
-
|
1412
|
-
parser->cs = cs;
|
1413
|
-
parser->nread += p - (buffer + off);
|
1414
|
-
|
1415
|
-
assert(p <= pe && "buffer overflow after parsing execute");
|
1416
|
-
assert(parser->nread <= len && "nread longer than length");
|
1417
|
-
assert(parser->body_start <= len && "body starts after buffer end");
|
1418
|
-
assert(parser->mark < len && "mark is after buffer end");
|
1419
|
-
assert(parser->field_len <= len && "field has length longer than whole buffer");
|
1420
|
-
assert(parser->field_start < len && "field starts after buffer end");
|
1421
|
-
|
1422
|
-
if(parser->body_start) {
|
1423
|
-
/* final \r\n combo encountered so stop right here */
|
1424
|
-
parser->nread++;
|
1425
|
-
}
|
1426
|
-
|
1427
|
-
return(parser->nread);
|
1428
|
-
}
|
1429
|
-
|
1430
|
-
int thin_http_parser_has_error(http_parser *parser) {
|
1431
|
-
return parser->cs == http_parser_error;
|
1432
|
-
}
|
1433
|
-
|
1434
|
-
int thin_http_parser_is_finished(http_parser *parser) {
|
1435
|
-
return parser->cs == http_parser_first_final;
|
1436
|
-
}
|
1437
|
-
|
1438
|
-
int thin_http_parser_finish(http_parser *parser)
|
1439
|
-
{
|
1440
|
-
if (thin_http_parser_has_error(parser) ) {
|
1441
|
-
return -1;
|
1442
|
-
} else if (thin_http_parser_is_finished(parser) ) {
|
1443
|
-
return 1;
|
1444
|
-
} else {
|
1445
|
-
return 0;
|
1446
|
-
}
|
1447
|
-
}
|