puma 3.12.0 → 4.3.8
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puma might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/History.md +164 -0
- data/README.md +76 -48
- data/docs/architecture.md +1 -0
- data/docs/deployment.md +24 -4
- data/docs/plugins.md +20 -10
- data/docs/restart.md +4 -2
- data/docs/systemd.md +27 -9
- data/docs/tcp_mode.md +96 -0
- data/ext/puma_http11/PumaHttp11Service.java +2 -0
- data/ext/puma_http11/extconf.rb +13 -0
- data/ext/puma_http11/http11_parser.c +40 -63
- data/ext/puma_http11/http11_parser.java.rl +21 -37
- data/ext/puma_http11/http11_parser.rl +3 -1
- data/ext/puma_http11/http11_parser_common.rl +3 -3
- data/ext/puma_http11/mini_ssl.c +86 -4
- data/ext/puma_http11/org/jruby/puma/Http11.java +106 -114
- data/ext/puma_http11/org/jruby/puma/Http11Parser.java +91 -106
- data/ext/puma_http11/org/jruby/puma/IOBuffer.java +72 -0
- data/ext/puma_http11/org/jruby/puma/MiniSSL.java +15 -4
- data/ext/puma_http11/puma_http11.c +3 -0
- data/lib/puma.rb +8 -0
- data/lib/puma/accept_nonblock.rb +7 -1
- data/lib/puma/app/status.rb +37 -29
- data/lib/puma/binder.rb +47 -68
- data/lib/puma/cli.rb +6 -0
- data/lib/puma/client.rb +244 -199
- data/lib/puma/cluster.rb +55 -30
- data/lib/puma/commonlogger.rb +2 -0
- data/lib/puma/configuration.rb +6 -3
- data/lib/puma/const.rb +32 -18
- data/lib/puma/control_cli.rb +41 -14
- data/lib/puma/detect.rb +2 -0
- data/lib/puma/dsl.rb +311 -77
- data/lib/puma/events.rb +6 -1
- data/lib/puma/io_buffer.rb +3 -6
- data/lib/puma/jruby_restart.rb +2 -0
- data/lib/puma/launcher.rb +99 -55
- data/lib/puma/minissl.rb +37 -17
- data/lib/puma/minissl/context_builder.rb +76 -0
- data/lib/puma/null_io.rb +2 -0
- data/lib/puma/plugin.rb +7 -2
- data/lib/puma/plugin/tmp_restart.rb +2 -0
- data/lib/puma/rack/builder.rb +4 -1
- data/lib/puma/rack/urlmap.rb +2 -0
- data/lib/puma/rack_default.rb +2 -0
- data/lib/puma/reactor.rb +112 -57
- data/lib/puma/runner.rb +13 -3
- data/lib/puma/server.rb +119 -48
- data/lib/puma/single.rb +5 -3
- data/lib/puma/state_file.rb +2 -0
- data/lib/puma/tcp_logger.rb +2 -0
- data/lib/puma/thread_pool.rb +17 -33
- data/lib/puma/util.rb +2 -6
- data/lib/rack/handler/puma.rb +6 -3
- data/tools/docker/Dockerfile +16 -0
- data/tools/jungle/init.d/puma +6 -6
- data/tools/trickletest.rb +0 -1
- metadata +26 -14
- data/lib/puma/compat.rb +0 -14
- data/lib/puma/convenient.rb +0 -23
- data/lib/puma/daemon_ext.rb +0 -31
- data/lib/puma/delegation.rb +0 -11
- data/lib/puma/java_io_buffer.rb +0 -45
- data/lib/puma/rack/backports/uri/common_193.rb +0 -33
data/docs/architecture.md
CHANGED
@@ -20,6 +20,7 @@ Clustered mode is shown/discussed here. Single mode is analogous to having a sin
|
|
20
20
|
* By default, a single, separate thread is used to receive HTTP requests across the socket.
|
21
21
|
* When at least one worker thread is available for work, a connection is accepted and placed in this request buffer
|
22
22
|
* This thread waits for entire HTTP requests to be received over the connection
|
23
|
+
* The time spent waiting for the HTTP request body to be received is exposed to the Rack app as `env['puma.request_body_wait']` (milliseconds)
|
23
24
|
* Once received, the connection is pushed into the "todo" set
|
24
25
|
* Worker threads pop work off the "todo" set for processing
|
25
26
|
* The thread processes the request via the rack application (which generates the HTTP response)
|
data/docs/deployment.md
CHANGED
@@ -38,22 +38,42 @@ Here are some rules of thumb:
|
|
38
38
|
* As you grow more confident in the thread safety of your app, you can tune the
|
39
39
|
workers down and the threads up.
|
40
40
|
|
41
|
+
#### Ubuntu / Systemd (Systemctl) Installation
|
42
|
+
|
43
|
+
See [systemd.md](systemd.md)
|
44
|
+
|
41
45
|
#### Worker utilization
|
42
46
|
|
43
|
-
**How do you know if you'
|
47
|
+
**How do you know if you've got enough (or too many workers)?**
|
44
48
|
|
45
49
|
A good question. Due to MRI's GIL, only one thread can be executing Ruby code at a time.
|
46
50
|
But since so many apps are waiting on IO from DBs, etc., they can utilize threads
|
47
51
|
to make better use of the process.
|
48
52
|
|
49
53
|
The rule of thumb is you never want processes that are pegged all the time. This
|
50
|
-
means that there is more work to do
|
54
|
+
means that there is more work to do than the process can get through. On the other
|
51
55
|
hand, if you have processes that sit around doing nothing, then they're just eating
|
52
56
|
up resources.
|
53
57
|
|
54
|
-
|
58
|
+
Watch your CPU utilization over time and aim for about 70% on average. This means
|
55
59
|
you've got capacity still but aren't starving threads.
|
56
60
|
|
61
|
+
**Measuring utilization**
|
62
|
+
|
63
|
+
Using a timestamp header from an upstream proxy server (eg. nginx or haproxy), it's
|
64
|
+
possible to get an indication of how long requests have been waiting for a Puma
|
65
|
+
thread to become available.
|
66
|
+
|
67
|
+
* Have your upstream proxy set a header with the time it received the request:
|
68
|
+
* nginx: `proxy_set_header X-Request-Start "${msec}";`
|
69
|
+
* haproxy: `http-request set-header X-Request-Start "%t";`
|
70
|
+
* In your Rack middleware, determine the amount of time elapsed since `X-Request-Start`.
|
71
|
+
* To improve accuracy, you will want to subtract time spent waiting for slow clients:
|
72
|
+
* `env['puma.request_body_wait']` contains the number of milliseconds Puma spent
|
73
|
+
waiting for the client to send the request body.
|
74
|
+
* haproxy: `%Th` (TLS handshake time) and `%Ti` (idle time before request) can
|
75
|
+
can also be added as headers.
|
76
|
+
|
57
77
|
## Daemonizing
|
58
78
|
|
59
79
|
I prefer to not daemonize my servers and use something like `runit` or `upstart` to
|
@@ -62,7 +82,7 @@ makes it easy to figure out what is going on. Additionally, unlike `unicorn`,
|
|
62
82
|
puma does not require daemonization to do zero-downtime restarts.
|
63
83
|
|
64
84
|
I see people using daemonization because they start puma directly via capistrano
|
65
|
-
task and thus want it to live on past the `cap deploy`. To
|
85
|
+
task and thus want it to live on past the `cap deploy`. To these people I say:
|
66
86
|
You need to be using a process monitor. Nothing is making sure puma stays up in
|
67
87
|
this scenario! You're just waiting for something weird to happen, puma to die,
|
68
88
|
and to get paged at 3am. Do yourself a favor, at least the process monitoring
|
data/docs/plugins.md
CHANGED
@@ -1,15 +1,22 @@
|
|
1
1
|
## Plugins
|
2
2
|
|
3
|
-
Puma 3.0 added support for plugins that can augment configuration and service
|
3
|
+
Puma 3.0 added support for plugins that can augment configuration and service
|
4
|
+
operations.
|
4
5
|
|
5
6
|
2 canonical plugins to look to aid in development of further plugins:
|
6
7
|
|
7
|
-
* [tmp\_restart](https://github.com/puma/puma/blob/master/lib/puma/plugin/tmp_restart.rb):
|
8
|
-
|
8
|
+
* [tmp\_restart](https://github.com/puma/puma/blob/master/lib/puma/plugin/tmp_restart.rb):
|
9
|
+
Restarts the server if the file `tmp/restart.txt` is touched
|
10
|
+
* [heroku](https://github.com/puma/puma-heroku/blob/master/lib/puma/plugin/heroku.rb):
|
11
|
+
Packages up the default configuration used by puma on Heroku
|
9
12
|
|
10
|
-
Plugins are activated in a puma configuration file (such as `config/puma.rb'`)
|
13
|
+
Plugins are activated in a puma configuration file (such as `config/puma.rb'`)
|
14
|
+
by adding `plugin "name"`, such as `plugin "heroku"`.
|
11
15
|
|
12
|
-
Plugins are activated based simply on path requirements so, activating the
|
16
|
+
Plugins are activated based simply on path requirements so, activating the
|
17
|
+
`heroku` plugin will simply be doing `require "puma/plugin/heroku"`. This
|
18
|
+
allows gems to provide multiple plugins (as well as unrelated gems to provide
|
19
|
+
puma plugins).
|
13
20
|
|
14
21
|
The `tmp_restart` plugin is bundled with puma, so it can always be used.
|
15
22
|
|
@@ -17,12 +24,15 @@ To use the `heroku` plugin, add `puma-heroku` to your Gemfile or install it.
|
|
17
24
|
|
18
25
|
### API
|
19
26
|
|
20
|
-
|
27
|
+
## Server-wide hooks
|
21
28
|
|
22
|
-
|
29
|
+
Plugins can use a couple of hooks at server level: `start` and `config`.
|
23
30
|
|
24
|
-
`
|
31
|
+
`start` runs when the server has started and allows the plugin to start other
|
32
|
+
functionality to augment puma.
|
25
33
|
|
26
|
-
|
34
|
+
`config` runs when the server is being configured and is passed a `Puma::DSL`
|
35
|
+
object that can be used to add additional configuration.
|
27
36
|
|
28
|
-
|
37
|
+
Any public methods in `Puma::Plugin` are the public API that any plugin may
|
38
|
+
use.
|
data/docs/restart.md
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
To perform a restart, there are 3 builtin mechanisms:
|
4
4
|
|
5
|
-
* Send the `puma` process the `SIGUSR2` signal
|
6
|
-
* Send the `puma` process the `SIGUSR1` signal (rolling restart, cluster mode only)
|
5
|
+
* Send the `puma` process the `SIGUSR2` signal (normal restart)
|
6
|
+
* Send the `puma` process the `SIGUSR1` signal (restart in phases (a "rolling restart"), cluster mode only)
|
7
7
|
* Use the status server and issue `/restart`
|
8
8
|
|
9
9
|
No code is shared between the current and restarted process, so it should be safe to issue a restart any place where you would manually stop Puma and start it again.
|
@@ -22,6 +22,8 @@ But again beware, upgrading an application sometimes involves upgrading the data
|
|
22
22
|
|
23
23
|
If you perform a lot of database migrations, you probably should not use phased restart and use a normal/hot restart instead (`pumactl restart`). That way, no code is shared while deploying (in that case, `preload_app!` might help for quicker deployment, see ["Clustered Mode" in the README](../README.md#clustered-mode)).
|
24
24
|
|
25
|
+
**Note**: Hot and phased restarts are only available on MRI, not on JRuby. They are also unavailable on Windows servers.
|
26
|
+
|
25
27
|
### Release Directory
|
26
28
|
|
27
29
|
If your symlink releases into a common working directory (i.e., `/current` from Capistrano), Puma won't pick up your new changes when running phased restarts without additional configuration. You should set your working directory within Puma's config to specify the directory it should use. This is a change from earlier versions of Puma (< 2.15) that would infer the directory for you.
|
data/docs/systemd.md
CHANGED
@@ -32,21 +32,26 @@ Type=simple
|
|
32
32
|
# Preferably configure a non-privileged user
|
33
33
|
# User=
|
34
34
|
|
35
|
-
# The path to the
|
36
|
-
# Also replace the "<
|
37
|
-
|
35
|
+
# The path to the your application code root directory.
|
36
|
+
# Also replace the "<YOUR_APP_PATH>" place holders below with this path.
|
37
|
+
# Example /home/username/myapp
|
38
|
+
WorkingDirectory=<YOUR_APP_PATH>
|
38
39
|
|
39
40
|
# Helpful for debugging socket activation, etc.
|
40
41
|
# Environment=PUMA_DEBUG=1
|
41
42
|
|
42
|
-
#
|
43
|
-
#
|
44
|
-
#
|
45
|
-
ExecStart
|
43
|
+
# SystemD will not run puma even if it is in your path. You must specify
|
44
|
+
# an absolute URL to puma. For example /usr/local/bin/puma
|
45
|
+
# Alternatively, create a binstub with `bundle binstubs puma --path ./sbin` in the WorkingDirectory
|
46
|
+
ExecStart=/<FULLPATH>/bin/puma -C <YOUR_APP_PATH>/puma.rb
|
47
|
+
|
48
|
+
# Variant: Rails start.
|
49
|
+
# ExecStart=/<FULLPATH>/bin/puma -C <YOUR_APP_PATH>/config/puma.rb ../config.ru
|
46
50
|
|
47
|
-
# Variant: Use config file with `bind` directives instead:
|
48
|
-
# ExecStart=<WD>/sbin/puma -C config.rb
|
49
51
|
# Variant: Use `bundle exec --keep-file-descriptors puma` instead of binstub
|
52
|
+
# Variant: Specify directives inline.
|
53
|
+
# ExecStart=/<FULLPATH>/puma -b tcp://0.0.0.0:9292 -b ssl://0.0.0.0:9293?key=key.pem&cert=cert.pem
|
54
|
+
|
50
55
|
|
51
56
|
Restart=always
|
52
57
|
|
@@ -66,6 +71,13 @@ listening sockets open across puma restarts and achieves graceful
|
|
66
71
|
restarts, including when upgraded puma, and is compatible with both
|
67
72
|
clustered mode and application preload.
|
68
73
|
|
74
|
+
**Note:** Any wrapper scripts which `exec`, or other indirections in
|
75
|
+
`ExecStart`, may result in activated socket file descriptors being closed
|
76
|
+
before they reach the puma master process. For example, if using `bundle exec`,
|
77
|
+
pass the `--keep-file-descriptors` flag. `bundle exec` can be avoided by using a
|
78
|
+
`puma` executable generated by `bundle binstubs puma`. This is tracked in
|
79
|
+
[#1499].
|
80
|
+
|
69
81
|
**Note:** Socket activation doesn't currently work on jruby. This is
|
70
82
|
tracked in [#1367].
|
71
83
|
|
@@ -247,6 +259,12 @@ PIDFile=<WD>/shared/tmp/pids/puma.pid
|
|
247
259
|
# reconsider if you actually need the forking config.
|
248
260
|
Restart=no
|
249
261
|
|
262
|
+
# `puma_ctl restart` wouldn't work without this. It's because `pumactl`
|
263
|
+
# changes PID on restart and systemd stops the service afterwards
|
264
|
+
# because of the PID change. This option prevents stopping after PID
|
265
|
+
# change.
|
266
|
+
RemainAfterExit=yes
|
267
|
+
|
250
268
|
[Install]
|
251
269
|
WantedBy=multi-user.target
|
252
270
|
~~~~
|
data/docs/tcp_mode.md
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
# TCP mode
|
2
|
+
|
3
|
+
Puma also could be used as a TCP server to process incoming TCP
|
4
|
+
connections.
|
5
|
+
|
6
|
+
|
7
|
+
## Configuration
|
8
|
+
|
9
|
+
TCP mode can be enabled with CLI option `--tcp-mode`:
|
10
|
+
|
11
|
+
```
|
12
|
+
$ puma --tcp-mode
|
13
|
+
```
|
14
|
+
|
15
|
+
Default ip and port to listen to are `0.0.0.0` and `9292`. You can configure
|
16
|
+
them with `--port` and `--bind` options:
|
17
|
+
|
18
|
+
```
|
19
|
+
$ puma --tcp-mode --bind tcp://127.0.0.1:9293
|
20
|
+
$ puma --tcp-mode --port 9293
|
21
|
+
```
|
22
|
+
|
23
|
+
TCP mode could be set with a configuration file as well with `tcp_mode`
|
24
|
+
and `tcp_mode!` methods:
|
25
|
+
|
26
|
+
```
|
27
|
+
# config/puma.rb
|
28
|
+
tcp_mode
|
29
|
+
```
|
30
|
+
|
31
|
+
When Puma starts in the TCP mode it prints the corresponding message:
|
32
|
+
|
33
|
+
```
|
34
|
+
puma --tcp-mode
|
35
|
+
Puma starting in single mode...
|
36
|
+
...
|
37
|
+
* Mode: Lopez Express (tcp)
|
38
|
+
```
|
39
|
+
|
40
|
+
|
41
|
+
## How to declare an application
|
42
|
+
|
43
|
+
An application to process TCP connections should be declared as a
|
44
|
+
callable object which accepts `env` and `socket` arguments.
|
45
|
+
|
46
|
+
`env` argument is a Hash with following structure:
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
{ "thread" => {}, "REMOTE_ADDR" => "127.0.0.1:51133", "log" => "#<Proc:0x000..." }
|
50
|
+
```
|
51
|
+
|
52
|
+
It consists of:
|
53
|
+
* `thread` - a Hash for each thread in the thread pool that could be
|
54
|
+
used to store information between requests
|
55
|
+
* `REMOTE_ADDR` - a client ip address
|
56
|
+
* `log` - a proc object to write something down
|
57
|
+
|
58
|
+
`log` object could be used this way:
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
env['log'].call('message to log')
|
62
|
+
#> 19/Oct/2019 20:28:53 - 127.0.0.1:51266 - message to log
|
63
|
+
```
|
64
|
+
|
65
|
+
|
66
|
+
## Example of an application
|
67
|
+
|
68
|
+
Let's look at an example of a simple application which just echoes
|
69
|
+
incoming string:
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
# config/puma.rb
|
73
|
+
app do |env, socket|
|
74
|
+
s = socket.gets
|
75
|
+
socket.puts "Echo #{s}"
|
76
|
+
end
|
77
|
+
```
|
78
|
+
|
79
|
+
We can easily access the TCP server with `telnet` command and receive an
|
80
|
+
echo:
|
81
|
+
|
82
|
+
```shell
|
83
|
+
telnet 0.0.0.0 9293
|
84
|
+
Trying 0.0.0.0...
|
85
|
+
Connected to 0.0.0.0.
|
86
|
+
Escape character is '^]'.
|
87
|
+
sssss
|
88
|
+
Echo sssss
|
89
|
+
^CConnection closed by foreign host.
|
90
|
+
```
|
91
|
+
|
92
|
+
|
93
|
+
## Socket management
|
94
|
+
|
95
|
+
After the application finishes, Puma closes the socket. In order to
|
96
|
+
prevent this, the application should set `env['detach'] = true`.
|
@@ -6,11 +6,13 @@ import org.jruby.Ruby;
|
|
6
6
|
import org.jruby.runtime.load.BasicLibraryService;
|
7
7
|
|
8
8
|
import org.jruby.puma.Http11;
|
9
|
+
import org.jruby.puma.IOBuffer;
|
9
10
|
import org.jruby.puma.MiniSSL;
|
10
11
|
|
11
12
|
public class PumaHttp11Service implements BasicLibraryService {
|
12
13
|
public boolean basicLoad(final Ruby runtime) throws IOException {
|
13
14
|
Http11.createHttp11(runtime);
|
15
|
+
IOBuffer.createIOBuffer(runtime);
|
14
16
|
MiniSSL.createMiniSSL(runtime);
|
15
17
|
return true;
|
16
18
|
}
|
data/ext/puma_http11/extconf.rb
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
require 'mkmf'
|
2
2
|
|
3
3
|
dir_config("puma_http11")
|
4
|
+
if $mingw && RUBY_VERSION >= '2.4'
|
5
|
+
append_cflags '-D_FORTIFY_SOURCE=2'
|
6
|
+
append_ldflags '-fstack-protector'
|
7
|
+
have_library 'ssp'
|
8
|
+
end
|
4
9
|
|
5
10
|
unless ENV["DISABLE_SSL"]
|
6
11
|
dir_config("openssl")
|
@@ -9,6 +14,14 @@ unless ENV["DISABLE_SSL"]
|
|
9
14
|
%w'ssl ssleay32'.find {|ssl| have_library(ssl, 'SSL_CTX_new')}
|
10
15
|
|
11
16
|
have_header "openssl/bio.h"
|
17
|
+
|
18
|
+
# below is yes for 1.0.2 & later
|
19
|
+
have_func "DTLS_method" , "openssl/ssl.h"
|
20
|
+
|
21
|
+
# below are yes for 1.1.0 & later, may need to check func rather than macro
|
22
|
+
# with versions after 1.1.1
|
23
|
+
have_func "TLS_server_method" , "openssl/ssl.h"
|
24
|
+
have_macro "SSL_CTX_set_min_proto_version", "openssl/ssl.h"
|
12
25
|
end
|
13
26
|
end
|
14
27
|
|
@@ -14,12 +14,14 @@
|
|
14
14
|
|
15
15
|
/*
|
16
16
|
* capitalizes all lower-case ASCII characters,
|
17
|
-
* converts dashes to underscores.
|
17
|
+
* converts dashes to underscores, and underscores to commas.
|
18
18
|
*/
|
19
19
|
static void snake_upcase_char(char *c)
|
20
20
|
{
|
21
21
|
if (*c >= 'a' && *c <= 'z')
|
22
22
|
*c &= ~0x20;
|
23
|
+
else if (*c == '_')
|
24
|
+
*c = ',';
|
23
25
|
else if (*c == '-')
|
24
26
|
*c = '_';
|
25
27
|
}
|
@@ -38,7 +40,7 @@ static void snake_upcase_char(char *c)
|
|
38
40
|
|
39
41
|
#line 40 "ext/puma_http11/http11_parser.c"
|
40
42
|
static const int puma_parser_start = 1;
|
41
|
-
static const int puma_parser_first_final =
|
43
|
+
static const int puma_parser_first_final = 46;
|
42
44
|
static const int puma_parser_error = 0;
|
43
45
|
|
44
46
|
static const int puma_parser_en_main = 1;
|
@@ -117,17 +119,17 @@ case 2:
|
|
117
119
|
#line 118 "ext/puma_http11/http11_parser.c"
|
118
120
|
switch( (*p) ) {
|
119
121
|
case 32: goto tr2;
|
120
|
-
case 36: goto
|
121
|
-
case 95: goto
|
122
|
+
case 36: goto st27;
|
123
|
+
case 95: goto st27;
|
122
124
|
}
|
123
125
|
if ( (*p) < 48 ) {
|
124
126
|
if ( 45 <= (*p) && (*p) <= 46 )
|
125
|
-
goto
|
127
|
+
goto st27;
|
126
128
|
} else if ( (*p) > 57 ) {
|
127
129
|
if ( 65 <= (*p) && (*p) <= 90 )
|
128
|
-
goto
|
130
|
+
goto st27;
|
129
131
|
} else
|
130
|
-
goto
|
132
|
+
goto st27;
|
131
133
|
goto st0;
|
132
134
|
tr2:
|
133
135
|
#line 48 "ext/puma_http11/http11_parser.rl"
|
@@ -199,7 +201,7 @@ tr37:
|
|
199
201
|
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
|
200
202
|
}
|
201
203
|
goto st5;
|
202
|
-
|
204
|
+
tr41:
|
203
205
|
#line 58 "ext/puma_http11/http11_parser.rl"
|
204
206
|
{ MARK(query_start, p); }
|
205
207
|
#line 59 "ext/puma_http11/http11_parser.rl"
|
@@ -211,7 +213,7 @@ tr44:
|
|
211
213
|
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
|
212
214
|
}
|
213
215
|
goto st5;
|
214
|
-
|
216
|
+
tr44:
|
215
217
|
#line 59 "ext/puma_http11/http11_parser.rl"
|
216
218
|
{
|
217
219
|
parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
|
@@ -362,13 +364,13 @@ tr22:
|
|
362
364
|
{
|
363
365
|
parser->body_start = p - buffer + 1;
|
364
366
|
parser->header_done(parser, p + 1, pe - p - 1);
|
365
|
-
{p++; cs =
|
367
|
+
{p++; cs = 46; goto _out;}
|
366
368
|
}
|
367
|
-
goto
|
368
|
-
|
369
|
+
goto st46;
|
370
|
+
st46:
|
369
371
|
if ( ++p == pe )
|
370
|
-
goto
|
371
|
-
case
|
372
|
+
goto _test_eof46;
|
373
|
+
case 46:
|
372
374
|
#line 373 "ext/puma_http11/http11_parser.c"
|
373
375
|
goto st0;
|
374
376
|
tr21:
|
@@ -458,7 +460,7 @@ tr38:
|
|
458
460
|
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
|
459
461
|
}
|
460
462
|
goto st20;
|
461
|
-
|
463
|
+
tr42:
|
462
464
|
#line 58 "ext/puma_http11/http11_parser.rl"
|
463
465
|
{ MARK(query_start, p); }
|
464
466
|
#line 59 "ext/puma_http11/http11_parser.rl"
|
@@ -470,7 +472,7 @@ tr45:
|
|
470
472
|
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
|
471
473
|
}
|
472
474
|
goto st20;
|
473
|
-
|
475
|
+
tr45:
|
474
476
|
#line 59 "ext/puma_http11/http11_parser.rl"
|
475
477
|
{
|
476
478
|
parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
|
@@ -576,10 +578,9 @@ case 24:
|
|
576
578
|
case 32: goto tr37;
|
577
579
|
case 34: goto st0;
|
578
580
|
case 35: goto tr38;
|
579
|
-
case 59: goto tr39;
|
580
581
|
case 60: goto st0;
|
581
582
|
case 62: goto st0;
|
582
|
-
case 63: goto
|
583
|
+
case 63: goto tr39;
|
583
584
|
case 127: goto st0;
|
584
585
|
}
|
585
586
|
if ( 0 <= (*p) && (*p) <= 31 )
|
@@ -595,30 +596,27 @@ st25:
|
|
595
596
|
if ( ++p == pe )
|
596
597
|
goto _test_eof25;
|
597
598
|
case 25:
|
598
|
-
#line
|
599
|
+
#line 598 "ext/puma_http11/http11_parser.c"
|
599
600
|
switch( (*p) ) {
|
600
|
-
case 32: goto
|
601
|
+
case 32: goto tr41;
|
601
602
|
case 34: goto st0;
|
602
|
-
case 35: goto
|
603
|
+
case 35: goto tr42;
|
603
604
|
case 60: goto st0;
|
604
605
|
case 62: goto st0;
|
605
|
-
case 63: goto st26;
|
606
606
|
case 127: goto st0;
|
607
607
|
}
|
608
608
|
if ( 0 <= (*p) && (*p) <= 31 )
|
609
609
|
goto st0;
|
610
|
-
goto
|
610
|
+
goto tr40;
|
611
611
|
tr40:
|
612
|
-
#line
|
613
|
-
{
|
614
|
-
parser->request_path(parser, PTR_TO(mark), LEN(mark,p));
|
615
|
-
}
|
612
|
+
#line 58 "ext/puma_http11/http11_parser.rl"
|
613
|
+
{ MARK(query_start, p); }
|
616
614
|
goto st26;
|
617
615
|
st26:
|
618
616
|
if ( ++p == pe )
|
619
617
|
goto _test_eof26;
|
620
618
|
case 26:
|
621
|
-
#line
|
619
|
+
#line 618 "ext/puma_http11/http11_parser.c"
|
622
620
|
switch( (*p) ) {
|
623
621
|
case 32: goto tr44;
|
624
622
|
case 34: goto st0;
|
@@ -629,27 +627,25 @@ case 26:
|
|
629
627
|
}
|
630
628
|
if ( 0 <= (*p) && (*p) <= 31 )
|
631
629
|
goto st0;
|
632
|
-
goto
|
633
|
-
tr43:
|
634
|
-
#line 58 "ext/puma_http11/http11_parser.rl"
|
635
|
-
{ MARK(query_start, p); }
|
636
|
-
goto st27;
|
630
|
+
goto st26;
|
637
631
|
st27:
|
638
632
|
if ( ++p == pe )
|
639
633
|
goto _test_eof27;
|
640
634
|
case 27:
|
641
|
-
#line 642 "ext/puma_http11/http11_parser.c"
|
642
635
|
switch( (*p) ) {
|
643
|
-
case 32: goto
|
644
|
-
case
|
645
|
-
case
|
646
|
-
case 60: goto st0;
|
647
|
-
case 62: goto st0;
|
648
|
-
case 127: goto st0;
|
636
|
+
case 32: goto tr2;
|
637
|
+
case 36: goto st28;
|
638
|
+
case 95: goto st28;
|
649
639
|
}
|
650
|
-
if (
|
651
|
-
|
652
|
-
|
640
|
+
if ( (*p) < 48 ) {
|
641
|
+
if ( 45 <= (*p) && (*p) <= 46 )
|
642
|
+
goto st28;
|
643
|
+
} else if ( (*p) > 57 ) {
|
644
|
+
if ( 65 <= (*p) && (*p) <= 90 )
|
645
|
+
goto st28;
|
646
|
+
} else
|
647
|
+
goto st28;
|
648
|
+
goto st0;
|
653
649
|
st28:
|
654
650
|
if ( ++p == pe )
|
655
651
|
goto _test_eof28;
|
@@ -960,24 +956,6 @@ st45:
|
|
960
956
|
if ( ++p == pe )
|
961
957
|
goto _test_eof45;
|
962
958
|
case 45:
|
963
|
-
switch( (*p) ) {
|
964
|
-
case 32: goto tr2;
|
965
|
-
case 36: goto st46;
|
966
|
-
case 95: goto st46;
|
967
|
-
}
|
968
|
-
if ( (*p) < 48 ) {
|
969
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
970
|
-
goto st46;
|
971
|
-
} else if ( (*p) > 57 ) {
|
972
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
973
|
-
goto st46;
|
974
|
-
} else
|
975
|
-
goto st46;
|
976
|
-
goto st0;
|
977
|
-
st46:
|
978
|
-
if ( ++p == pe )
|
979
|
-
goto _test_eof46;
|
980
|
-
case 46:
|
981
959
|
if ( (*p) == 32 )
|
982
960
|
goto tr2;
|
983
961
|
goto st0;
|
@@ -997,7 +975,7 @@ case 46:
|
|
997
975
|
_test_eof14: cs = 14; goto _test_eof;
|
998
976
|
_test_eof15: cs = 15; goto _test_eof;
|
999
977
|
_test_eof16: cs = 16; goto _test_eof;
|
1000
|
-
|
978
|
+
_test_eof46: cs = 46; goto _test_eof;
|
1001
979
|
_test_eof17: cs = 17; goto _test_eof;
|
1002
980
|
_test_eof18: cs = 18; goto _test_eof;
|
1003
981
|
_test_eof19: cs = 19; goto _test_eof;
|
@@ -1027,7 +1005,6 @@ case 46:
|
|
1027
1005
|
_test_eof43: cs = 43; goto _test_eof;
|
1028
1006
|
_test_eof44: cs = 44; goto _test_eof;
|
1029
1007
|
_test_eof45: cs = 45; goto _test_eof;
|
1030
|
-
_test_eof46: cs = 46; goto _test_eof;
|
1031
1008
|
|
1032
1009
|
_test_eof: {}
|
1033
1010
|
_out: {}
|