puma 4.3.5-java → 5.0.1-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/History.md +1149 -518
- data/LICENSE +23 -20
- data/README.md +26 -13
- data/docs/architecture.md +3 -3
- data/docs/deployment.md +9 -3
- data/docs/fork_worker.md +31 -0
- data/docs/jungle/README.md +13 -0
- data/{tools → docs}/jungle/rc.d/README.md +0 -0
- data/{tools → docs}/jungle/rc.d/puma +0 -0
- data/{tools → docs}/jungle/rc.d/puma.conf +0 -0
- data/{tools → docs}/jungle/upstart/README.md +0 -0
- data/{tools → docs}/jungle/upstart/puma-manager.conf +0 -0
- data/{tools → docs}/jungle/upstart/puma.conf +0 -0
- data/docs/signals.md +7 -6
- data/docs/systemd.md +1 -63
- data/ext/puma_http11/PumaHttp11Service.java +2 -4
- data/ext/puma_http11/extconf.rb +4 -3
- data/ext/puma_http11/http11_parser.c +64 -64
- data/ext/puma_http11/mini_ssl.c +15 -2
- data/ext/puma_http11/no_ssl/PumaHttp11Service.java +15 -0
- data/ext/puma_http11/org/jruby/puma/Http11.java +3 -3
- data/ext/puma_http11/org/jruby/puma/MiniSSL.java +77 -18
- data/ext/puma_http11/puma_http11.c +7 -38
- data/lib/puma.rb +20 -0
- data/lib/puma/app/status.rb +18 -3
- data/lib/puma/binder.rb +90 -68
- data/lib/puma/cli.rb +7 -15
- data/lib/puma/client.rb +62 -13
- data/lib/puma/cluster.rb +193 -74
- data/lib/puma/commonlogger.rb +2 -2
- data/lib/puma/configuration.rb +31 -42
- data/lib/puma/const.rb +3 -3
- data/lib/puma/control_cli.rb +29 -17
- data/lib/puma/detect.rb +17 -0
- data/lib/puma/dsl.rb +144 -70
- data/lib/puma/error_logger.rb +97 -0
- data/lib/puma/events.rb +37 -31
- data/lib/puma/io_buffer.rb +9 -2
- data/lib/puma/jruby_restart.rb +0 -58
- data/lib/puma/launcher.rb +57 -31
- data/lib/puma/minissl.rb +68 -18
- data/lib/puma/minissl/context_builder.rb +0 -3
- data/lib/puma/null_io.rb +1 -1
- data/lib/puma/plugin.rb +1 -10
- data/lib/puma/puma_http11.jar +0 -0
- data/lib/puma/rack/builder.rb +0 -4
- data/lib/puma/reactor.rb +10 -16
- data/lib/puma/runner.rb +13 -54
- data/lib/puma/server.rb +193 -241
- data/lib/puma/single.rb +8 -64
- data/lib/puma/state_file.rb +6 -3
- data/lib/puma/thread_pool.rb +116 -51
- data/lib/puma/util.rb +1 -0
- data/lib/rack/handler/puma.rb +1 -3
- data/tools/{docker/Dockerfile → Dockerfile} +0 -0
- metadata +17 -19
- data/docs/tcp_mode.md +0 -96
- data/ext/puma_http11/io_buffer.c +0 -155
- data/ext/puma_http11/org/jruby/puma/IOBuffer.java +0 -72
- data/lib/puma/tcp_logger.rb +0 -41
- data/tools/jungle/README.md +0 -19
- data/tools/jungle/init.d/README.md +0 -61
- data/tools/jungle/init.d/puma +0 -421
- data/tools/jungle/init.d/run-puma +0 -18
data/LICENSE
CHANGED
|
@@ -1,26 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019, Evan Phoenix. Some code by Zed Shaw, (c) 2005.
|
|
3
4
|
All rights reserved.
|
|
4
5
|
|
|
5
|
-
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
7
|
modification, are permitted provided that the following conditions are met:
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
17
|
+
contributors may be used to endorse or promote products derived from
|
|
18
|
+
this software without specific prior written permission.
|
|
16
19
|
|
|
17
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
18
|
-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
19
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
20
|
-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
21
|
-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
22
|
-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
23
|
-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
24
|
-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
25
|
-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
26
29
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
CHANGED
|
@@ -4,12 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
# Puma: A Ruby Web Server Built For Concurrency
|
|
6
6
|
|
|
7
|
-
[](https://github.com/puma/puma/actions)
|
|
9
|
-
[](https://travis-ci.org/puma/puma)
|
|
10
|
-
|
|
7
|
+
[](https://github.com/puma/puma/actions)
|
|
11
8
|
[](https://codeclimate.com/github/puma/puma)
|
|
12
9
|
[](https://dependabot.com/compatibility-score.html?dependency-name=puma&package-manager=bundler&version-scheme=semver)
|
|
10
|
+
[]( https://stackoverflow.com/questions/tagged/puma )
|
|
13
11
|
|
|
14
12
|
Puma is a **simple, fast, multi-threaded, and highly concurrent HTTP 1.1 server for Ruby/Rack applications**.
|
|
15
13
|
|
|
@@ -28,7 +26,16 @@ $ gem install puma
|
|
|
28
26
|
$ puma
|
|
29
27
|
```
|
|
30
28
|
|
|
31
|
-
Without arguments, puma will look for a rackup (.ru) file in
|
|
29
|
+
Without arguments, puma will look for a rackup (.ru) file in
|
|
30
|
+
working directory called `config.ru`.
|
|
31
|
+
|
|
32
|
+
## SSL Connection Support
|
|
33
|
+
|
|
34
|
+
Puma will install/compile with support for ssl sockets, assuming OpenSSL
|
|
35
|
+
development files are installed on the system.
|
|
36
|
+
|
|
37
|
+
If the system does not have OpenSSL development files installed, Puma will
|
|
38
|
+
install/compile, but it will not allow ssl connections.
|
|
32
39
|
|
|
33
40
|
## Frameworks
|
|
34
41
|
|
|
@@ -68,7 +75,7 @@ configure { set :server, :puma }
|
|
|
68
75
|
Puma provides numerous options. Consult `puma -h` (or `puma --help`) for a full list of CLI options, or see [dsl.rb](https://github.com/puma/puma/blob/master/lib/puma/dsl.rb).
|
|
69
76
|
|
|
70
77
|
You can also find several configuration examples as part of the
|
|
71
|
-
[test](test/config) suite.
|
|
78
|
+
[test](https://github.com/puma/puma/tree/master/test/config) suite.
|
|
72
79
|
|
|
73
80
|
### Thread Pool
|
|
74
81
|
|
|
@@ -78,7 +85,7 @@ Puma uses a thread pool. You can set the minimum and maximum number of threads t
|
|
|
78
85
|
$ puma -t 8:32
|
|
79
86
|
```
|
|
80
87
|
|
|
81
|
-
Puma will automatically scale the number of threads, from the minimum until it caps out at the maximum, based on how much traffic is present. The current default is `0:16`. Feel free to experiment, but be careful not to set the number of maximum threads to a large number, as you may exhaust resources on the system (or cause contention for the Global VM Lock, when using MRI).
|
|
88
|
+
Puma will automatically scale the number of threads, from the minimum until it caps out at the maximum, based on how much traffic is present. The current default is `0:16` and on MRI is `0:5`. Feel free to experiment, but be careful not to set the number of maximum threads to a large number, as you may exhaust resources on the system (or cause contention for the Global VM Lock, when using MRI).
|
|
82
89
|
|
|
83
90
|
Be aware that additionally Puma creates threads on its own for internal purposes (e.g. handling slow clients). So, even if you specify -t 1:1, expect around 7 threads created in your application.
|
|
84
91
|
|
|
@@ -135,7 +142,7 @@ Preloading can’t be used with phased restart, since phased restart kills and r
|
|
|
135
142
|
If puma encounters an error outside of the context of your application, it will respond with a 500 and a simple
|
|
136
143
|
textual error message (see `lowlevel_error` in [this file](https://github.com/puma/puma/blob/master/lib/puma/server.rb)).
|
|
137
144
|
You can specify custom behavior for this scenario. For example, you can report the error to your third-party
|
|
138
|
-
error-tracking service (in this example, [rollbar](
|
|
145
|
+
error-tracking service (in this example, [rollbar](https://rollbar.com)):
|
|
139
146
|
|
|
140
147
|
```ruby
|
|
141
148
|
lowlevel_error_handler do |e|
|
|
@@ -220,7 +227,7 @@ You can also provide a configuration file with the `-C` (or `--config`) flag:
|
|
|
220
227
|
$ puma -C /path/to/config
|
|
221
228
|
```
|
|
222
229
|
|
|
223
|
-
If no configuration file is specified, Puma will look for a configuration file at `config/puma.rb`. If an environment is specified, either via the `-e` and `--environment` flags, or through the `RACK_ENV` environment
|
|
230
|
+
If no configuration file is specified, Puma will look for a configuration file at `config/puma.rb`. If an environment is specified, either via the `-e` and `--environment` flags, or through the `RACK_ENV` or the `RAILS_ENV` environment variables, Puma looks for configuration at `config/puma/<environment_name>.rb`.
|
|
224
231
|
|
|
225
232
|
If you want to prevent Puma from looking for a configuration file in those locations, provide a dash as the argument to the `-C` (or `--config`) flag:
|
|
226
233
|
|
|
@@ -251,7 +258,7 @@ Some platforms do not support all Puma features.
|
|
|
251
258
|
|
|
252
259
|
## Known Bugs
|
|
253
260
|
|
|
254
|
-
For MRI versions 2.2.7, 2.2.8, 2.2.9, 2.2.10 2.3.4 and 2.4.1, you may see ```stream closed in another thread (IOError)```. It may be caused by a [Ruby bug](https://bugs.ruby-lang.org/issues/13632). It can be fixed with the gem https://rubygems.org/gems/stopgap_13632:
|
|
261
|
+
For MRI versions 2.2.7, 2.2.8, 2.2.9, 2.2.10, 2.3.4 and 2.4.1, you may see ```stream closed in another thread (IOError)```. It may be caused by a [Ruby bug](https://bugs.ruby-lang.org/issues/13632). It can be fixed with the gem https://rubygems.org/gems/stopgap_13632:
|
|
255
262
|
|
|
256
263
|
```ruby
|
|
257
264
|
if %w(2.2.7 2.2.8 2.2.9 2.2.10 2.3.4 2.4.1).include? RUBY_VERSION
|
|
@@ -270,16 +277,22 @@ It is common to use process monitors with Puma. Modern process monitors like sys
|
|
|
270
277
|
provide continuous monitoring and restarts for increased
|
|
271
278
|
reliability in production environments:
|
|
272
279
|
|
|
273
|
-
* [
|
|
280
|
+
* [docs/jungle](https://github.com/puma/puma/tree/master/docs/jungle) for rc.d and upstart
|
|
274
281
|
* [docs/systemd](https://github.com/puma/puma/blob/master/docs/systemd.md)
|
|
275
282
|
|
|
276
|
-
## Community
|
|
283
|
+
## Community Extensions
|
|
277
284
|
|
|
278
|
-
|
|
285
|
+
### Plugins
|
|
286
|
+
|
|
287
|
+
* [puma-heroku](https://github.com/puma/puma-heroku) — default Puma configuration for running on Heroku
|
|
279
288
|
* [puma-metrics](https://github.com/harmjanblok/puma-metrics) — export Puma metrics to Prometheus
|
|
280
289
|
* [puma-plugin-statsd](https://github.com/yob/puma-plugin-statsd) — send Puma metrics to statsd
|
|
281
290
|
* [puma-plugin-systemd](https://github.com/sj26/puma-plugin-systemd) — deeper integration with systemd for notify, status and watchdog
|
|
282
291
|
|
|
292
|
+
### Monitoring
|
|
293
|
+
|
|
294
|
+
* [puma-status](https://github.com/ylecuyer/puma-status) — Monitor CPU/Mem/Load of running puma instances from the CLI
|
|
295
|
+
|
|
283
296
|
## Contributing
|
|
284
297
|
|
|
285
298
|
Find details for contributing in the [contribution guide].
|
data/docs/architecture.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
4
|
|
|
5
|
-

|
|
6
6
|
|
|
7
7
|
Puma is a threaded web server, processing requests across a TCP or UNIX socket.
|
|
8
8
|
|
|
@@ -12,7 +12,7 @@ Clustered mode is shown/discussed here. Single mode is analogous to having a sin
|
|
|
12
12
|
|
|
13
13
|
## Connection pipeline
|
|
14
14
|
|
|
15
|
-

|
|
16
16
|
|
|
17
17
|
* Upon startup, Puma listens on a TCP or UNIX socket.
|
|
18
18
|
* The backlog of this socket is configured (with a default of 1024), determining how many established but unaccepted connections can exist concurrently.
|
|
@@ -29,7 +29,7 @@ Clustered mode is shown/discussed here. Single mode is analogous to having a sin
|
|
|
29
29
|
|
|
30
30
|
### Disabling `queue_requests`
|
|
31
31
|
|
|
32
|
-

|
|
33
33
|
|
|
34
34
|
The `queue_requests` option is `true` by default, enabling the separate thread used to buffer requests as described above.
|
|
35
35
|
|
data/docs/deployment.md
CHANGED
|
@@ -20,7 +20,10 @@ Welcome back!
|
|
|
20
20
|
Puma was originally conceived as a thread-only webserver, but grew the ability to
|
|
21
21
|
also use processes in version 2.
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
To run puma in single mode (e.g. for a development environment) you will need to
|
|
24
|
+
set the number of workers to 0, anything above will run in cluster mode.
|
|
25
|
+
|
|
26
|
+
Here are some rules of thumb for cluster mode:
|
|
24
27
|
|
|
25
28
|
### MRI
|
|
26
29
|
|
|
@@ -66,7 +69,8 @@ thread to become available.
|
|
|
66
69
|
|
|
67
70
|
* Have your upstream proxy set a header with the time it received the request:
|
|
68
71
|
* nginx: `proxy_set_header X-Request-Start "${msec}";`
|
|
69
|
-
* haproxy: `http-request set-header X-Request-Start
|
|
72
|
+
* haproxy >= 1.9: `http-request set-header X-Request-Start t=%[date()]%[date_us()]`
|
|
73
|
+
* haproxy < 1.9: `http-request set-header X-Request-Start t=%[date()]`
|
|
70
74
|
* In your Rack middleware, determine the amount of time elapsed since `X-Request-Start`.
|
|
71
75
|
* To improve accuracy, you will want to subtract time spent waiting for slow clients:
|
|
72
76
|
* `env['puma.request_body_wait']` contains the number of milliseconds Puma spent
|
|
@@ -74,7 +78,9 @@ thread to become available.
|
|
|
74
78
|
* haproxy: `%Th` (TLS handshake time) and `%Ti` (idle time before request) can
|
|
75
79
|
can also be added as headers.
|
|
76
80
|
|
|
77
|
-
##
|
|
81
|
+
## Should I daemonize?
|
|
82
|
+
|
|
83
|
+
Daemonization was removed in Puma 5.0. For alternatives, continue reading.
|
|
78
84
|
|
|
79
85
|
I prefer to not daemonize my servers and use something like `runit` or `upstart` to
|
|
80
86
|
monitor them as child processes. This gives them fast response to crashes and
|
data/docs/fork_worker.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Fork-Worker Cluster Mode [Experimental]
|
|
2
|
+
|
|
3
|
+
Puma 5 introduces an experimental new cluster-mode configuration option, `fork_worker` (`--fork-worker` from the CLI). This mode causes Puma to fork additional workers from worker 0, instead of directly from the master process:
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
10000 \_ puma 4.3.3 (tcp://0.0.0.0:9292) [puma]
|
|
7
|
+
10001 \_ puma: cluster worker 0: 10000 [puma]
|
|
8
|
+
10002 \_ puma: cluster worker 1: 10000 [puma]
|
|
9
|
+
10003 \_ puma: cluster worker 2: 10000 [puma]
|
|
10
|
+
10004 \_ puma: cluster worker 3: 10000 [puma]
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Similar to the `preload_app!` option, the `fork_worker` option allows your application to be initialized only once for copy-on-write memory savings, and it has two additional advantages:
|
|
14
|
+
|
|
15
|
+
1. **Compatible with phased restart.** Because the master process itself doesn't preload the application, this mode works with phased restart (`SIGUSR1` or `pumactl phased-restart`). When worker 0 reloads as part of a phased restart, it initializes a new copy of your application first, then the other workers reload by forking from this new worker already containing the new preloaded application.
|
|
16
|
+
|
|
17
|
+
This allows a phased restart to complete as quickly as a hot restart (`SIGUSR2` or `pumactl restart`), while still minimizing downtime by staggering the restart across cluster workers.
|
|
18
|
+
|
|
19
|
+
2. **'Refork' for additional copy-on-write improvements in running applications.** Fork-worker mode introduces a new `refork` command that re-loads all nonzero workers by re-forking them from worker 0.
|
|
20
|
+
|
|
21
|
+
This command can potentially improve memory utilization in large or complex applications that don't fully pre-initialize on startup, because the re-forked workers can share copy-on-write memory with a worker that has been running for a while and serving requests.
|
|
22
|
+
|
|
23
|
+
You can trigger a refork by sending the cluster the `SIGURG` signal or running the `pumactl refork` command at any time. A refork will also automatically trigger once, after a certain number of requests have been processed by worker 0 (default 1000). To configure the number of requests before the auto-refork, pass a positive integer argument to `fork_worker` (e.g., `fork_worker 1000`), or `0` to disable.
|
|
24
|
+
|
|
25
|
+
### Limitations
|
|
26
|
+
|
|
27
|
+
- This mode is still very experimental so there may be bugs or edge-cases, particularly around expected behavior of existing hooks. Please open a [bug report](https://github.com/puma/puma/issues/new?template=bug_report.md) if you encounter any issues.
|
|
28
|
+
|
|
29
|
+
- In order to fork new workers cleanly, worker 0 shuts down its server and stops serving requests so there are no open file descriptors or other kinds of shared global state between processes, and to maximize copy-on-write efficiency across the newly-forked workers. This may temporarily reduce total capacity of the cluster during a phased restart / refork.
|
|
30
|
+
|
|
31
|
+
In a cluster with `n` workers, a normal phased restart stops and restarts workers one by one while the application is loaded in each process, so `n-1` workers are available serving requests during the restart. In a phased restart in fork-worker mode, the application is first loaded in worker 0 while `n-1` workers are available, then worker 0 remains stopped while the rest of the workers are reloaded one by one, leaving only `n-2` workers to be available for a brief period of time. Reloading the rest of the workers should be quick because the application is preloaded at that point, but there may be situations where it can take longer (slow clients, long-running application code, slow worker-fork hooks, etc).
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Puma as a service
|
|
2
|
+
|
|
3
|
+
## Upstart
|
|
4
|
+
|
|
5
|
+
See `/docs/jungle/upstart` for Ubuntu's upstart scripts.
|
|
6
|
+
|
|
7
|
+
## Systemd
|
|
8
|
+
|
|
9
|
+
See [/docs/systemd](https://github.com/puma/puma/blob/master/docs/systemd.md).
|
|
10
|
+
|
|
11
|
+
## rc.d
|
|
12
|
+
|
|
13
|
+
See `/docs/jungle/rc.d` for FreeBSD's rc.d scripts
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/docs/signals.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
The [unix signal](
|
|
1
|
+
The [unix signal](https://en.wikipedia.org/wiki/Unix_signal) is a method of sending messages between [processes](https://en.wikipedia.org/wiki/Process_(computing)). When a signal is sent, the operating system interrupts the target process's normal flow of execution. There are standard signals that are used to stop a process but there are also custom signals that can be used for other purposes. This document is an attempt to list all supported signals that Puma will respond to. In general, signals need only be sent to the master process of a cluster.
|
|
2
2
|
|
|
3
3
|
## Sending Signals
|
|
4
4
|
|
|
5
|
-
If you are new to signals it can be useful to see how they can be used. When a process is created in a *nix like operating system it will have a [PID - or process identifier](
|
|
5
|
+
If you are new to signals it can be useful to see how they can be used. When a process is created in a *nix like operating system it will have a [PID - or process identifier](https://en.wikipedia.org/wiki/Process_identifier) that can be used to send signals to the process. For demonstration we will create an infinitely running process by tailing a file:
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
8
|
$ echo "foo" >> my.log
|
|
@@ -17,13 +17,13 @@ $ ps aux | grep tail
|
|
|
17
17
|
schneems 87152 0.0 0.0 2432772 492 s032 S+ 12:46PM 0:00.00 tail -f my.log
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
You can send a signal in Ruby using the [Process module](
|
|
20
|
+
You can send a signal in Ruby using the [Process module](https://www.ruby-doc.org/core-2.1.1/Process.html#kill-method):
|
|
21
21
|
|
|
22
22
|
```
|
|
23
23
|
$ irb
|
|
24
24
|
> puts pid
|
|
25
25
|
=> 87152
|
|
26
|
-
Process.detach(pid) #
|
|
26
|
+
Process.detach(pid) # https://ruby-doc.org/core-2.1.1/Process.html#method-c-detach
|
|
27
27
|
Process.kill("TERM", pid)
|
|
28
28
|
```
|
|
29
29
|
|
|
@@ -38,9 +38,10 @@ Puma cluster responds to these signals:
|
|
|
38
38
|
- `TERM` send `TERM` to worker. Worker will attempt to finish then exit.
|
|
39
39
|
- `USR2` restart workers. This also reloads puma configuration file, if there is one.
|
|
40
40
|
- `USR1` restart workers in phases, a rolling restart. This will not reload configuration file.
|
|
41
|
-
- `HUP`
|
|
42
|
-
- `INT` equivalent of sending Ctrl-C to cluster. Will attempt to finish then exit.
|
|
41
|
+
- `HUP ` reopen log files defined in stdout_redirect configuration parameter. If there is no stdout_redirect option provided it will behave like `INT`
|
|
42
|
+
- `INT ` equivalent of sending Ctrl-C to cluster. Will attempt to finish then exit.
|
|
43
43
|
- `CHLD`
|
|
44
|
+
- `URG ` refork workers in phases from worker 0, if `fork_workers` option is enabled.
|
|
44
45
|
|
|
45
46
|
## Callbacks order in case of different signals
|
|
46
47
|
|
data/docs/systemd.md
CHANGED
|
@@ -13,9 +13,7 @@ desired, using an application or instance specific name.
|
|
|
13
13
|
|
|
14
14
|
Note that this uses the systemd preferred "simple" type where the
|
|
15
15
|
start command remains running in the foreground (does not fork and
|
|
16
|
-
exit).
|
|
17
|
-
[Alternative Forking Configuration](#alternative-forking-configuration)
|
|
18
|
-
below.
|
|
16
|
+
exit).
|
|
19
17
|
|
|
20
18
|
~~~~ ini
|
|
21
19
|
[Unit]
|
|
@@ -209,66 +207,6 @@ Apr 07 08:40:19 hx puma[28320]: * Activated ssl://0.0.0.0:9234?key=key.pem&cert=
|
|
|
209
207
|
Apr 07 08:40:19 hx puma[28320]: Use Ctrl-C to stop
|
|
210
208
|
~~~~
|
|
211
209
|
|
|
212
|
-
## Alternative Forking Configuration
|
|
213
|
-
|
|
214
|
-
Other systems/tools might expect or need puma to be run as a
|
|
215
|
-
"traditional" forking server, for example so that the `pumactl`
|
|
216
|
-
command can be used directly and outside of systemd for
|
|
217
|
-
stop/start/restart. This use case is incompatible with systemd socket
|
|
218
|
-
activation, so it should not be configured. Below is an alternative
|
|
219
|
-
puma.service config sample, using `Type=forking` and the `--daemon`
|
|
220
|
-
flag in `ExecStart`. Here systemd is playing a role more equivalent to
|
|
221
|
-
SysV init.d, where it is responsible for starting Puma on boot
|
|
222
|
-
(multi-user.target) and stopping it on shutdown, but is not performing
|
|
223
|
-
continuous restarts. Therefore running Puma in cluster mode, where the
|
|
224
|
-
master can restart workers, is highly recommended. See the systemd
|
|
225
|
-
[Restart] directive for details.
|
|
226
|
-
|
|
227
|
-
~~~~ ini
|
|
228
|
-
[Unit]
|
|
229
|
-
Description=Puma HTTP Forking Server
|
|
230
|
-
After=network.target
|
|
231
|
-
|
|
232
|
-
[Service]
|
|
233
|
-
# Background process configuration (use with --daemon in ExecStart)
|
|
234
|
-
Type=forking
|
|
235
|
-
|
|
236
|
-
# Preferably configure a non-privileged user
|
|
237
|
-
# User=
|
|
238
|
-
|
|
239
|
-
# The path to the puma application root
|
|
240
|
-
# Also replace the "<WD>" place holders below with this path.
|
|
241
|
-
WorkingDirectory=
|
|
242
|
-
|
|
243
|
-
# The command to start Puma
|
|
244
|
-
# (replace "<WD>" below)
|
|
245
|
-
ExecStart=bundle exec puma -C <WD>/shared/puma.rb --daemon
|
|
246
|
-
|
|
247
|
-
# The command to stop Puma
|
|
248
|
-
# (replace "<WD>" below)
|
|
249
|
-
ExecStop=bundle exec pumactl -S <WD>/shared/tmp/pids/puma.state stop
|
|
250
|
-
|
|
251
|
-
# Path to PID file so that systemd knows which is the master process
|
|
252
|
-
PIDFile=<WD>/shared/tmp/pids/puma.pid
|
|
253
|
-
|
|
254
|
-
# Should systemd restart puma?
|
|
255
|
-
# Use "no" (the default) to ensure no interference when using
|
|
256
|
-
# stop/start/restart via `pumactl`. The "on-failure" setting might
|
|
257
|
-
# work better for this purpose, but you must test it.
|
|
258
|
-
# Use "always" if only `systemctl` is used for start/stop/restart, and
|
|
259
|
-
# reconsider if you actually need the forking config.
|
|
260
|
-
Restart=no
|
|
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
|
-
|
|
268
|
-
[Install]
|
|
269
|
-
WantedBy=multi-user.target
|
|
270
|
-
~~~~
|
|
271
|
-
|
|
272
210
|
### capistrano3-puma
|
|
273
211
|
|
|
274
212
|
By default,
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
package puma;
|
|
2
2
|
|
|
3
3
|
import java.io.IOException;
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
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;
|
|
10
9
|
import org.jruby.puma.MiniSSL;
|
|
11
10
|
|
|
12
|
-
public class PumaHttp11Service implements BasicLibraryService {
|
|
11
|
+
public class PumaHttp11Service implements BasicLibraryService {
|
|
13
12
|
public boolean basicLoad(final Ruby runtime) throws IOException {
|
|
14
13
|
Http11.createHttp11(runtime);
|
|
15
|
-
IOBuffer.createIOBuffer(runtime);
|
|
16
14
|
MiniSSL.createMiniSSL(runtime);
|
|
17
15
|
return true;
|
|
18
16
|
}
|
data/ext/puma_http11/extconf.rb
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
require 'mkmf'
|
|
2
2
|
|
|
3
3
|
dir_config("puma_http11")
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
|
|
5
|
+
if $mingw && RUBY_VERSION >= '2.4'
|
|
6
|
+
append_cflags '-fstack-protector-strong -D_FORTIFY_SOURCE=2'
|
|
7
|
+
append_ldflags '-fstack-protector-strong -l:libssp.a'
|
|
7
8
|
have_library 'ssp'
|
|
8
9
|
end
|
|
9
10
|
|
|
@@ -33,12 +33,12 @@ static void snake_upcase_char(char *c)
|
|
|
33
33
|
/** Machine **/
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
#line
|
|
36
|
+
#line 81 "ext/puma_http11/http11_parser.rl"
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
/** Data **/
|
|
40
40
|
|
|
41
|
-
#line
|
|
41
|
+
#line 42 "ext/puma_http11/http11_parser.c"
|
|
42
42
|
static const int puma_parser_start = 1;
|
|
43
43
|
static const int puma_parser_first_final = 46;
|
|
44
44
|
static const int puma_parser_error = 0;
|
|
@@ -46,17 +46,17 @@ static const int puma_parser_error = 0;
|
|
|
46
46
|
static const int puma_parser_en_main = 1;
|
|
47
47
|
|
|
48
48
|
|
|
49
|
-
#line
|
|
49
|
+
#line 85 "ext/puma_http11/http11_parser.rl"
|
|
50
50
|
|
|
51
51
|
int puma_parser_init(puma_parser *parser) {
|
|
52
52
|
int cs = 0;
|
|
53
53
|
|
|
54
|
-
#line
|
|
54
|
+
#line 55 "ext/puma_http11/http11_parser.c"
|
|
55
55
|
{
|
|
56
56
|
cs = puma_parser_start;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
#line
|
|
59
|
+
#line 89 "ext/puma_http11/http11_parser.rl"
|
|
60
60
|
parser->cs = cs;
|
|
61
61
|
parser->body_start = 0;
|
|
62
62
|
parser->content_len = 0;
|
|
@@ -85,7 +85,7 @@ size_t puma_parser_execute(puma_parser *parser, const char *buffer, size_t len,
|
|
|
85
85
|
assert((size_t) (pe - p) == len - off && "pointers aren't same distance");
|
|
86
86
|
|
|
87
87
|
|
|
88
|
-
#line
|
|
88
|
+
#line 89 "ext/puma_http11/http11_parser.c"
|
|
89
89
|
{
|
|
90
90
|
if ( p == pe )
|
|
91
91
|
goto _test_eof;
|
|
@@ -109,14 +109,14 @@ st0:
|
|
|
109
109
|
cs = 0;
|
|
110
110
|
goto _out;
|
|
111
111
|
tr0:
|
|
112
|
-
#line
|
|
112
|
+
#line 37 "ext/puma_http11/http11_parser.rl"
|
|
113
113
|
{ MARK(mark, p); }
|
|
114
114
|
goto st2;
|
|
115
115
|
st2:
|
|
116
116
|
if ( ++p == pe )
|
|
117
117
|
goto _test_eof2;
|
|
118
118
|
case 2:
|
|
119
|
-
#line
|
|
119
|
+
#line 120 "ext/puma_http11/http11_parser.c"
|
|
120
120
|
switch( (*p) ) {
|
|
121
121
|
case 32: goto tr2;
|
|
122
122
|
case 36: goto st27;
|
|
@@ -132,7 +132,7 @@ case 2:
|
|
|
132
132
|
goto st27;
|
|
133
133
|
goto st0;
|
|
134
134
|
tr2:
|
|
135
|
-
#line
|
|
135
|
+
#line 50 "ext/puma_http11/http11_parser.rl"
|
|
136
136
|
{
|
|
137
137
|
parser->request_method(parser, PTR_TO(mark), LEN(mark, p));
|
|
138
138
|
}
|
|
@@ -141,7 +141,7 @@ st3:
|
|
|
141
141
|
if ( ++p == pe )
|
|
142
142
|
goto _test_eof3;
|
|
143
143
|
case 3:
|
|
144
|
-
#line
|
|
144
|
+
#line 145 "ext/puma_http11/http11_parser.c"
|
|
145
145
|
switch( (*p) ) {
|
|
146
146
|
case 42: goto tr4;
|
|
147
147
|
case 43: goto tr5;
|
|
@@ -158,67 +158,67 @@ case 3:
|
|
|
158
158
|
goto tr5;
|
|
159
159
|
goto st0;
|
|
160
160
|
tr4:
|
|
161
|
-
#line
|
|
161
|
+
#line 37 "ext/puma_http11/http11_parser.rl"
|
|
162
162
|
{ MARK(mark, p); }
|
|
163
163
|
goto st4;
|
|
164
164
|
st4:
|
|
165
165
|
if ( ++p == pe )
|
|
166
166
|
goto _test_eof4;
|
|
167
167
|
case 4:
|
|
168
|
-
#line
|
|
168
|
+
#line 169 "ext/puma_http11/http11_parser.c"
|
|
169
169
|
switch( (*p) ) {
|
|
170
170
|
case 32: goto tr8;
|
|
171
171
|
case 35: goto tr9;
|
|
172
172
|
}
|
|
173
173
|
goto st0;
|
|
174
174
|
tr8:
|
|
175
|
-
#line
|
|
175
|
+
#line 53 "ext/puma_http11/http11_parser.rl"
|
|
176
176
|
{
|
|
177
177
|
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
|
|
178
178
|
}
|
|
179
179
|
goto st5;
|
|
180
180
|
tr31:
|
|
181
|
-
#line
|
|
181
|
+
#line 37 "ext/puma_http11/http11_parser.rl"
|
|
182
182
|
{ MARK(mark, p); }
|
|
183
|
-
#line
|
|
183
|
+
#line 56 "ext/puma_http11/http11_parser.rl"
|
|
184
184
|
{
|
|
185
185
|
parser->fragment(parser, PTR_TO(mark), LEN(mark, p));
|
|
186
186
|
}
|
|
187
187
|
goto st5;
|
|
188
188
|
tr33:
|
|
189
|
-
#line
|
|
189
|
+
#line 56 "ext/puma_http11/http11_parser.rl"
|
|
190
190
|
{
|
|
191
191
|
parser->fragment(parser, PTR_TO(mark), LEN(mark, p));
|
|
192
192
|
}
|
|
193
193
|
goto st5;
|
|
194
194
|
tr37:
|
|
195
|
-
#line
|
|
195
|
+
#line 69 "ext/puma_http11/http11_parser.rl"
|
|
196
196
|
{
|
|
197
197
|
parser->request_path(parser, PTR_TO(mark), LEN(mark,p));
|
|
198
198
|
}
|
|
199
|
-
#line
|
|
199
|
+
#line 53 "ext/puma_http11/http11_parser.rl"
|
|
200
200
|
{
|
|
201
201
|
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
|
|
202
202
|
}
|
|
203
203
|
goto st5;
|
|
204
204
|
tr41:
|
|
205
|
-
#line
|
|
205
|
+
#line 60 "ext/puma_http11/http11_parser.rl"
|
|
206
206
|
{ MARK(query_start, p); }
|
|
207
|
-
#line
|
|
207
|
+
#line 61 "ext/puma_http11/http11_parser.rl"
|
|
208
208
|
{
|
|
209
209
|
parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
|
|
210
210
|
}
|
|
211
|
-
#line
|
|
211
|
+
#line 53 "ext/puma_http11/http11_parser.rl"
|
|
212
212
|
{
|
|
213
213
|
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
|
|
214
214
|
}
|
|
215
215
|
goto st5;
|
|
216
216
|
tr44:
|
|
217
|
-
#line
|
|
217
|
+
#line 61 "ext/puma_http11/http11_parser.rl"
|
|
218
218
|
{
|
|
219
219
|
parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
|
|
220
220
|
}
|
|
221
|
-
#line
|
|
221
|
+
#line 53 "ext/puma_http11/http11_parser.rl"
|
|
222
222
|
{
|
|
223
223
|
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
|
|
224
224
|
}
|
|
@@ -227,19 +227,19 @@ st5:
|
|
|
227
227
|
if ( ++p == pe )
|
|
228
228
|
goto _test_eof5;
|
|
229
229
|
case 5:
|
|
230
|
-
#line
|
|
230
|
+
#line 231 "ext/puma_http11/http11_parser.c"
|
|
231
231
|
if ( (*p) == 72 )
|
|
232
232
|
goto tr10;
|
|
233
233
|
goto st0;
|
|
234
234
|
tr10:
|
|
235
|
-
#line
|
|
235
|
+
#line 37 "ext/puma_http11/http11_parser.rl"
|
|
236
236
|
{ MARK(mark, p); }
|
|
237
237
|
goto st6;
|
|
238
238
|
st6:
|
|
239
239
|
if ( ++p == pe )
|
|
240
240
|
goto _test_eof6;
|
|
241
241
|
case 6:
|
|
242
|
-
#line
|
|
242
|
+
#line 243 "ext/puma_http11/http11_parser.c"
|
|
243
243
|
if ( (*p) == 84 )
|
|
244
244
|
goto st7;
|
|
245
245
|
goto st0;
|
|
@@ -297,21 +297,21 @@ case 13:
|
|
|
297
297
|
goto st13;
|
|
298
298
|
goto st0;
|
|
299
299
|
tr18:
|
|
300
|
-
#line
|
|
300
|
+
#line 65 "ext/puma_http11/http11_parser.rl"
|
|
301
301
|
{
|
|
302
302
|
parser->http_version(parser, PTR_TO(mark), LEN(mark, p));
|
|
303
303
|
}
|
|
304
304
|
goto st14;
|
|
305
305
|
tr26:
|
|
306
|
-
#line
|
|
306
|
+
#line 46 "ext/puma_http11/http11_parser.rl"
|
|
307
307
|
{ MARK(mark, p); }
|
|
308
|
-
#line
|
|
308
|
+
#line 47 "ext/puma_http11/http11_parser.rl"
|
|
309
309
|
{
|
|
310
310
|
parser->http_field(parser, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
|
|
311
311
|
}
|
|
312
312
|
goto st14;
|
|
313
313
|
tr29:
|
|
314
|
-
#line
|
|
314
|
+
#line 47 "ext/puma_http11/http11_parser.rl"
|
|
315
315
|
{
|
|
316
316
|
parser->http_field(parser, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
|
|
317
317
|
}
|
|
@@ -320,7 +320,7 @@ st14:
|
|
|
320
320
|
if ( ++p == pe )
|
|
321
321
|
goto _test_eof14;
|
|
322
322
|
case 14:
|
|
323
|
-
#line
|
|
323
|
+
#line 324 "ext/puma_http11/http11_parser.c"
|
|
324
324
|
if ( (*p) == 10 )
|
|
325
325
|
goto st15;
|
|
326
326
|
goto st0;
|
|
@@ -360,7 +360,7 @@ case 16:
|
|
|
360
360
|
goto tr22;
|
|
361
361
|
goto st0;
|
|
362
362
|
tr22:
|
|
363
|
-
#line
|
|
363
|
+
#line 73 "ext/puma_http11/http11_parser.rl"
|
|
364
364
|
{
|
|
365
365
|
parser->body_start = p - buffer + 1;
|
|
366
366
|
parser->header_done(parser, p + 1, pe - p - 1);
|
|
@@ -371,23 +371,23 @@ st46:
|
|
|
371
371
|
if ( ++p == pe )
|
|
372
372
|
goto _test_eof46;
|
|
373
373
|
case 46:
|
|
374
|
-
#line
|
|
374
|
+
#line 375 "ext/puma_http11/http11_parser.c"
|
|
375
375
|
goto st0;
|
|
376
376
|
tr21:
|
|
377
|
-
#line
|
|
377
|
+
#line 40 "ext/puma_http11/http11_parser.rl"
|
|
378
378
|
{ MARK(field_start, p); }
|
|
379
|
-
#line
|
|
379
|
+
#line 41 "ext/puma_http11/http11_parser.rl"
|
|
380
380
|
{ snake_upcase_char((char *)p); }
|
|
381
381
|
goto st17;
|
|
382
382
|
tr23:
|
|
383
|
-
#line
|
|
383
|
+
#line 41 "ext/puma_http11/http11_parser.rl"
|
|
384
384
|
{ snake_upcase_char((char *)p); }
|
|
385
385
|
goto st17;
|
|
386
386
|
st17:
|
|
387
387
|
if ( ++p == pe )
|
|
388
388
|
goto _test_eof17;
|
|
389
389
|
case 17:
|
|
390
|
-
#line
|
|
390
|
+
#line 391 "ext/puma_http11/http11_parser.c"
|
|
391
391
|
switch( (*p) ) {
|
|
392
392
|
case 33: goto tr23;
|
|
393
393
|
case 58: goto tr24;
|
|
@@ -413,71 +413,71 @@ case 17:
|
|
|
413
413
|
goto tr23;
|
|
414
414
|
goto st0;
|
|
415
415
|
tr24:
|
|
416
|
-
#line
|
|
416
|
+
#line 42 "ext/puma_http11/http11_parser.rl"
|
|
417
417
|
{
|
|
418
418
|
parser->field_len = LEN(field_start, p);
|
|
419
419
|
}
|
|
420
420
|
goto st18;
|
|
421
421
|
tr27:
|
|
422
|
-
#line
|
|
422
|
+
#line 46 "ext/puma_http11/http11_parser.rl"
|
|
423
423
|
{ MARK(mark, p); }
|
|
424
424
|
goto st18;
|
|
425
425
|
st18:
|
|
426
426
|
if ( ++p == pe )
|
|
427
427
|
goto _test_eof18;
|
|
428
428
|
case 18:
|
|
429
|
-
#line
|
|
429
|
+
#line 430 "ext/puma_http11/http11_parser.c"
|
|
430
430
|
switch( (*p) ) {
|
|
431
431
|
case 13: goto tr26;
|
|
432
432
|
case 32: goto tr27;
|
|
433
433
|
}
|
|
434
434
|
goto tr25;
|
|
435
435
|
tr25:
|
|
436
|
-
#line
|
|
436
|
+
#line 46 "ext/puma_http11/http11_parser.rl"
|
|
437
437
|
{ MARK(mark, p); }
|
|
438
438
|
goto st19;
|
|
439
439
|
st19:
|
|
440
440
|
if ( ++p == pe )
|
|
441
441
|
goto _test_eof19;
|
|
442
442
|
case 19:
|
|
443
|
-
#line
|
|
443
|
+
#line 444 "ext/puma_http11/http11_parser.c"
|
|
444
444
|
if ( (*p) == 13 )
|
|
445
445
|
goto tr29;
|
|
446
446
|
goto st19;
|
|
447
447
|
tr9:
|
|
448
|
-
#line
|
|
448
|
+
#line 53 "ext/puma_http11/http11_parser.rl"
|
|
449
449
|
{
|
|
450
450
|
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
|
|
451
451
|
}
|
|
452
452
|
goto st20;
|
|
453
453
|
tr38:
|
|
454
|
-
#line
|
|
454
|
+
#line 69 "ext/puma_http11/http11_parser.rl"
|
|
455
455
|
{
|
|
456
456
|
parser->request_path(parser, PTR_TO(mark), LEN(mark,p));
|
|
457
457
|
}
|
|
458
|
-
#line
|
|
458
|
+
#line 53 "ext/puma_http11/http11_parser.rl"
|
|
459
459
|
{
|
|
460
460
|
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
|
|
461
461
|
}
|
|
462
462
|
goto st20;
|
|
463
463
|
tr42:
|
|
464
|
-
#line
|
|
464
|
+
#line 60 "ext/puma_http11/http11_parser.rl"
|
|
465
465
|
{ MARK(query_start, p); }
|
|
466
|
-
#line
|
|
466
|
+
#line 61 "ext/puma_http11/http11_parser.rl"
|
|
467
467
|
{
|
|
468
468
|
parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
|
|
469
469
|
}
|
|
470
|
-
#line
|
|
470
|
+
#line 53 "ext/puma_http11/http11_parser.rl"
|
|
471
471
|
{
|
|
472
472
|
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
|
|
473
473
|
}
|
|
474
474
|
goto st20;
|
|
475
475
|
tr45:
|
|
476
|
-
#line
|
|
476
|
+
#line 61 "ext/puma_http11/http11_parser.rl"
|
|
477
477
|
{
|
|
478
478
|
parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
|
|
479
479
|
}
|
|
480
|
-
#line
|
|
480
|
+
#line 53 "ext/puma_http11/http11_parser.rl"
|
|
481
481
|
{
|
|
482
482
|
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
|
|
483
483
|
}
|
|
@@ -486,7 +486,7 @@ st20:
|
|
|
486
486
|
if ( ++p == pe )
|
|
487
487
|
goto _test_eof20;
|
|
488
488
|
case 20:
|
|
489
|
-
#line
|
|
489
|
+
#line 490 "ext/puma_http11/http11_parser.c"
|
|
490
490
|
switch( (*p) ) {
|
|
491
491
|
case 32: goto tr31;
|
|
492
492
|
case 60: goto st0;
|
|
@@ -500,14 +500,14 @@ case 20:
|
|
|
500
500
|
goto st0;
|
|
501
501
|
goto tr30;
|
|
502
502
|
tr30:
|
|
503
|
-
#line
|
|
503
|
+
#line 37 "ext/puma_http11/http11_parser.rl"
|
|
504
504
|
{ MARK(mark, p); }
|
|
505
505
|
goto st21;
|
|
506
506
|
st21:
|
|
507
507
|
if ( ++p == pe )
|
|
508
508
|
goto _test_eof21;
|
|
509
509
|
case 21:
|
|
510
|
-
#line
|
|
510
|
+
#line 511 "ext/puma_http11/http11_parser.c"
|
|
511
511
|
switch( (*p) ) {
|
|
512
512
|
case 32: goto tr33;
|
|
513
513
|
case 60: goto st0;
|
|
@@ -521,14 +521,14 @@ case 21:
|
|
|
521
521
|
goto st0;
|
|
522
522
|
goto st21;
|
|
523
523
|
tr5:
|
|
524
|
-
#line
|
|
524
|
+
#line 37 "ext/puma_http11/http11_parser.rl"
|
|
525
525
|
{ MARK(mark, p); }
|
|
526
526
|
goto st22;
|
|
527
527
|
st22:
|
|
528
528
|
if ( ++p == pe )
|
|
529
529
|
goto _test_eof22;
|
|
530
530
|
case 22:
|
|
531
|
-
#line
|
|
531
|
+
#line 532 "ext/puma_http11/http11_parser.c"
|
|
532
532
|
switch( (*p) ) {
|
|
533
533
|
case 43: goto st22;
|
|
534
534
|
case 58: goto st23;
|
|
@@ -546,14 +546,14 @@ case 22:
|
|
|
546
546
|
goto st22;
|
|
547
547
|
goto st0;
|
|
548
548
|
tr7:
|
|
549
|
-
#line
|
|
549
|
+
#line 37 "ext/puma_http11/http11_parser.rl"
|
|
550
550
|
{ MARK(mark, p); }
|
|
551
551
|
goto st23;
|
|
552
552
|
st23:
|
|
553
553
|
if ( ++p == pe )
|
|
554
554
|
goto _test_eof23;
|
|
555
555
|
case 23:
|
|
556
|
-
#line
|
|
556
|
+
#line 557 "ext/puma_http11/http11_parser.c"
|
|
557
557
|
switch( (*p) ) {
|
|
558
558
|
case 32: goto tr8;
|
|
559
559
|
case 34: goto st0;
|
|
@@ -566,14 +566,14 @@ case 23:
|
|
|
566
566
|
goto st0;
|
|
567
567
|
goto st23;
|
|
568
568
|
tr6:
|
|
569
|
-
#line
|
|
569
|
+
#line 37 "ext/puma_http11/http11_parser.rl"
|
|
570
570
|
{ MARK(mark, p); }
|
|
571
571
|
goto st24;
|
|
572
572
|
st24:
|
|
573
573
|
if ( ++p == pe )
|
|
574
574
|
goto _test_eof24;
|
|
575
575
|
case 24:
|
|
576
|
-
#line
|
|
576
|
+
#line 577 "ext/puma_http11/http11_parser.c"
|
|
577
577
|
switch( (*p) ) {
|
|
578
578
|
case 32: goto tr37;
|
|
579
579
|
case 34: goto st0;
|
|
@@ -587,7 +587,7 @@ case 24:
|
|
|
587
587
|
goto st0;
|
|
588
588
|
goto st24;
|
|
589
589
|
tr39:
|
|
590
|
-
#line
|
|
590
|
+
#line 69 "ext/puma_http11/http11_parser.rl"
|
|
591
591
|
{
|
|
592
592
|
parser->request_path(parser, PTR_TO(mark), LEN(mark,p));
|
|
593
593
|
}
|
|
@@ -596,7 +596,7 @@ st25:
|
|
|
596
596
|
if ( ++p == pe )
|
|
597
597
|
goto _test_eof25;
|
|
598
598
|
case 25:
|
|
599
|
-
#line
|
|
599
|
+
#line 600 "ext/puma_http11/http11_parser.c"
|
|
600
600
|
switch( (*p) ) {
|
|
601
601
|
case 32: goto tr41;
|
|
602
602
|
case 34: goto st0;
|
|
@@ -609,14 +609,14 @@ case 25:
|
|
|
609
609
|
goto st0;
|
|
610
610
|
goto tr40;
|
|
611
611
|
tr40:
|
|
612
|
-
#line
|
|
612
|
+
#line 60 "ext/puma_http11/http11_parser.rl"
|
|
613
613
|
{ MARK(query_start, p); }
|
|
614
614
|
goto st26;
|
|
615
615
|
st26:
|
|
616
616
|
if ( ++p == pe )
|
|
617
617
|
goto _test_eof26;
|
|
618
618
|
case 26:
|
|
619
|
-
#line
|
|
619
|
+
#line 620 "ext/puma_http11/http11_parser.c"
|
|
620
620
|
switch( (*p) ) {
|
|
621
621
|
case 32: goto tr44;
|
|
622
622
|
case 34: goto st0;
|
|
@@ -1010,7 +1010,7 @@ case 45:
|
|
|
1010
1010
|
_out: {}
|
|
1011
1011
|
}
|
|
1012
1012
|
|
|
1013
|
-
#line
|
|
1013
|
+
#line 117 "ext/puma_http11/http11_parser.rl"
|
|
1014
1014
|
|
|
1015
1015
|
if (!puma_parser_has_error(parser))
|
|
1016
1016
|
parser->cs = cs;
|