yahns 1.14.1 → 1.18.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 +5 -5
- data/.document +2 -0
- data/.gitignore +0 -1
- data/.olddoc.yml +3 -2
- data/Documentation/GNUmakefile +1 -1
- data/Documentation/design_notes.txt +6 -3
- data/Documentation/yahns-rackup.pod +7 -3
- data/Documentation/yahns.pod +1 -1
- data/Documentation/yahns_config.pod +10 -10
- data/GIT-VERSION-FILE +1 -1
- data/GIT-VERSION-GEN +3 -3
- data/HACKING +13 -13
- data/NEWS +982 -829
- data/README +11 -12
- data/Rakefile +121 -5
- data/examples/https_proxy_pass.conf.rb +36 -0
- data/examples/logrotate.conf +1 -1
- data/examples/proxy_pass.ru +11 -0
- data/extras/autoindex.rb +20 -4
- data/extras/exec_cgi.rb +38 -24
- data/extras/proxy_pass.rb +7 -6
- data/extras/try_gzip_static.rb +4 -1
- data/lib/yahns/acceptor.rb +3 -3
- data/lib/yahns/chunk_body.rb +2 -1
- data/lib/yahns/config.rb +10 -5
- data/lib/yahns/daemon.rb +0 -1
- data/lib/yahns/http_client.rb +28 -18
- data/lib/yahns/http_response.rb +3 -4
- data/lib/yahns/openssl_client.rb +33 -11
- data/lib/yahns/proxy_http_response.rb +3 -1
- data/lib/yahns/proxy_pass.rb +68 -10
- data/lib/yahns/queue_epoll.rb +4 -0
- data/lib/yahns/queue_kqueue.rb +0 -6
- data/lib/yahns/queue_quitter_pipe.rb +4 -1
- data/lib/yahns/rackup_handler.rb +3 -7
- data/lib/yahns/server.rb +47 -27
- data/lib/yahns/server_mp.rb +3 -4
- data/lib/yahns/sigevent_efd.rb +0 -1
- data/lib/yahns/sigevent_pipe.rb +13 -6
- data/lib/yahns/socket_helper.rb +1 -1
- data/lib/yahns/stream_input.rb +3 -2
- data/lib/yahns/tee_input.rb +1 -3
- data/lib/yahns/version.rb +1 -1
- data/lib/yahns/wbuf.rb +10 -3
- data/lib/yahns/worker.rb +8 -0
- data/lib/yahns.rb +12 -7
- data/man/yahns-rackup.1 +17 -17
- data/man/yahns.1 +11 -15
- data/man/yahns_config.5 +31 -31
- data/test/helper.rb +6 -2
- data/test/server_helper.rb +20 -5
- data/test/test_bin.rb +33 -30
- data/test/test_config.rb +2 -2
- data/test/test_extras_exec_cgi.rb +24 -1
- data/test/test_extras_try_gzip_static.rb +1 -1
- data/test/test_mt_accept.rb +0 -2
- data/test/test_proxy_pass.rb +1 -2
- data/test/test_proxy_pass_no_buffering.rb +1 -1
- data/test/test_rack_env.rb +58 -0
- data/test/test_serve_static.rb +0 -1
- data/test/test_server.rb +1 -4
- data/test/test_ssl.rb +2 -0
- data/test/test_unix_socket.rb +1 -3
- data/test/test_wbuf.rb +1 -1
- data/yahns.gemspec +8 -5
- metadata +12 -9
@@ -0,0 +1,58 @@
|
|
1
|
+
# Copyright (C) 2017 all contributors <yahns-public@yhbt.net>
|
2
|
+
# License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
|
3
|
+
# frozen_string_literal: true
|
4
|
+
require_relative 'server_helper'
|
5
|
+
require 'rack'
|
6
|
+
|
7
|
+
class TestRackEnv < Testcase
|
8
|
+
ENV["N"].to_i > 1 and parallelize_me!
|
9
|
+
include ServerHelper
|
10
|
+
alias setup server_helper_setup
|
11
|
+
alias teardown server_helper_teardown
|
12
|
+
|
13
|
+
def test_rack_env_logger
|
14
|
+
err, cfg, host, port = @err, Yahns::Config.new, @srv.addr[3], @srv.addr[1]
|
15
|
+
cfg.instance_eval do
|
16
|
+
stderr_path err.path
|
17
|
+
GTL.synchronize do
|
18
|
+
app = Rack::Builder.new do
|
19
|
+
use Rack::Lint # ensure Lint passes
|
20
|
+
run(lambda do |env|
|
21
|
+
logger = env['rack.logger']
|
22
|
+
%w(SERVER_NAME SERVER_PORT rack.url_scheme).each do |k|
|
23
|
+
logger.info("#{k}=#{env[k].inspect}")
|
24
|
+
end
|
25
|
+
[ 200, [ %w(Content-Length 3), %w(Content Type text/plain)],
|
26
|
+
[ "OK\n" ] ]
|
27
|
+
end)
|
28
|
+
end
|
29
|
+
app(:rack, app.to_app) { listen "#{host}:#{port}" }
|
30
|
+
end
|
31
|
+
end
|
32
|
+
pid = mkserver(cfg)
|
33
|
+
Net::HTTP.start(host, port) do |http|
|
34
|
+
res = http.request(Net::HTTP::Get.new("/"))
|
35
|
+
assert_equal 200, res.code.to_i
|
36
|
+
assert_equal "OK\n", res.body
|
37
|
+
txt = File.read(err.path)
|
38
|
+
assert_match %r{\srack\.url_scheme=#{Regexp.escape('http'.inspect)}\s}s,
|
39
|
+
txt
|
40
|
+
assert_match %r{\sSERVER_NAME=#{Regexp.escape(host.inspect)}\s}s, txt
|
41
|
+
assert_match %r{\sSERVER_PORT=#{Regexp.escape(port.to_s.inspect)}\s}s, txt
|
42
|
+
end
|
43
|
+
err.truncate 0
|
44
|
+
err.rewind
|
45
|
+
c = TCPSocket.new(host, port)
|
46
|
+
c.write("GET / HTTP/1.0\r\nHost: example.com\r\n\r\n")
|
47
|
+
assert_match %r{\r\nOK\n\z}s, c.read
|
48
|
+
txt = File.read(err.path)
|
49
|
+
assert_match %r{\srack\.url_scheme=#{Regexp.escape('http'.inspect)}\s}s,
|
50
|
+
txt
|
51
|
+
assert_match %r{\sSERVER_NAME=#{Regexp.escape('example.com'.inspect)}\s}s,
|
52
|
+
txt
|
53
|
+
assert_match %r{\sSERVER_PORT=#{Regexp.escape('80'.inspect)}\s}s, txt
|
54
|
+
ensure
|
55
|
+
c.close if c
|
56
|
+
quit_wait(pid)
|
57
|
+
end
|
58
|
+
end
|
data/test/test_serve_static.rb
CHANGED
data/test/test_server.rb
CHANGED
@@ -182,7 +182,6 @@ class TestServer < Testcase
|
|
182
182
|
tmpdir = yahns_mktmpdir
|
183
183
|
sock = "#{tmpdir}/sock"
|
184
184
|
unix_srv = UNIXServer.new(sock)
|
185
|
-
unix_srv.close_on_exec = true
|
186
185
|
msgs = %w(ZZ zz)
|
187
186
|
err = @err
|
188
187
|
cfg = Yahns::Config.new
|
@@ -225,7 +224,7 @@ class TestServer < Testcase
|
|
225
224
|
assert_equal 1, eggs.size
|
226
225
|
assert_equal 1, eggs.first[1].instance_variable_get(:@worker_threads)
|
227
226
|
|
228
|
-
pid =
|
227
|
+
pid = xfork do
|
229
228
|
bpipe[1].close
|
230
229
|
ENV["YAHNS_FD"] = unix_srv.fileno.to_s
|
231
230
|
unix_srv.autoclose = false
|
@@ -234,7 +233,6 @@ class TestServer < Testcase
|
|
234
233
|
bpipe[0].close
|
235
234
|
a = UNIXSocket.new(sock)
|
236
235
|
b = UNIXSocket.new(sock)
|
237
|
-
b.close_on_exec = a.close_on_exec = true
|
238
236
|
a.write("GET /sleep HTTP/1.0\r\n\r\n")
|
239
237
|
r = IO.select([a], nil, nil, 4)
|
240
238
|
assert r, "nothing ready"
|
@@ -681,7 +679,6 @@ class TestServer < Testcase
|
|
681
679
|
assert_equal "INFO HIHI\n", re.read
|
682
680
|
|
683
681
|
c = UNIXSocket.new(sock)
|
684
|
-
c.close_on_exec = true
|
685
682
|
c.write "GET /\r\n\r\n"
|
686
683
|
assert_equal c, c.wait(30)
|
687
684
|
assert_equal "OK", c.read
|
data/test/test_ssl.rb
CHANGED
@@ -41,6 +41,7 @@ AQjjxMXhwULlmuR/K+WwlaZPiLIBYalLAZQ7ZbOPeVkJ8ePao0eLAgEC
|
|
41
41
|
def ssl_client(host, port)
|
42
42
|
ctx = OpenSSL::SSL::SSLContext.new
|
43
43
|
ctx.ciphers = "ADH"
|
44
|
+
ctx.security_level = 0
|
44
45
|
s = TCPSocket.new(host, port)
|
45
46
|
ssl = OpenSSL::SSL::SSLSocket.new(s, ctx)
|
46
47
|
ssl.connect
|
@@ -51,6 +52,7 @@ AQjjxMXhwULlmuR/K+WwlaZPiLIBYalLAZQ7ZbOPeVkJ8ePao0eLAgEC
|
|
51
52
|
def srv_ctx
|
52
53
|
ctx = OpenSSL::SSL::SSLContext.new
|
53
54
|
ctx.ciphers = "ADH"
|
55
|
+
ctx.security_level = 0
|
54
56
|
ctx.tmp_dh_callback = proc { TEST_KEY_DH1024 }
|
55
57
|
ctx
|
56
58
|
end
|
data/test/test_unix_socket.rb
CHANGED
data/test/test_wbuf.rb
CHANGED
data/yahns.gemspec
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (C)
|
2
|
-
# License: GPL-3.0+
|
1
|
+
# Copyright (C) all contributors <yahns-public@yhbt.net>
|
2
|
+
# License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
manifest = File.read('.gem-manifest').split(/\n/)
|
5
5
|
s.name = %q{yahns}
|
@@ -7,12 +7,15 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.authors = ["yahns hackers"]
|
8
8
|
s.summary = "sleepy, multi-threaded, non-blocking application server"
|
9
9
|
s.description = File.read("README").split(/\n\n/)[1].strip
|
10
|
-
s.email = %q{yahns@yhbt.net}
|
10
|
+
s.email = %q{yahns-public@yhbt.net}
|
11
11
|
s.executables = manifest.grep(%r{\Abin/}).map { |s| s.sub(%r{\Abin/}, "") }
|
12
12
|
s.files = manifest
|
13
|
+
|
14
|
+
s.required_ruby_version = '>= 2.0'
|
15
|
+
|
13
16
|
s.add_dependency(%q<kgio>, '~> 2.9')
|
14
17
|
s.add_dependency(%q<sleepy_penguin>, '~> 3.2')
|
15
|
-
s.add_dependency(%q<unicorn>, '>= 4.6.3', '<
|
18
|
+
s.add_dependency(%q<unicorn>, '>= 4.6.3', '< 7.0')
|
16
19
|
# s.add_dependency(%q<kgio-sendfile>, '~> 1.2') # optional
|
17
20
|
|
18
21
|
# minitest is standard in Ruby 2.0, 4.3 is packaged with Ruby 2.0.0,
|
@@ -25,6 +28,6 @@ Gem::Specification.new do |s|
|
|
25
28
|
# for Rack::Utils::HeaderHash#each
|
26
29
|
s.add_development_dependency(%q<rack>, '>= 1.1')
|
27
30
|
|
28
|
-
s.homepage = 'https://yhbt.net/yahns/
|
31
|
+
s.homepage = 'https://yhbt.net/yahns.git/about/'
|
29
32
|
s.licenses = "GPL-3.0+"
|
30
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yahns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yahns hackers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kgio
|
@@ -47,7 +47,7 @@ dependencies:
|
|
47
47
|
version: 4.6.3
|
48
48
|
- - "<"
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version: '
|
50
|
+
version: '7.0'
|
51
51
|
type: :runtime
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -57,7 +57,7 @@ dependencies:
|
|
57
57
|
version: 4.6.3
|
58
58
|
- - "<"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
60
|
+
version: '7.0'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: minitest
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -99,13 +99,14 @@ description: |-
|
|
99
99
|
yahns currently hosts Rack/HTTP applications, but may eventually support
|
100
100
|
other application types. Unlike some existing servers, yahns is
|
101
101
|
extremely sensitive to fatal bugs in the applications it hosts.
|
102
|
-
email: yahns@yhbt.net
|
102
|
+
email: yahns-public@yhbt.net
|
103
103
|
executables:
|
104
104
|
- yahns
|
105
105
|
- yahns-rackup
|
106
106
|
extensions: []
|
107
107
|
extra_rdoc_files: []
|
108
108
|
files:
|
109
|
+
- ".document"
|
109
110
|
- ".gitattributes"
|
110
111
|
- ".gitignore"
|
111
112
|
- ".olddoc.yml"
|
@@ -127,9 +128,11 @@ files:
|
|
127
128
|
- bin/yahns
|
128
129
|
- bin/yahns-rackup
|
129
130
|
- examples/README
|
131
|
+
- examples/https_proxy_pass.conf.rb
|
130
132
|
- examples/init.sh
|
131
133
|
- examples/logger_mp_safe.rb
|
132
134
|
- examples/logrotate.conf
|
135
|
+
- examples/proxy_pass.ru
|
133
136
|
- examples/yahns.socket
|
134
137
|
- examples/yahns@.service
|
135
138
|
- examples/yahns_multi.conf.rb
|
@@ -211,6 +214,7 @@ files:
|
|
211
214
|
- test/test_proxy_pass.rb
|
212
215
|
- test/test_proxy_pass_no_buffering.rb
|
213
216
|
- test/test_rack.rb
|
217
|
+
- test/test_rack_env.rb
|
214
218
|
- test/test_rack_hijack.rb
|
215
219
|
- test/test_reopen_logs.rb
|
216
220
|
- test/test_response.rb
|
@@ -222,7 +226,7 @@ files:
|
|
222
226
|
- test/test_unix_socket.rb
|
223
227
|
- test/test_wbuf.rb
|
224
228
|
- yahns.gemspec
|
225
|
-
homepage: https://yhbt.net/yahns/
|
229
|
+
homepage: https://yhbt.net/yahns.git/about/
|
226
230
|
licenses:
|
227
231
|
- GPL-3.0+
|
228
232
|
metadata: {}
|
@@ -234,15 +238,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
234
238
|
requirements:
|
235
239
|
- - ">="
|
236
240
|
- !ruby/object:Gem::Version
|
237
|
-
version: '0'
|
241
|
+
version: '2.0'
|
238
242
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
239
243
|
requirements:
|
240
244
|
- - ">="
|
241
245
|
- !ruby/object:Gem::Version
|
242
246
|
version: '0'
|
243
247
|
requirements: []
|
244
|
-
|
245
|
-
rubygems_version: 2.6.8
|
248
|
+
rubygems_version: 3.0.2
|
246
249
|
signing_key:
|
247
250
|
specification_version: 4
|
248
251
|
summary: sleepy, multi-threaded, non-blocking application server
|