pitchfork 0.18.1 → 0.18.3

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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/actions.lock +40 -0
  3. data/.github/workflows/ci.yml +30 -11
  4. data/.github/workflows/release.yml +29 -0
  5. data/.ruby-version +1 -1
  6. data/CHANGELOG.md +16 -2
  7. data/Gemfile +1 -0
  8. data/Rakefile +15 -0
  9. data/benchmark/request_benchmark.rb +86 -0
  10. data/docs/CONFIGURATION.md +51 -14
  11. data/docs/MIGRATING_FROM_UNICORN.md +6 -0
  12. data/docs/SIGNALS.md +6 -0
  13. data/examples/pitchfork.conf.reload.rb +41 -0
  14. data/exe/pitchfork +3 -2
  15. data/ext/pitchfork_http/c_util.h +3 -8
  16. data/ext/pitchfork_http/child_subreaper.h +7 -1
  17. data/ext/pitchfork_http/epollexclusive.h +6 -3
  18. data/ext/pitchfork_http/extconf.rb +1 -0
  19. data/ext/pitchfork_http/global_variables.h +2 -0
  20. data/ext/pitchfork_http/memory_page.c +188 -25
  21. data/ext/pitchfork_http/pitchfork_http.c +578 -471
  22. data/ext/pitchfork_http/pitchfork_http.rl +63 -33
  23. data/ext/pitchfork_http/pitchfork_http_common.rl +1 -1
  24. data/lib/pitchfork/children.rb +74 -20
  25. data/lib/pitchfork/chunked.rb +9 -0
  26. data/lib/pitchfork/configurator.rb +25 -6
  27. data/lib/pitchfork/http_parser.rb +4 -0
  28. data/lib/pitchfork/http_response.rb +35 -12
  29. data/lib/pitchfork/http_server.rb +391 -193
  30. data/lib/pitchfork/info.rb +8 -0
  31. data/lib/pitchfork/listeners.rb +52 -0
  32. data/lib/pitchfork/message.rb +58 -8
  33. data/lib/pitchfork/shared_memory.rb +64 -13
  34. data/lib/pitchfork/socket_helper.rb +6 -2
  35. data/lib/pitchfork/stream_input.rb +12 -9
  36. data/lib/pitchfork/version.rb +1 -1
  37. data/lib/pitchfork/worker.rb +124 -64
  38. data/lib/pitchfork.rb +15 -7
  39. metadata +7 -6
data/lib/pitchfork.rb CHANGED
@@ -3,12 +3,7 @@
3
3
  require 'etc'
4
4
  require 'stringio'
5
5
  require 'io/wait'
6
-
7
- begin
8
- require 'rack'
9
- rescue LoadError
10
- warn 'rack not available, functionality reduced'
11
- end
6
+ require 'rack'
12
7
 
13
8
  # :stopdoc:
14
9
  # Pitchfork module containing all of the classes (include C extensions) for
@@ -21,6 +16,7 @@ end
21
16
  # applications, so applications should be written against the Rack SPEC
22
17
  # and not pitchfork internals.
23
18
  module Pitchfork
19
+ PATH_INFO_REQUIRES_LEADING_SLASH = Gem::Version.new(Rack.release) < Gem::Version.new('3.2.0')
24
20
 
25
21
  # Raised inside TeeInput when a client closes the socket inside the
26
22
  # application dispatch. This is always raised with an empty backtrace
@@ -112,11 +108,16 @@ module Pitchfork
112
108
  # and Unix domain socket paths. This is useful for use with
113
109
  # Raindrops::Middleware under Linux: https://yhbt.net/raindrops/
114
110
  def listener_names
115
- Pitchfork::HttpServer::LISTENERS.map do |io|
111
+ @listener_names || Pitchfork::HttpServer::LISTENERS.map do |io|
116
112
  Pitchfork::SocketHelper.sock_name(io)
117
113
  end
118
114
  end
119
115
 
116
+ def close_listeners
117
+ @listener_names = listener_names
118
+ Pitchfork::HttpServer::LISTENERS.each(&:close).clear
119
+ end
120
+
120
121
  def log_error(logger, prefix, exc)
121
122
  message = exc.message
122
123
  message = message.dump if /[[:cntrl:]]/ =~ message
@@ -124,6 +125,13 @@ module Pitchfork
124
125
  exc.backtrace.each { |line| logger.error(line) }
125
126
  end
126
127
 
128
+ def socketpair_for_fds(fds)
129
+ # TODO: check if we need close_write/close_read
130
+ pair = fds.map { |fd| MessageSocket.for_fd(Integer(fd)) }
131
+ pair.each { |s| s.close_on_exec = true }
132
+ pair
133
+ end
134
+
127
135
  def socketpair
128
136
  pair = UNIXSocket.socketpair(@socket_type).map { |s| MessageSocket.new(s) }
129
137
  pair[0].close_write
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pitchfork
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.1
4
+ version: 0.18.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean Boussier
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-07-28 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rack
@@ -52,7 +51,9 @@ files:
52
51
  - ".devcontainer/devcontainer.json"
53
52
  - ".git-blame-ignore-revs"
54
53
  - ".gitattributes"
54
+ - ".github/workflows/actions.lock"
55
55
  - ".github/workflows/ci.yml"
56
+ - ".github/workflows/release.yml"
56
57
  - ".gitignore"
57
58
  - ".ruby-version"
58
59
  - CHANGELOG.md
@@ -64,6 +65,7 @@ files:
64
65
  - Rakefile
65
66
  - benchmark/README.md
66
67
  - benchmark/cow_benchmark.rb
68
+ - benchmark/request_benchmark.rb
67
69
  - docs/Application_Timeouts.md
68
70
  - docs/CONFIGURATION.md
69
71
  - docs/DESIGN.md
@@ -80,6 +82,7 @@ files:
80
82
  - examples/nginx.conf
81
83
  - examples/pitchfork.conf.minimal.rb
82
84
  - examples/pitchfork.conf.rb
85
+ - examples/pitchfork.conf.reload.rb
83
86
  - examples/pitchfork.conf.service.rb
84
87
  - examples/unicorn.socket
85
88
  - exe/pitchfork
@@ -126,7 +129,6 @@ licenses:
126
129
  - GPL-2.0+
127
130
  - Ruby
128
131
  metadata: {}
129
- post_install_message:
130
132
  rdoc_options: []
131
133
  require_paths:
132
134
  - lib
@@ -141,8 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
143
  - !ruby/object:Gem::Version
142
144
  version: '0'
143
145
  requirements: []
144
- rubygems_version: 3.5.9
145
- signing_key:
146
+ rubygems_version: 4.0.20
146
147
  specification_version: 4
147
148
  summary: Rack HTTP server for fast clients and Unix
148
149
  test_files: []