yahns 1.13.0 → 1.14.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/.olddoc.yml +3 -3
- data/Documentation/yahns-rackup.pod +1 -1
- data/Documentation/yahns.pod +1 -1
- data/Documentation/yahns_config.pod +1 -1
- data/GIT-VERSION-GEN +1 -1
- data/HACKING +1 -1
- data/README +2 -2
- data/Rakefile +2 -2
- data/extras/README +1 -1
- data/lib/yahns.rb +2 -2
- data/lib/yahns/config.rb +1 -1
- data/lib/yahns/http_response.rb +7 -4
- data/lib/yahns/openssl_client.rb +3 -1
- data/lib/yahns/req_res.rb +1 -1
- data/lib/yahns/stream_file.rb +15 -19
- data/yahns.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73a1df35604f8a2a57198e315bc7a3f1c0f008d2
|
4
|
+
data.tar.gz: 7ad6f6bf6464151fcb205a774e68475549f1a73b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cc36eff407f38c2fe1d768e334455f311672dd0e82f1376fce79151ef4ec07fe1019646087eb24a1d0cb01d5b792cf40da6eb9ac295d58b9e4bb28e9ecb6e99
|
7
|
+
data.tar.gz: 8b28720a5ff4234b702347cef2e2cc7e5309886ef6b021ef1592cf2d9363c53235209def345329df1903859697f69b4c3afaafa8f946318c708cc8bd34fd205a
|
data/.olddoc.yml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
cgit_url:
|
2
|
+
cgit_url: https://yhbt.net/yahns.git
|
3
3
|
git_url: git://yhbt.net/yahns.git
|
4
|
-
rdoc_url:
|
5
|
-
ml_url:
|
4
|
+
rdoc_url: https://yhbt.net/yahns/
|
5
|
+
ml_url: https://yhbt.net/yahns-public/
|
6
6
|
public_email: yahns-public@yhbt.net
|
7
7
|
private_email: yahns@yhbt.net
|
@@ -163,7 +163,7 @@ See rackup documentation for more details.
|
|
163
163
|
|
164
164
|
All feedback welcome via plain-text mail to L<mailto:yahns-public@yhbt.net>
|
165
165
|
No subscription is necessary to post to the mailing list.
|
166
|
-
List archives are available at L<
|
166
|
+
List archives are available at L<https://yhbt.net/yahns-public/>
|
167
167
|
|
168
168
|
=head1 COPYRIGHT
|
169
169
|
|
data/Documentation/yahns.pod
CHANGED
@@ -84,7 +84,7 @@ See L<yahns_config(5)> for documentation on the configuration file format.
|
|
84
84
|
|
85
85
|
All feedback welcome via plain-text mail to L<mailto:yahns-public@yhbt.net>
|
86
86
|
No subscription is necessary to post to the mailing list.
|
87
|
-
Mail archives are available at L<
|
87
|
+
Mail archives are available at L<https://yhbt.net/yahns-public/>
|
88
88
|
|
89
89
|
=head1 COPYRIGHT
|
90
90
|
|
@@ -662,7 +662,7 @@ See the examples/ directory in the git source tree.
|
|
662
662
|
|
663
663
|
All feedback welcome via plain-text mail to L<mailto:yahns-public@yhbt.net>
|
664
664
|
No subscription is necessary to post to the mailing list.
|
665
|
-
List archives are available at L<
|
665
|
+
List archives are available at L<https://yhbt.net/yahns-public/>
|
666
666
|
|
667
667
|
=head1 COPYRIGHT
|
668
668
|
|
data/GIT-VERSION-GEN
CHANGED
data/HACKING
CHANGED
@@ -47,7 +47,7 @@ developers do. Please send patches via git-send-email(1) to the public
|
|
47
47
|
mailing list at <yahns-public@yhbt.net>. Pull requests should be
|
48
48
|
formatted using git-request-pull(1).
|
49
49
|
|
50
|
-
Mailing list archives:
|
50
|
+
Mailing list archives: https://yhbt.net/yahns-public/
|
51
51
|
No subscription is necessary to post to the mailing list.
|
52
52
|
Please remember to Cc: all recipients as subscription is optional.
|
53
53
|
|
data/README
CHANGED
@@ -66,14 +66,14 @@ You may optionally subscribe by sending an email to:
|
|
66
66
|
|
67
67
|
yahns-public+subscribe@yhbt.net
|
68
68
|
|
69
|
-
Mailing list archives browsable via HTTP:
|
69
|
+
Mailing list archives browsable via HTTP: https://yhbt.net/yahns-public/
|
70
70
|
Or NNTP: nntp://news.public-inbox.org/inbox.comp.lang.ruby.yahns
|
71
71
|
|
72
72
|
This README is our homepage, we would rather be working on HTTP servers
|
73
73
|
all day than worrying about the next browser vulnerability because
|
74
74
|
HTML/CSS/JS is too complicated for us.
|
75
75
|
|
76
|
-
*
|
76
|
+
* https://yhbt.net/yahns/README
|
77
77
|
|
78
78
|
Hacking
|
79
79
|
-------
|
data/Rakefile
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
gendocs = %w(NEWS NEWS.atom.xml)
|
7
7
|
task rsync_docs: gendocs do
|
8
|
-
dest = ENV["RSYNC_DEST"] || "
|
8
|
+
dest = ENV["RSYNC_DEST"] || "yhbt.net:/srv/yhbt/yahns/"
|
9
9
|
top = %w(INSTALL HACKING README COPYING)
|
10
10
|
|
11
11
|
# git-set-file-times is distributed with rsync,
|
12
|
-
# Also available at:
|
12
|
+
# Also available at: https://yhbt.net/git-set-file-times
|
13
13
|
# on Debian systems: /usr/share/doc/rsync/scripts/git-set-file-times.gz
|
14
14
|
sh("git", "set-file-times", "Documentation", "examples", *top)
|
15
15
|
make = ENV['MAKE'] || 'make'
|
data/extras/README
CHANGED
@@ -3,7 +3,7 @@ yahns extras
|
|
3
3
|
|
4
4
|
This is random crap used to power one of the top websites in the galaxy:
|
5
5
|
|
6
|
-
|
6
|
+
https://YHBT.net/
|
7
7
|
|
8
8
|
The code in this extras directory is officially part of yahns but may
|
9
9
|
be useful to some (even outside of yahns). There are no guarantees
|
data/lib/yahns.rb
CHANGED
@@ -16,8 +16,8 @@
|
|
16
16
|
end
|
17
17
|
|
18
18
|
# yahns exposes no user-visible API outside of the config file.
|
19
|
-
# See
|
20
|
-
# and
|
19
|
+
# See https://yhbt.net/yahns/yahns_config.txt for the config documentation
|
20
|
+
# and https://yhbt.net/yahns/ for the homepage.
|
21
21
|
# Internals are subject to change.
|
22
22
|
|
23
23
|
module Yahns
|
data/lib/yahns/config.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
# frozen_string_literal: true
|
5
5
|
#
|
6
6
|
# Implements a DSL for configuring a yahns server.
|
7
|
-
# See
|
7
|
+
# See https://yhbt.net/yahns/examples/yahns_multi.conf.rb for a full
|
8
8
|
# example configuration file.
|
9
9
|
class Yahns::Config # :nodoc:
|
10
10
|
# public within yahns itself, NOT a public interface for users outside
|
data/lib/yahns/http_response.rb
CHANGED
@@ -60,7 +60,7 @@ def err_response(code)
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def response_header_blocked(header, body, alive, offset, count)
|
63
|
-
if body.respond_to?(:to_path)
|
63
|
+
if body.respond_to?(:to_path) && count
|
64
64
|
alive = Yahns::StreamFile.new(body, alive, offset, count)
|
65
65
|
body = nil
|
66
66
|
end
|
@@ -125,7 +125,7 @@ def kv_str(buf, key, value)
|
|
125
125
|
def http_response_write(res, opt)
|
126
126
|
status, headers, body = res
|
127
127
|
offset = 0
|
128
|
-
count = hijack = nil
|
128
|
+
count = hijack = clen = nil
|
129
129
|
alive = @hs.next? && self.class.persistent_connections
|
130
130
|
flags = MSG_DONTWAIT
|
131
131
|
term = false
|
@@ -152,7 +152,8 @@ def http_response_write(res, opt)
|
|
152
152
|
alive = false if value =~ /\bclose\b/i
|
153
153
|
when %r{\AContent-Length\z}i
|
154
154
|
term = true
|
155
|
-
|
155
|
+
clen = value.to_i
|
156
|
+
flags |= MSG_MORE if clen > 0 && !hdr_only
|
156
157
|
kv_str(buf, key, value)
|
157
158
|
when %r{\ATransfer-Encoding\z}i
|
158
159
|
term = true if value =~ /\bchunked\b/i
|
@@ -163,6 +164,8 @@ def http_response_write(res, opt)
|
|
163
164
|
kv_str(buf, key, value)
|
164
165
|
end
|
165
166
|
end
|
167
|
+
count ||= clen
|
168
|
+
|
166
169
|
if !term && chunk_ok
|
167
170
|
term = true
|
168
171
|
body = Yahns::ChunkBody.new(body, opt)
|
@@ -194,7 +197,7 @@ def http_response_write(res, opt)
|
|
194
197
|
return response_hijacked(hijack) if hijack
|
195
198
|
return http_response_done(alive) if hdr_only
|
196
199
|
|
197
|
-
if body.respond_to?(:to_path)
|
200
|
+
if body.respond_to?(:to_path) && count
|
198
201
|
@state = body = Yahns::StreamFile.new(body, alive, offset, count)
|
199
202
|
return step_write
|
200
203
|
end
|
data/lib/yahns/openssl_client.rb
CHANGED
@@ -38,12 +38,14 @@ def yahns_init_ssl(ssl_ctx)
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def kgio_trywrite(buf)
|
41
|
+
len = buf.bytesize
|
42
|
+
return if len == 0
|
41
43
|
buf = @ssl_blocked = buf.dup
|
42
44
|
case rv = @ssl.write_nonblock(buf, exception: false)
|
43
45
|
when :wait_readable, :wait_writable
|
44
46
|
return rv # do not clear ssl_blocked
|
45
47
|
when Integer
|
46
|
-
rv =
|
48
|
+
rv = len == rv ? nil : buf.byteslice(rv, len - rv)
|
47
49
|
end
|
48
50
|
@ssl_blocked = nil
|
49
51
|
rv
|
data/lib/yahns/req_res.rb
CHANGED
@@ -76,7 +76,7 @@ def yahns_step # yahns event loop entry point
|
|
76
76
|
when Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::EPIPE
|
77
77
|
e.set_backtrace([])
|
78
78
|
end
|
79
|
-
c.proxy_err_response(502, self, e)
|
79
|
+
c.proxy_err_response(Yahns::WbufCommon === @resbuf ? nil : 502, self, e)
|
80
80
|
end
|
81
81
|
|
82
82
|
def send_req_body_chunk(buf)
|
data/lib/yahns/stream_file.rb
CHANGED
@@ -11,28 +11,24 @@ class Yahns::StreamFile # :nodoc:
|
|
11
11
|
NeedClose = Class.new(File) # :nodoc:
|
12
12
|
|
13
13
|
def initialize(body, persist, offset, count)
|
14
|
-
|
15
|
-
|
14
|
+
path = body.to_path
|
15
|
+
if path =~ %r{\A/dev/fd/(\d+)\z}
|
16
|
+
@tmpio = IO.for_fd($1.to_i)
|
17
|
+
@tmpio.autoclose = false
|
16
18
|
else
|
17
|
-
|
18
|
-
|
19
|
-
@tmpio =
|
20
|
-
|
21
|
-
|
22
|
-
retried =
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
raise if retried
|
27
|
-
retried = true
|
28
|
-
Thread.current[:yahns_fdmap].desperate_expire(5)
|
29
|
-
sleep(1)
|
30
|
-
retry
|
31
|
-
end
|
19
|
+
retried = false
|
20
|
+
begin
|
21
|
+
@tmpio = NeedClose.open(path)
|
22
|
+
rescue Errno::EMFILE, Errno::ENFILE
|
23
|
+
raise if retried
|
24
|
+
retried = true
|
25
|
+
Thread.current[:yahns_fdmap].desperate_expire(5)
|
26
|
+
sleep(1)
|
27
|
+
retry
|
32
28
|
end
|
33
29
|
end
|
34
|
-
@sf_offset = offset
|
35
|
-
@sf_count = count
|
30
|
+
@sf_offset = offset || 0
|
31
|
+
@sf_count = count
|
36
32
|
@wbuf_persist = persist # whether or not we keep the connection alive
|
37
33
|
@body = body
|
38
34
|
end
|
data/yahns.gemspec
CHANGED
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.14.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: 2016-
|
11
|
+
date: 2016-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kgio
|
@@ -222,7 +222,7 @@ files:
|
|
222
222
|
- test/test_unix_socket.rb
|
223
223
|
- test/test_wbuf.rb
|
224
224
|
- yahns.gemspec
|
225
|
-
homepage:
|
225
|
+
homepage: https://yhbt.net/yahns/README
|
226
226
|
licenses:
|
227
227
|
- GPL-3.0+
|
228
228
|
metadata: {}
|
@@ -242,7 +242,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
242
242
|
version: '0'
|
243
243
|
requirements: []
|
244
244
|
rubyforge_project:
|
245
|
-
rubygems_version: 2.6.
|
245
|
+
rubygems_version: 2.6.8
|
246
246
|
signing_key:
|
247
247
|
specification_version: 4
|
248
248
|
summary: sleepy, multi-threaded, non-blocking application server
|