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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 100f23910c77a7e45fdb98c841bf13a166eb0b63
4
- data.tar.gz: ea3c7b2801fa134773bc079f637ccf419b5e6ef5
3
+ metadata.gz: 7e2b90d1e9db03563036b8fa9d20f734eadbc66b
4
+ data.tar.gz: da4bfdde14dc21244e1ce59e5696e56bb23d7327
5
5
  SHA512:
6
- metadata.gz: 7ee178fa9b9b1122a4446353ca6c6f4744aa1589679deef510fe3afeae40f72f66b8ccb96b56476e2e67383b6cd17f10f23c1fedfd81ab588056944e5693fb83
7
- data.tar.gz: 1f7a89edf6427deeb0f01b26461c744fa56dc22edc5f84d14eacfb48a50618a5622dcc28e67041843d1ff5de2d6b40c4144b580f044e8770f1e453e268ab10a0
6
+ metadata.gz: b7f796332d347e087508c0ddd7fbba45567e2c51fdc1b9718b911ca03b058c111131e399f0779c8c28abb950197a3cc7e057e5fcee1577c9e32367173486188a
7
+ data.tar.gz: b12c67cec9e1d9b6f752dc0282d0de9609e72074f2210bc54b68e4b6e47447ae238887aa6a87fcde6d95912ff86f54f9a9617c3d0596411fdba4101b408715cb
data/.gitignore CHANGED
@@ -15,4 +15,3 @@
15
15
  .gem-manifest
16
16
  .tgz-manifest
17
17
  /doc
18
- /LATEST
@@ -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<http://www.gnu.org/licenses/gpl-3.0.txt>
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<http://docs.ruby-lang.org/en/trunk/OpenSSL/SSL/SSLContext.html>
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<http://www.gnu.org/licenses/gpl-3.0.txt>
670
+ License: GPL-3.0+ L<https://www.gnu.org/licenses/gpl-3.0.txt>
671
671
 
672
672
  =head1 SEE ALSO
673
673
 
@@ -5,7 +5,7 @@
5
5
  CONSTANT = "Yahns::VERSION"
6
6
  RVF = "lib/yahns/version.rb"
7
7
  GVF = "GIT-VERSION-FILE"
8
- DEF_VER = "v1.14.1"
8
+ DEF_VER = "v1.15.0"
9
9
  vn = DEF_VER.dup
10
10
 
11
11
  # First see if there is a version file (included in release tarballs),
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 - http://curl.haxx.se/ - we don't trust our own Ruby abilities :>
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 - http://httpd.apache.org/ - for concurrent testing
7
+ * ab - https://httpd.apache.org/ - for concurrent testing
8
8
  * GNU make - https://www.gnu.org/software/make/
9
- * git - http://www.git-scm.com/
10
- * ruby - http://www.ruby-lang.org/en/
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
- Mailing list archives: https://yhbt.net/yahns-public/
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+ <http://www.gnu.org/licenses/gpl-3.0.txt>
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
- Mailing list archives browsable via HTTP: https://yhbt.net/yahns-public/
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 http://www.git-scm.com/ for more information on git.
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
- # gem install 'olddoc', 'olddoc prepare' has no API besides the
72
- # command-line. This requires olddoc 1.1 or later.
73
- system('olddoc', 'prepare') or abort "olddoc prepare failed #$?"
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' => 'NEWS.atom.xml'
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
@@ -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
- # http://linux.die.net/man/8/logrotate
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 {
@@ -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
- class Yahns::ChunkBody
5
+
6
+ class Yahns::ChunkBody # :nodoc:
6
7
  def initialize(body, vec)
7
8
  @body = body
8
9
  @vec = vec
@@ -200,7 +200,7 @@ def http_response_write(res, opt)
200
200
  return step_write
201
201
  end
202
202
 
203
- wbuf = rv = nil
203
+ headers = wbuf = rv = nil
204
204
  body.each do |x|
205
205
  if wbuf
206
206
  rv = wbuf.wbuf_write(self, x)
@@ -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 then break # all done, likely
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
@@ -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
 
@@ -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
- to_read = length - @rbuf.size
47
- rv.replace(@rbuf.slice!(0, @rbuf.size))
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)
@@ -104,9 +104,7 @@ def consume!
104
104
  end
105
105
 
106
106
  def tee(buffer)
107
- if buffer && buffer.size > 0
108
- @tmp.write(buffer)
109
- end
107
+ @tmp.write(buffer) if buffer
110
108
  buffer
111
109
  end
112
110
 
@@ -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.14.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: 2016-12-14 00:00:00.000000000 Z
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.8
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
@@ -1,7 +0,0 @@
1
- ---
2
- cgit_url: https://yhbt.net/yahns.git
3
- git_url: git://yhbt.net/yahns.git
4
- rdoc_url: https://yhbt.net/yahns/
5
- ml_url: https://yhbt.net/yahns-public/
6
- public_email: yahns-public@yhbt.net
7
- private_email: yahns@yhbt.net