yahns 1.12.2 → 1.12.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Documentation/yahns_config.pod +4 -1
- data/GIT-VERSION-GEN +1 -1
- data/lib/yahns/proxy_http_response.rb +18 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be964a6d1a0a80744bd419b896f4aa83cdadbd06
|
4
|
+
data.tar.gz: 907c5f15f7d6c2d49609326b1a8175d56a09cad7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7bb344b77483d6fbb091b721fcc7b7d6f789738aa8552f7c7b85e856ca15b2edd2dd12b299b5af80a5d1484bded048c31599c5c187433bbf37987910a6effd47
|
7
|
+
data.tar.gz: 0d1226f4bddf82eb366f71d020cafaedf0b7a0b63eed07792588d902f14aaf26cebee084d8e07379455bf91c1653823887ad35234d20abb09c6581aaab7818b1
|
@@ -446,7 +446,10 @@ An example which seems to work is:
|
|
446
446
|
ssl_ctx.key = OpenSSL::PKey::RSA.new(
|
447
447
|
IO.read('/etc/ssl/private/example.key')
|
448
448
|
)
|
449
|
-
|
449
|
+
|
450
|
+
# use defaults provided by Ruby on top of OpenSSL,
|
451
|
+
# but disable client certificate verification as it is rare:
|
452
|
+
ssl_ctx.set_params(verify_mode: OpenSSL::SSL::VERIFY_NONE)
|
450
453
|
|
451
454
|
app(:rack, "/path/to/my/app/config.ru") do
|
452
455
|
listen 443, ssl_ctx: ssl_ctx
|
data/GIT-VERSION-GEN
CHANGED
@@ -68,6 +68,7 @@ def proxy_response_start(res, tip, kcar, req_res)
|
|
68
68
|
env['REQUEST_METHOD'] != 'HEAD'.freeze
|
69
69
|
flags = MSG_DONTWAIT
|
70
70
|
alive = @hs.next? && self.class.persistent_connections
|
71
|
+
term = false
|
71
72
|
response_headers = env['yahns.proxy_pass.response_headers']
|
72
73
|
|
73
74
|
res = "HTTP/1.1 #{msg ? %Q(#{code} #{msg}) : status}\r\n".dup
|
@@ -76,7 +77,10 @@ def proxy_response_start(res, tip, kcar, req_res)
|
|
76
77
|
when /\A(?:Connection|Keep-Alive)\z/i
|
77
78
|
next # do not let some upstream headers leak through
|
78
79
|
when %r{\AContent-Length\z}i
|
80
|
+
term = true
|
79
81
|
flags |= MSG_MORE if have_body && value.to_i > 0
|
82
|
+
when %r{\ATransfer-Encoding\z}i
|
83
|
+
term = true if value =~ /\bchunked\b/i
|
80
84
|
end
|
81
85
|
|
82
86
|
# response header mapping
|
@@ -92,6 +96,13 @@ def proxy_response_start(res, tip, kcar, req_res)
|
|
92
96
|
|
93
97
|
# For now, do not add a Date: header, assume upstream already did it
|
94
98
|
# but do not care if they did not
|
99
|
+
|
100
|
+
# chunk the response ourselves if the client supports it,
|
101
|
+
# but the backend does not terminate properly
|
102
|
+
if alive && ! term && (env['HTTP_VERSION'] == 'HTTP/1.1'.freeze)
|
103
|
+
res << "Transfer-Encoding: chunked\r\n".freeze
|
104
|
+
alive = true
|
105
|
+
end
|
95
106
|
res << (alive ? "Connection: keep-alive\r\n\r\n".freeze
|
96
107
|
: "Connection: close\r\n\r\n".freeze)
|
97
108
|
|
@@ -154,6 +165,7 @@ def proxy_response_start(res, tip, kcar, req_res)
|
|
154
165
|
|
155
166
|
case tmp = tip.shift || req_res.kgio_tryread(0x2000, rbuf)
|
156
167
|
when String
|
168
|
+
tmp = chunk_out(tmp) if alive
|
157
169
|
wbuf = proxy_write(wbuf, tmp, alive)
|
158
170
|
when nil
|
159
171
|
req_res.shutdown
|
@@ -174,7 +186,8 @@ def proxy_response_start(res, tip, kcar, req_res)
|
|
174
186
|
|
175
187
|
def proxy_response_finish(kcar, wbuf, req_res)
|
176
188
|
rbuf = Thread.current[:yahns_rbuf]
|
177
|
-
|
189
|
+
alive = wbuf.wbuf_persist
|
190
|
+
if len = kcar.body_bytes_left # known Content-Length
|
178
191
|
|
179
192
|
case tmp = req_res.kgio_tryread(0x2000, rbuf)
|
180
193
|
when String
|
@@ -186,7 +199,7 @@ def proxy_response_finish(kcar, wbuf, req_res)
|
|
186
199
|
return :wait_readable # self remains in :ignore, wait on upstream
|
187
200
|
end while len != 0
|
188
201
|
|
189
|
-
elsif kcar.chunked? # nasty chunked body
|
202
|
+
elsif kcar.chunked? # nasty chunked response body
|
190
203
|
buf = ''.dup
|
191
204
|
|
192
205
|
unless req_res.proxy_trailers
|
@@ -221,8 +234,10 @@ def proxy_response_finish(kcar, wbuf, req_res)
|
|
221
234
|
|
222
235
|
case tmp = req_res.kgio_tryread(0x2000, rbuf)
|
223
236
|
when String
|
237
|
+
tmp = chunk_out(tmp) if alive
|
224
238
|
wbuf.wbuf_write(self, tmp)
|
225
239
|
when nil
|
240
|
+
wbuf.wbuf_write(self, "0\r\n\r\n".freeze) if alive
|
226
241
|
req_res.shutdown
|
227
242
|
break
|
228
243
|
when :wait_readable
|
@@ -232,7 +247,7 @@ def proxy_response_finish(kcar, wbuf, req_res)
|
|
232
247
|
end
|
233
248
|
|
234
249
|
busy = wbuf.busy and return proxy_busy_mod_blocked(wbuf, busy)
|
235
|
-
proxy_busy_mod_done(
|
250
|
+
proxy_busy_mod_done(alive) # returns nil
|
236
251
|
end
|
237
252
|
|
238
253
|
def proxy_wait_next(qflags)
|
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
|
+
version: 1.12.3
|
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-04-08 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.
|
239
|
+
rubygems_version: 2.6.2
|
240
240
|
signing_key:
|
241
241
|
specification_version: 4
|
242
242
|
summary: sleepy, multi-threaded, non-blocking application server
|