pitchfork 0.12.0 → 0.13.0
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/.github/workflows/ci.yml +1 -1
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +3 -3
- data/benchmark/README.md +1 -1
- data/benchmark/cow_benchmark.rb +1 -0
- data/docs/CONFIGURATION.md +1 -1
- data/examples/constant_caches.ru +1 -0
- data/examples/echo.ru +1 -0
- data/examples/hello.ru +1 -0
- data/examples/pitchfork.conf.minimal.rb +1 -0
- data/examples/pitchfork.conf.rb +1 -0
- data/exe/pitchfork +1 -0
- data/ext/pitchfork_http/epollexclusive.h +2 -2
- data/ext/pitchfork_http/extconf.rb +1 -0
- data/lib/pitchfork/app/old_rails/static.rb +1 -0
- data/lib/pitchfork/children.rb +1 -0
- data/lib/pitchfork/configurator.rb +1 -0
- data/lib/pitchfork/const.rb +1 -0
- data/lib/pitchfork/flock.rb +1 -0
- data/lib/pitchfork/http_parser.rb +7 -6
- data/lib/pitchfork/http_response.rb +3 -2
- data/lib/pitchfork/http_server.rb +6 -3
- data/lib/pitchfork/launcher.rb +1 -0
- data/lib/pitchfork/message.rb +1 -0
- data/lib/pitchfork/select_waiter.rb +1 -0
- data/lib/pitchfork/socket_helper.rb +1 -0
- data/lib/pitchfork/stream_input.rb +6 -5
- data/lib/pitchfork/tee_input.rb +3 -2
- data/lib/pitchfork/tmpio.rb +1 -0
- data/lib/pitchfork/version.rb +1 -1
- data/lib/pitchfork/worker.rb +1 -0
- data/lib/pitchfork.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd251198665823484f036ddf2cf11c9415c3c07c04c8e6e809c0e74b05c1055f
|
4
|
+
data.tar.gz: fc9475e4c4605b8bdf6cb7854946577413bbe980b5ac531a1638b43be4574d03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba08c99f11e707e37af4265ac9f1dd7f15c62243b2c65ffc6dd2a3189db51dc3512f5b59234b16c98aff396fc88585d0f2c255ab7af9921653c9fdb4efbe7e61
|
7
|
+
data.tar.gz: '06790f57c21601cc73bcf34a01d89278c5bf6fb34b846a0534ab5d6982432c334ee101d50154a465e503fb92378c0e2809a5b94704e129aa4ee0cbfb5e88f058'
|
data/.github/workflows/ci.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Unreleased
|
2
2
|
|
3
|
+
# 0.13.0
|
4
|
+
|
5
|
+
- Fix compatibility with `--enable-frozen-string-literal` in preparation for Ruby 3.4.
|
6
|
+
- Extend timed out workers deadline after sending signals to avoid flooding.
|
7
|
+
- Fix compilation with Ruby 2.7 and older on macOS.
|
8
|
+
|
3
9
|
# 0.12.0
|
4
10
|
|
5
11
|
- Disable IO tracking on Rubies older than 3.2.3 to avoid running into https://bugs.ruby-lang.org/issues/19531.
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
pitchfork (0.
|
4
|
+
pitchfork (0.13.0)
|
5
5
|
rack (>= 2.0)
|
6
6
|
raindrops (~> 0.7)
|
7
7
|
|
@@ -12,7 +12,7 @@ GEM
|
|
12
12
|
nio4r (2.7.0)
|
13
13
|
puma (6.4.2)
|
14
14
|
nio4r (~> 2.0)
|
15
|
-
rack (3.0.
|
15
|
+
rack (3.0.10)
|
16
16
|
raindrops (0.20.1)
|
17
17
|
rake (13.0.6)
|
18
18
|
rake-compiler (1.2.1)
|
@@ -31,4 +31,4 @@ DEPENDENCIES
|
|
31
31
|
rake-compiler
|
32
32
|
|
33
33
|
BUNDLED WITH
|
34
|
-
2.3.
|
34
|
+
2.3.27
|
data/benchmark/README.md
CHANGED
data/benchmark/cow_benchmark.rb
CHANGED
data/docs/CONFIGURATION.md
CHANGED
@@ -188,7 +188,7 @@ The second "hard" timeout, is the sum of `timeout` and `cleanup`.
|
|
188
188
|
Workers taking longer than this time period to be ready to handle a new
|
189
189
|
request will be forcibly killed (via `SIGKILL`).
|
190
190
|
|
191
|
-
Neither of these timeout
|
191
|
+
Neither of these timeout mechanisms should be routinely relied on, and should
|
192
192
|
instead be considered as a last line of defense in case you application
|
193
193
|
is impacted by bugs causing unexpectedly slow response time, or fully stuck
|
194
194
|
processes.
|
data/examples/constant_caches.ru
CHANGED
data/examples/echo.ru
CHANGED
data/examples/hello.ru
CHANGED
data/examples/pitchfork.conf.rb
CHANGED
data/exe/pitchfork
CHANGED
@@ -11,10 +11,11 @@
|
|
11
11
|
#if defined(HAVE_EPOLL_CREATE1)
|
12
12
|
# include <sys/epoll.h>
|
13
13
|
# include <errno.h>
|
14
|
-
# include <ruby/io.h>
|
15
14
|
# include <ruby/thread.h>
|
16
15
|
#endif /* __linux__ */
|
17
16
|
|
17
|
+
#include <ruby/io.h>
|
18
|
+
|
18
19
|
#if defined(EPOLLEXCLUSIVE) && defined(HAVE_EPOLL_CREATE1)
|
19
20
|
# define USE_EPOLL (1)
|
20
21
|
#else
|
@@ -50,7 +51,6 @@ static VALUE prep_readers(VALUE cls, VALUE readers)
|
|
50
51
|
for (i = 0; i < RARRAY_LEN(readers); i++) {
|
51
52
|
int rc;
|
52
53
|
struct epoll_event e;
|
53
|
-
rb_io_t *fptr;
|
54
54
|
VALUE io = rb_ary_entry(readers, i);
|
55
55
|
|
56
56
|
e.data.u64 = i; /* the reason readers shouldn't change */
|
data/lib/pitchfork/children.rb
CHANGED
data/lib/pitchfork/const.rb
CHANGED
data/lib/pitchfork/flock.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# -*- encoding: binary -*-
|
2
|
+
# frozen_string_literal: true
|
2
3
|
# :enddoc:
|
3
4
|
# no stable API here
|
4
5
|
|
@@ -19,10 +20,10 @@ module Pitchfork
|
|
19
20
|
"SERVER_SOFTWARE" => "Pitchfork #{Pitchfork::Const::UNICORN_VERSION}"
|
20
21
|
}
|
21
22
|
|
22
|
-
NULL_IO = StringIO.new
|
23
|
+
NULL_IO = StringIO.new.binmode
|
23
24
|
|
24
25
|
# :stopdoc:
|
25
|
-
HTTP_RESPONSE_START = [ 'HTTP'
|
26
|
+
HTTP_RESPONSE_START = [ 'HTTP', '/1.1 ' ]
|
26
27
|
EMPTY_ARRAY = [].freeze
|
27
28
|
@@input_class = Pitchfork::TeeInput
|
28
29
|
@@check_client_connection = false
|
@@ -104,7 +105,7 @@ module Pitchfork
|
|
104
105
|
end
|
105
106
|
|
106
107
|
def hijacked?
|
107
|
-
env.include?('rack.hijack_io'
|
108
|
+
env.include?('rack.hijack_io')
|
108
109
|
end
|
109
110
|
|
110
111
|
if Raindrops.const_defined?(:TCP_Info)
|
@@ -199,11 +200,11 @@ module Pitchfork
|
|
199
200
|
val.downcase!
|
200
201
|
end
|
201
202
|
|
202
|
-
if vals.pop == 'chunked'
|
203
|
-
return true unless vals.include?('chunked'
|
203
|
+
if vals.pop == 'chunked'
|
204
|
+
return true unless vals.include?('chunked')
|
204
205
|
raise Pitchfork::HttpParserError, 'double chunked', []
|
205
206
|
end
|
206
|
-
return false unless vals.include?('chunked'
|
207
|
+
return false unless vals.include?('chunked')
|
207
208
|
raise Pitchfork::HttpParserError, 'chunked not last', []
|
208
209
|
end
|
209
210
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# -*- encoding: binary -*-
|
2
|
+
# frozen_string_literal: true
|
2
3
|
# :enddoc:
|
3
4
|
|
4
5
|
module Pitchfork
|
@@ -48,10 +49,10 @@ module Pitchfork
|
|
48
49
|
if headers
|
49
50
|
code = status.to_i
|
50
51
|
msg = STATUS_CODES[code]
|
51
|
-
start = req.response_start_sent ? ''
|
52
|
+
start = req.response_start_sent ? '' : 'HTTP/1.1 '
|
52
53
|
buf = "#{start}#{msg ? %Q(#{code} #{msg}) : status}\r\n" \
|
53
54
|
"Date: #{httpdate}\r\n" \
|
54
|
-
"Connection: close\r\n"
|
55
|
+
"Connection: close\r\n".b
|
55
56
|
headers.each do |key, value|
|
56
57
|
case key
|
57
58
|
when %r{\A(?:Date|Connection)\z}i
|
@@ -1,4 +1,6 @@
|
|
1
1
|
# -*- encoding: binary -*-
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
require 'pitchfork/pitchfork_http'
|
3
5
|
require 'pitchfork/flock'
|
4
6
|
require 'pitchfork/soft_timeout'
|
@@ -91,7 +93,7 @@ module Pitchfork
|
|
91
93
|
# in new projects
|
92
94
|
LISTENERS = []
|
93
95
|
|
94
|
-
NOOP = '.'
|
96
|
+
NOOP = '.'
|
95
97
|
|
96
98
|
# :startdoc:
|
97
99
|
# This Hash is considered a stable interface and changing its contents
|
@@ -512,6 +514,7 @@ module Pitchfork
|
|
512
514
|
next
|
513
515
|
else # worker is out of time
|
514
516
|
next_sleep = 0
|
517
|
+
child.deadline = now + 1
|
515
518
|
hard_timeout(child)
|
516
519
|
end
|
517
520
|
end
|
@@ -696,7 +699,7 @@ module Pitchfork
|
|
696
699
|
|
697
700
|
def e103_response_write(client, headers)
|
698
701
|
rss = @request.response_start_sent
|
699
|
-
buf = rss ? "103 Early Hints\r\n" : "HTTP/1.1 103 Early Hints\r\n"
|
702
|
+
buf = (rss ? "103 Early Hints\r\n" : "HTTP/1.1 103 Early Hints\r\n").b
|
700
703
|
headers.each { |key, value| append_header(buf, key, value) }
|
701
704
|
buf << (rss ? "\r\nHTTP/1.1 ".freeze : "\r\n".freeze)
|
702
705
|
client.write(buf)
|
@@ -710,7 +713,7 @@ module Pitchfork
|
|
710
713
|
client.write(@request.response_start_sent ?
|
711
714
|
"100 Continue\r\n\r\nHTTP/1.1 ".freeze :
|
712
715
|
"HTTP/1.1 100 Continue\r\n\r\n".freeze)
|
713
|
-
env.delete('HTTP_EXPECT'
|
716
|
+
env.delete('HTTP_EXPECT')
|
714
717
|
end
|
715
718
|
|
716
719
|
# once a client is accepted, it is processed in its entirety here
|
data/lib/pitchfork/launcher.rb
CHANGED
data/lib/pitchfork/message.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# -*- encoding: binary -*-
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
module Pitchfork
|
4
5
|
# When processing uploads, pitchfork may expose a StreamInput object under
|
@@ -17,7 +18,7 @@ module Pitchfork
|
|
17
18
|
@socket = socket
|
18
19
|
@parser = request
|
19
20
|
@buf = request.buf
|
20
|
-
@rbuf = ''
|
21
|
+
@rbuf = +''
|
21
22
|
@bytes_read = 0
|
22
23
|
filter_body(@rbuf, @buf) unless @buf.empty?
|
23
24
|
end
|
@@ -41,7 +42,7 @@ module Pitchfork
|
|
41
42
|
# ios.read(length [, buffer]) will return immediately if there is
|
42
43
|
# any data and only block when nothing is available (providing
|
43
44
|
# IO#readpartial semantics).
|
44
|
-
def read(length = nil, rv = '')
|
45
|
+
def read(length = nil, rv = ''.b)
|
45
46
|
if length
|
46
47
|
if length <= @rbuf.size
|
47
48
|
length < 0 and raise ArgumentError, "negative length #{length} given"
|
@@ -79,16 +80,16 @@ module Pitchfork
|
|
79
80
|
# unlike IO#gets.
|
80
81
|
def gets(sep = $/)
|
81
82
|
if sep.nil?
|
82
|
-
read_all(rv = '')
|
83
|
+
read_all(rv = ''.b)
|
83
84
|
return rv.empty? ? nil : rv
|
84
85
|
end
|
85
86
|
re = /\A(.*?#{Regexp.escape(sep)})/
|
86
87
|
|
87
88
|
begin
|
88
|
-
@rbuf.sub!(re, '') and return $1
|
89
|
+
@rbuf.sub!(re, ''.b) and return $1
|
89
90
|
return @rbuf.empty? ? nil : @rbuf.slice!(0, @rbuf.size) if eof?
|
90
91
|
@socket.readpartial(@@io_chunk_size, @buf) or eof!
|
91
|
-
filter_body(once = '', @buf)
|
92
|
+
filter_body(once = ''.b, @buf)
|
92
93
|
@rbuf << once
|
93
94
|
end while true
|
94
95
|
end
|
data/lib/pitchfork/tee_input.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# -*- encoding: binary -*-
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
module Pitchfork
|
4
5
|
# Acts like tee(1) on an input input to provide a input-like stream
|
@@ -42,7 +43,7 @@ module Pitchfork
|
|
42
43
|
@len = request.content_length
|
43
44
|
super
|
44
45
|
@tmp = @len && @len <= @@client_body_buffer_size ?
|
45
|
-
StringIO.new
|
46
|
+
StringIO.new.binmode : new_tmpio
|
46
47
|
end
|
47
48
|
|
48
49
|
# :call-seq:
|
@@ -121,7 +122,7 @@ module Pitchfork
|
|
121
122
|
|
122
123
|
# consumes the stream of the socket
|
123
124
|
def consume!
|
124
|
-
junk = ""
|
125
|
+
junk = "".b
|
125
126
|
nil while read(@@io_chunk_size, junk)
|
126
127
|
end
|
127
128
|
|
data/lib/pitchfork/tmpio.rb
CHANGED
data/lib/pitchfork/version.rb
CHANGED
data/lib/pitchfork/worker.rb
CHANGED
data/lib/pitchfork.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pitchfork
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean Boussier
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: raindrops
|