yahns 1.14.1 → 1.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/Documentation/design_notes.txt +6 -3
- data/Documentation/yahns-rackup.pod +1 -1
- data/Documentation/yahns_config.pod +2 -2
- data/GIT-VERSION-GEN +1 -1
- data/HACKING +7 -6
- data/README +6 -2
- data/Rakefile +97 -4
- data/examples/logrotate.conf +1 -1
- data/lib/yahns/chunk_body.rb +2 -1
- data/lib/yahns/http_response.rb +1 -1
- data/lib/yahns/proxy_http_response.rb +3 -1
- data/lib/yahns/proxy_pass.rb +6 -0
- data/lib/yahns/stream_input.rb +3 -2
- data/lib/yahns/tee_input.rb +1 -3
- data/yahns.gemspec +1 -1
- metadata +4 -5
- data/.olddoc.yml +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e2b90d1e9db03563036b8fa9d20f734eadbc66b
|
4
|
+
data.tar.gz: da4bfdde14dc21244e1ce59e5696e56bb23d7327
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7f796332d347e087508c0ddd7fbba45567e2c51fdc1b9718b911ca03b058c111131e399f0779c8c28abb950197a3cc7e057e5fcee1577c9e32367173486188a
|
7
|
+
data.tar.gz: b12c67cec9e1d9b6f752dc0282d0de9609e72074f2210bc54b68e4b6e47447ae238887aa6a87fcde6d95912ff86f54f9a9617c3d0596411fdba4101b408715cb
|
data/.gitignore
CHANGED
@@ -17,9 +17,12 @@ socket we have inside the kernel.
|
|
17
17
|
Each listen queue has a dedicated thread pool running _blocking_
|
18
18
|
accept(2) (or accept4(2)) syscall in a loop. We use dedicated threads
|
19
19
|
and blocking accept to benefit from "wake-one" behavior in the Linux
|
20
|
-
kernel. By default, this thread pool only has thread per-process, doing
|
20
|
+
kernel. By default, this thread pool only has one thread per-process, doing
|
21
21
|
nothing but accepting sockets and injecting into to the event queue
|
22
|
-
(used by epoll or kqueue).
|
22
|
+
(used by epoll or kqueue) so a worker thread pool can pick them up.
|
23
|
+
|
24
|
+
This design makes EPOLLEXCLUSIVE in Linux 4.5+ unnecessary to us,
|
25
|
+
our listen sockets are never registered with epoll or kqueue.
|
23
26
|
|
24
27
|
worker thread pool
|
25
28
|
------------------
|
@@ -38,7 +41,7 @@ allows us to guarantee exclusive access to a client socket without
|
|
38
41
|
additional locks managed in userspace.
|
39
42
|
|
40
43
|
Idle threads will sit performing epoll_wait(2) (or kevent(2))
|
41
|
-
indefinitely until a socket is reported as "ready" by the kernel.
|
44
|
+
indefinitely until a client socket is reported as "ready" by the kernel.
|
42
45
|
|
43
46
|
queue flow
|
44
47
|
----------
|
@@ -168,7 +168,7 @@ List archives are available at L<https://yhbt.net/yahns-public/>
|
|
168
168
|
=head1 COPYRIGHT
|
169
169
|
|
170
170
|
Copyright (C) 2013-2016 all contributors L<mailto:yahns-public@yhbt.net>
|
171
|
-
License: GPL-3.0+ L<
|
171
|
+
License: GPL-3.0+ L<https://www.gnu.org/licenses/gpl-3.0.txt>
|
172
172
|
|
173
173
|
=head1 SEE ALSO
|
174
174
|
|
@@ -427,7 +427,7 @@ To enable TLS connections, you must configure this yourself.
|
|
427
427
|
See documentation for OpenSSL::SSL::SSLContext
|
428
428
|
for more information:
|
429
429
|
|
430
|
-
L<
|
430
|
+
L<https://docs.ruby-lang.org/en/trunk/OpenSSL/SSL/SSLContext.html>
|
431
431
|
|
432
432
|
Default: none
|
433
433
|
|
@@ -667,7 +667,7 @@ List archives are available at L<https://yhbt.net/yahns-public/>
|
|
667
667
|
=head1 COPYRIGHT
|
668
668
|
|
669
669
|
Copyright (C) 2013-2016 all contributors L<mailto:yahns-public@yhbt.net>
|
670
|
-
License: GPL-3.0+ L<
|
670
|
+
License: GPL-3.0+ L<https://www.gnu.org/licenses/gpl-3.0.txt>
|
671
671
|
|
672
672
|
=head1 SEE ALSO
|
673
673
|
|
data/GIT-VERSION-GEN
CHANGED
data/HACKING
CHANGED
@@ -2,12 +2,12 @@ development dependencies
|
|
2
2
|
------------------------
|
3
3
|
|
4
4
|
* minitest RubyGem (version 4 or 5, standard in Ruby 2.0+)
|
5
|
-
* curl -
|
5
|
+
* curl - https://curl.haxx.se/ - we don't trust our own Ruby abilities :>
|
6
6
|
* dd(1) - standard POSIX tool - to feed curl
|
7
|
-
* ab -
|
7
|
+
* ab - https://httpd.apache.org/ - for concurrent testing
|
8
8
|
* GNU make - https://www.gnu.org/software/make/
|
9
|
-
* git -
|
10
|
-
* ruby -
|
9
|
+
* git - https://www.git-scm.com/
|
10
|
+
* ruby - https://www.ruby-lang.org/en/
|
11
11
|
|
12
12
|
git clone git://yhbt.net/yahns
|
13
13
|
|
@@ -47,9 +47,10 @@ 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
|
-
|
50
|
+
All mail is archived publically at: https://yhbt.net/yahns-public/
|
51
|
+
Anonymous contributions will always be welcome.
|
51
52
|
No subscription is necessary to post to the mailing list.
|
52
53
|
Please remember to Cc: all recipients as subscription is optional.
|
53
54
|
|
54
55
|
Copyright (C) 2013-2016 all contributors <yahns-public@yhbt.net>
|
55
|
-
License: GPL-3.0+ <
|
56
|
+
License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
|
data/README
CHANGED
@@ -66,8 +66,12 @@ You may optionally subscribe by sending an email to:
|
|
66
66
|
|
67
67
|
yahns-public+subscribe@yhbt.net
|
68
68
|
|
69
|
-
|
69
|
+
We suck at delivering email, so relying on the archives might be
|
70
|
+
a better bet:
|
71
|
+
|
72
|
+
Mailing list archives browsable via HTTPS: https://yhbt.net/yahns-public/
|
70
73
|
Or NNTP: nntp://news.public-inbox.org/inbox.comp.lang.ruby.yahns
|
74
|
+
Atom feed: https://yhbt.net/yahns-public/new.atom
|
71
75
|
|
72
76
|
This README is our homepage, we would rather be working on HTTP servers
|
73
77
|
all day than worrying about the next browser vulnerability because
|
@@ -88,7 +92,7 @@ the git(7) suite for generating and sending patches. Please format
|
|
88
92
|
pull requests with the git-request-pull(1) script (also distributed
|
89
93
|
with git(7)) and send them via email.
|
90
94
|
|
91
|
-
See
|
95
|
+
See https://www.git-scm.com/ for more information on git.
|
92
96
|
|
93
97
|
Design
|
94
98
|
------
|
data/Rakefile
CHANGED
@@ -66,12 +66,105 @@ def tags
|
|
66
66
|
end.compact.sort { |a,b| b[:time] <=> a[:time] }
|
67
67
|
end
|
68
68
|
|
69
|
+
def xml(dst, tag, text = nil, attrs = nil)
|
70
|
+
if Hash === text
|
71
|
+
attrs = text
|
72
|
+
text = nil
|
73
|
+
end
|
74
|
+
if attrs
|
75
|
+
attrs = attrs.map { |k,v| "#{k}=#{v.encode(xml: :attr)}" }
|
76
|
+
attrs = "\n#{attrs.join("\n")}"
|
77
|
+
end
|
78
|
+
case text
|
79
|
+
when nil
|
80
|
+
if block_given?
|
81
|
+
dst << "<#{tag}#{attrs}>"
|
82
|
+
yield
|
83
|
+
dst << "</#{tag}>"
|
84
|
+
else
|
85
|
+
dst << "<#{tag}#{attrs}/>"
|
86
|
+
end
|
87
|
+
else
|
88
|
+
dst << "<#{tag}#{attrs}>#{text.encode(xml: :text)}</#{tag}>"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
69
92
|
desc 'prints news as an Atom feed'
|
70
93
|
task "NEWS.atom.xml" do
|
71
|
-
|
72
|
-
|
73
|
-
|
94
|
+
require 'uri'
|
95
|
+
cgit_uri = URI('https://yhbt.net/yahns.git')
|
96
|
+
uri = URI('https://yhbt.net/yahns/')
|
97
|
+
new_tags = tags[0,10]
|
98
|
+
time = nil
|
99
|
+
project_name = 'yahns'
|
100
|
+
short_desc = File.readlines('README')[0].split(' - ')[0]
|
101
|
+
new_tags = tags[0,10]
|
102
|
+
atom_uri = uri.dup
|
103
|
+
atom_uri.path += 'NEWS.atom.xml'
|
104
|
+
news_uri = uri.dup
|
105
|
+
news_uri.path += 'NEWS.html'
|
106
|
+
dst = ''
|
107
|
+
xml(dst, 'feed', xmlns: 'http://www.w3.org/2005/Atom') do
|
108
|
+
xml(dst, 'id', atom_uri.to_s)
|
109
|
+
xml(dst, 'title', "#{project_name} news")
|
110
|
+
xml(dst, 'subtitle', short_desc)
|
111
|
+
xml(dst, 'link', rel: 'alternate', type: 'text/html', href: news_uri.to_s)
|
112
|
+
xml(dst, 'updated', new_tags.empty? ? '1970-01-01:00:00:00Z'
|
113
|
+
: new_tags[0][:time])
|
114
|
+
new_tags.each do |tag|
|
115
|
+
xml(dst, 'entry') do
|
116
|
+
xml(dst, 'title', tag[:subject])
|
117
|
+
xml(dst, 'updated', tag[:time])
|
118
|
+
xml(dst, 'published', tag[:time])
|
119
|
+
xml(dst, 'author') do
|
120
|
+
xml(dst, 'name', tag[:tagger_name])
|
121
|
+
xml(dst, 'email', tag[:tagger_email])
|
122
|
+
end
|
123
|
+
uri = cgit_uri.dup
|
124
|
+
uri.path += '/tag/'
|
125
|
+
uri.query = "id=#{tag[:tag]}"
|
126
|
+
uri = uri.to_s
|
127
|
+
xml(dst, 'link', rel: 'alternate', type: 'text/html', href: uri)
|
128
|
+
xml(dst, 'id', uri)
|
129
|
+
xml(dst, 'content', type: 'xhtml') do
|
130
|
+
xml(dst, 'div', xmlns: 'http://www.w3.org/1999/xhtml') do
|
131
|
+
xml(dst, 'pre', tag[:body])
|
132
|
+
end # div
|
133
|
+
end # content
|
134
|
+
end # entry
|
135
|
+
end # new_tags.each
|
136
|
+
end # feed
|
137
|
+
|
138
|
+
fp = Tempfile.new('NEWS.atom.xml', '.')
|
139
|
+
fp.sync = true
|
140
|
+
fp.write(dst)
|
141
|
+
fp.chmod 0644
|
142
|
+
File.utime(time, time, fp.path) if time
|
143
|
+
File.rename(fp.path, 'NEWS.atom.xml')
|
144
|
+
fp.close!
|
74
145
|
end
|
75
146
|
|
76
147
|
desc 'prints news as a text file'
|
77
|
-
task 'NEWS'
|
148
|
+
task 'NEWS' do
|
149
|
+
fp = Tempfile.new('NEWS', '.')
|
150
|
+
fp.sync = true
|
151
|
+
time = nil
|
152
|
+
tags.each do |tag|
|
153
|
+
time ||= tag[:time_obj]
|
154
|
+
line = tag[:subject] + ' / ' + tag[:time].sub(/T.*/, '')
|
155
|
+
fp.puts line
|
156
|
+
fp.puts('-' * line.length)
|
157
|
+
fp.puts
|
158
|
+
fp.puts tag[:body]
|
159
|
+
fp.puts
|
160
|
+
end
|
161
|
+
fp.write("Unreleased\n\n") unless fp.size > 0
|
162
|
+
fp.puts "COPYRIGHT"
|
163
|
+
fp.puts "---------"
|
164
|
+
fp.puts "Copyright (C) 2013-2017 all contributors <yahns-public@yhbt.net>"
|
165
|
+
fp.puts "License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>"
|
166
|
+
fp.chmod 0644
|
167
|
+
File.utime(time, time, fp.path) if time
|
168
|
+
File.rename(fp.path, 'NEWS')
|
169
|
+
fp.close!
|
170
|
+
end
|
data/examples/logrotate.conf
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# /etc/logrotate.d/yahns_app on my Debian systems
|
6
6
|
#
|
7
7
|
# See the logrotate(8) manpage for more information:
|
8
|
-
#
|
8
|
+
# https://linux.die.net/man/8/logrotate
|
9
9
|
|
10
10
|
# Modify the following glob to match the logfiles your app writes to:
|
11
11
|
/var/log/yahns_app/*.log {
|
data/lib/yahns/chunk_body.rb
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
# Copyright (C) 2016 all contributors <yahns-public@yhbt.net>
|
3
3
|
# License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
|
4
4
|
# frozen_string_literal: true
|
5
|
-
|
5
|
+
|
6
|
+
class Yahns::ChunkBody # :nodoc:
|
6
7
|
def initialize(body, vec)
|
7
8
|
@body = body
|
8
9
|
@vec = vec
|
data/lib/yahns/http_response.rb
CHANGED
@@ -132,7 +132,9 @@ def proxy_res_headers(res, req_res)
|
|
132
132
|
|
133
133
|
# send the headers
|
134
134
|
case rv = kgio_syssend(res, flags)
|
135
|
-
when nil
|
135
|
+
when nil # all done, likely
|
136
|
+
res.clear
|
137
|
+
break
|
136
138
|
when String # partial write, highly unlikely
|
137
139
|
flags = MSG_DONTWAIT
|
138
140
|
res = rv # hope the skb grows
|
data/lib/yahns/proxy_pass.rb
CHANGED
@@ -6,6 +6,12 @@
|
|
6
6
|
require 'rack/request'
|
7
7
|
require 'timeout'
|
8
8
|
|
9
|
+
# XXX consider this file and the proxy-related stuff in yahns
|
10
|
+
# unstable and experimental! It has never been documented and
|
11
|
+
# incompatible changes may still happen.
|
12
|
+
#
|
13
|
+
# However, it seems to be proxying for our mail archives well enough:
|
14
|
+
# https://yhbt.net/yahns-public/
|
9
15
|
require_relative 'proxy_http_response'
|
10
16
|
require_relative 'req_res'
|
11
17
|
|
data/lib/yahns/stream_input.rb
CHANGED
@@ -43,8 +43,9 @@ def read(length = nil, rv = ''.dup)
|
|
43
43
|
length < 0 and raise ArgumentError, "negative length #{length} given"
|
44
44
|
rv.replace(@rbuf.slice!(0, length))
|
45
45
|
else
|
46
|
-
|
47
|
-
|
46
|
+
cur = @rbuf.size
|
47
|
+
to_read = length - cur
|
48
|
+
cur == 0 ? rv.clear : rv.replace(@rbuf.slice!(0, cur))
|
48
49
|
until to_read == 0 || eof? || (rv.size > 0 && @chunked)
|
49
50
|
@client.yahns_read(to_read, @buf) or eof!
|
50
51
|
filter_body(@rbuf, @buf)
|
data/lib/yahns/tee_input.rb
CHANGED
data/yahns.gemspec
CHANGED
@@ -7,7 +7,7 @@
|
|
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
13
|
s.add_dependency(%q<kgio>, '~> 2.9')
|
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.15.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: 2017-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kgio
|
@@ -99,7 +99,7 @@ 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
|
@@ -108,7 +108,6 @@ extra_rdoc_files: []
|
|
108
108
|
files:
|
109
109
|
- ".gitattributes"
|
110
110
|
- ".gitignore"
|
111
|
-
- ".olddoc.yml"
|
112
111
|
- COPYING
|
113
112
|
- Documentation/.gitignore
|
114
113
|
- Documentation/GNUmakefile
|
@@ -242,7 +241,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
242
241
|
version: '0'
|
243
242
|
requirements: []
|
244
243
|
rubyforge_project:
|
245
|
-
rubygems_version: 2.6.
|
244
|
+
rubygems_version: 2.6.10
|
246
245
|
signing_key:
|
247
246
|
specification_version: 4
|
248
247
|
summary: sleepy, multi-threaded, non-blocking application server
|