yahns 1.12.4 → 1.12.5

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: 9dc252e71729c27f38d5ef8bb6f82274d80408e5
4
- data.tar.gz: ba8aa4cbf09b75919f065ba64924f1f6e76603d8
3
+ metadata.gz: b9e19ad9295dcdd4fb3423900a4061e9a4495597
4
+ data.tar.gz: e98ed154740a92a0378b0ddc255561bcda1ea391
5
5
  SHA512:
6
- metadata.gz: d768bd39c63353df5d086f6a5c1dfcb7c5e4725b4198ac2bf273a2c43865b3f804a1c4cd0d029bc8b95dc0eb4ecde6803e49a56eeba936df50da11a5458896ed
7
- data.tar.gz: e0a962d0514d0c0fd19ab83b3109c0b75ed07e551900c87307c0fba8300b346b1bedd9bb84036ede20ce0bc55fff509c1306e53f5c0074e0aa2e0e58ca8da10b
6
+ metadata.gz: 5e80a5f1d8ec22f04c7e80a1d128e18a6c05923ad2c850cafdae763c50e03c29242279160d73de267593789ab09b5e31beff797d177f5ff57aba7939de174480
7
+ data.tar.gz: 44fec12611e1e0f8f83868879b53c8fb9186e61c8be1bc5b020c4879ed25fdbbe5c1eb3aabe650e7b2270d7c4dcb6b77f1f21949926755987f1fe1bd05a37f0f
@@ -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.12.4"
8
+ DEF_VER = "v1.12.5"
9
9
  vn = DEF_VER.dup
10
10
 
11
11
  # First see if there is a version file (included in release tarballs),
@@ -22,8 +22,7 @@ def step_write
22
22
  case rv = @state.wbuf_flush(self)
23
23
  when :wait_writable, :wait_readable
24
24
  return rv # tell epoll/kqueue to wait on this more
25
- when :ignore # :ignore on hijack
26
- @state = :ignore
25
+ when :ignore # :ignore on hijack, @state already set in hijack_cleanup
27
26
  return :ignore
28
27
  when Yahns::StreamFile
29
28
  @state = rv # continue looping
@@ -254,8 +253,9 @@ def yahns_read(bytes, buf)
254
253
  # (and complicated) as our hijack support will allow "un-hijacking"
255
254
  # the socket.
256
255
  def hijack_cleanup
257
- # prevent socket from holding process up
256
+ # prevent socket from holding process exit up
258
257
  Thread.current[:yahns_fdmap].forget(self)
258
+ @state = :ignore
259
259
  @input = nil # keep env["rack.input"] accessible, though
260
260
  end
261
261
 
@@ -105,8 +105,12 @@ def proxy_response_start(res, tip, kcar, req_res)
105
105
 
106
106
  # chunk the response ourselves if the client supports it,
107
107
  # but the backend does not terminate properly
108
- if alive && ! term && (env['HTTP_VERSION'] == 'HTTP/1.1'.freeze)
109
- res << "Transfer-Encoding: chunked\r\n".freeze
108
+ if alive && ! term
109
+ if env['HTTP_VERSION'] == 'HTTP/1.1'.freeze
110
+ res << "Transfer-Encoding: chunked\r\n".freeze
111
+ else # we can't persist HTTP/1.0 and HTTP/0.9 w/o Content-Length
112
+ alive = false
113
+ end
110
114
  end
111
115
  res << (alive ? "Connection: keep-alive\r\n\r\n".freeze
112
116
  : "Connection: close\r\n\r\n".freeze)
@@ -226,9 +226,12 @@ def call(env)
226
226
  ver = 'HTTP/1.0'.freeze
227
227
  end
228
228
 
229
+ addr = env['REMOTE_ADDR']
230
+ xff = env['HTTP_X_FORWARDED_FOR']
231
+ xff = xff =~ /\S/ ? "#{xff}, #{addr}" : addr
229
232
  req = "#{env['REQUEST_METHOD']} #{req} #{ver}\r\n" \
230
233
  "X-Forwarded-Proto: #{env['rack.url_scheme']}\r\n" \
231
- "X-Forwarded-For: #{env["REMOTE_ADDR"]}\r\n".dup
234
+ "X-Forwarded-For: #{xff}\r\n".dup
232
235
 
233
236
  # pass most HTTP_* headers through as-is
234
237
  chunked = false
@@ -99,6 +99,14 @@ def test_client_expire_desperate
99
99
  end
100
100
  stderr_path err.path
101
101
  end
102
+
103
+ # 1024 is common on old systems, but nowadays Jessie seems to be 65536
104
+ nr = Process.getrlimit(:NOFILE)[0]
105
+ if nr >= 1024
106
+ nr = 1024
107
+ do_rlimit = true
108
+ end
109
+
102
110
  pid = mkserver(cfg) do
103
111
  keep = { $stderr => true, $stdout => true, $stdin => true, @srv => true }
104
112
  ObjectSpace.each_object(IO) do |obj|
@@ -108,7 +116,9 @@ def test_client_expire_desperate
108
116
  rescue IOError # could be uninitialized
109
117
  end
110
118
  end
119
+ Process.setrlimit(:NOFILE, nr) if do_rlimit
111
120
  end
121
+
112
122
  f = get_tcp_client(host, port)
113
123
  f.write "G"
114
124
  s = get_tcp_client(host, port)
@@ -119,10 +129,9 @@ def test_client_expire_desperate
119
129
  assert_match(%r{keep-alive}, str)
120
130
  sleep 1
121
131
 
122
- # ignore errors, just beat the crap out of the process
123
- nr = Process.getrlimit(:NOFILE)[0] # 1024 is common
124
132
  assert_operator nr, :>, 666, "increase RLIM_NOFILE (ulimit -n)"
125
133
  nr -= 50
134
+ # ignore errors, just beat the crap out of the process
126
135
  opts = { out: "/dev/null", err: "/dev/null", close_others: true }
127
136
  begin
128
137
  pids = 2.times.map do
@@ -572,6 +572,16 @@ def check_response_trailer(host, port)
572
572
  end
573
573
 
574
574
  def check_eof_body(host, port)
575
+ Timeout.timeout(30) do
576
+ s = TCPSocket.new(host, port)
577
+ s.write("GET /eof-body-fast HTTP/1.0\r\nConnection:keep-alive\r\n\r\n")
578
+ res = s.read
579
+ assert_match %r{\AHTTP/1\.[01] 200 OK\r\n}, res
580
+ assert_match %r{\r\nConnection: close\r\n}, res
581
+ assert_match %r{\r\n\r\neof-body-fast\z}, res
582
+ s.close
583
+ end
584
+
575
585
  Timeout.timeout(60) do
576
586
  s = TCPSocket.new(host, port)
577
587
  s.write("GET /eof-body-fast HTTP/1.0\r\n\r\n")
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.12.4
4
+ version: 1.12.5
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-05-02 00:00:00.000000000 Z
11
+ date: 2016-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kgio
@@ -236,7 +236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
236
236
  version: '0'
237
237
  requirements: []
238
238
  rubyforge_project:
239
- rubygems_version: 2.6.2
239
+ rubygems_version: 2.6.4
240
240
  signing_key:
241
241
  specification_version: 4
242
242
  summary: sleepy, multi-threaded, non-blocking application server