yahns 1.13.0 → 1.14.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: '0885938d8049ca0b240e7727bcf47c9558945997'
4
- data.tar.gz: 0b2a81c5a297241967f3f184a755c80d51f90a34
3
+ metadata.gz: 73a1df35604f8a2a57198e315bc7a3f1c0f008d2
4
+ data.tar.gz: 7ad6f6bf6464151fcb205a774e68475549f1a73b
5
5
  SHA512:
6
- metadata.gz: a5fa096ca664e7f224f933a5c37b437a15617decfca04415aa8928d33cd733fe700b0544966392929568c5dcacb25016971d7aab294c5d33a9e4907c66b5d60a
7
- data.tar.gz: 7dea50f747b2f7214c1de823fcb584b6da6738cb2c34ba8b5676a86636dddb322af50b22119a7a38b075fae692fb507feef3294e34538bd0ba0a88e6fb7a372a
6
+ metadata.gz: 2cc36eff407f38c2fe1d768e334455f311672dd0e82f1376fce79151ef4ec07fe1019646087eb24a1d0cb01d5b792cf40da6eb9ac295d58b9e4bb28e9ecb6e99
7
+ data.tar.gz: 8b28720a5ff4234b702347cef2e2cc7e5309886ef6b021ef1592cf2d9363c53235209def345329df1903859697f69b4c3afaafa8f946318c708cc8bd34fd205a
@@ -1,7 +1,7 @@
1
1
  ---
2
- cgit_url: http://yhbt.net/yahns.git
2
+ cgit_url: https://yhbt.net/yahns.git
3
3
  git_url: git://yhbt.net/yahns.git
4
- rdoc_url: http://yahns.yhbt.net/
5
- ml_url: http://yhbt.net/yahns-public/
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<http://yhbt.net/yahns-public/>
166
+ List archives are available at L<https://yhbt.net/yahns-public/>
167
167
 
168
168
  =head1 COPYRIGHT
169
169
 
@@ -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<http://yhbt.net/yahns-public/>
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<http://yhbt.net/yahns-public/>
665
+ List archives are available at L<https://yhbt.net/yahns-public/>
666
666
 
667
667
  =head1 COPYRIGHT
668
668
 
@@ -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.13.0"
8
+ DEF_VER = "v1.14.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
@@ -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: http://yhbt.net/yahns-public/
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: http://yhbt.net/yahns-public/
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
- * http://yahns.yhbt.net/README
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"] || "yahns.yhbt.net:/srv/yahns/"
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: http://yhbt.net/git-set-file-times
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'
@@ -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
- http://YHBT.net/
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
@@ -16,8 +16,8 @@
16
16
  end
17
17
 
18
18
  # yahns exposes no user-visible API outside of the config file.
19
- # See http://yahns.yhbt.net/yahns_config.txt for the config documentation
20
- # and http://yahns.yhbt.net/ for the homepage.
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
@@ -4,7 +4,7 @@
4
4
  # frozen_string_literal: true
5
5
  #
6
6
  # Implements a DSL for configuring a yahns server.
7
- # See http://yahns.yhbt.net/examples/yahns_multi.conf.rb for a full
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
@@ -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
- flags |= MSG_MORE if value.to_i > 0 && !hdr_only
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
@@ -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 = buf.bytesize == rv ? nil : buf.byteslice(rv, buf.bytesize - rv)
48
+ rv = len == rv ? nil : buf.byteslice(rv, len - rv)
47
49
  end
48
50
  @ssl_blocked = nil
49
51
  rv
@@ -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)
@@ -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
- if body.respond_to?(:to_io)
15
- @tmpio = body.to_io
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
- path = body.to_path
18
- if path =~ %r{\A/dev/fd/(\d+)\z}
19
- @tmpio = IO.for_fd($1.to_i)
20
- @tmpio.autoclose = false
21
- else
22
- retried = false
23
- begin
24
- @tmpio = NeedClose.open(path)
25
- rescue Errno::EMFILE, Errno::ENFILE
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 || @tmpio.size
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
@@ -25,6 +25,6 @@
25
25
  # for Rack::Utils::HeaderHash#each
26
26
  s.add_development_dependency(%q<rack>, '>= 1.1')
27
27
 
28
- s.homepage = "http://yahns.yhbt.net/README"
28
+ s.homepage = 'https://yhbt.net/yahns/README'
29
29
  s.licenses = "GPL-3.0+"
30
30
  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.13.0
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-08-05 00:00:00.000000000 Z
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: http://yahns.yhbt.net/README
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.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