* [PATCH 1/2] extras/exec_cgi: fix for newer Rack::ContentLength
2022-12-25 12:23 6% [PATCH 0/2] exec_cgi: fix compat with newer Rack 2 Eric Wong
@ 2022-12-25 12:23 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2022-12-25 12:23 UTC (permalink / raw)
To: yahns-public
Rack::ContentLength now unconditionally captures bodies and
doesn't dup the data yield by body#each. Thus we can't reuse
buffers anymore.
---
| 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
--git a/extras/exec_cgi.rb b/extras/exec_cgi.rb
index 8a1939d..a04087d 100644
--- a/extras/exec_cgi.rb
+++ b/extras/exec_cgi.rb
@@ -34,14 +34,15 @@ def initialize(rd)
def each
buf = @body_tip
yield buf unless buf.empty?
+ buf = @body_tip = nil
- case tmp = @rd.read_nonblock(8192, buf, exception: false)
+ case tmp = @rd.read_nonblock(8192, exception: false)
when :wait_readable
@rd.wait_readable
when nil
break
else # String
- yield tmp
+ yield tmp.freeze
end while true
self
ensure
@@ -117,7 +118,7 @@ def call(env)
tmp.clear
end
head, body = head.split(/\r?\n\r?\n/, 2)
- io.body_tip = body
+ io.body_tip = body.freeze
env["HTTP_VERSION"] ||= "HTTP/1.0" # stop Rack::Chunked for HTTP/0.9
^ permalink raw reply related [relevance 7%]
* [PATCH 0/2] exec_cgi: fix compat with newer Rack 2
@ 2022-12-25 12:23 6% Eric Wong
2022-12-25 12:23 7% ` [PATCH 1/2] extras/exec_cgi: fix for newer Rack::ContentLength Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2022-12-25 12:23 UTC (permalink / raw)
To: yahns-public
Rack::ContentLength was causing problems with ExecCGI in the
extras/ problem. Rack 3 is another can of worms I'll still
have to deal with :<
Eric Wong (2):
extras/exec_cgi: fix for newer Rack::ContentLength
test/test_extras_exec_cgi: drop Rack::ContentLength
extras/exec_cgi.rb | 7 ++++---
test/test_extras_exec_cgi.rb | 3 ++-
2 files changed, 6 insertions(+), 4 deletions(-)
^ permalink raw reply [relevance 6%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2022-12-25 12:23 6% [PATCH 0/2] exec_cgi: fix compat with newer Rack 2 Eric Wong
2022-12-25 12:23 7% ` [PATCH 1/2] extras/exec_cgi: fix for newer Rack::ContentLength Eric Wong
Code repositories for project(s) associated with this public inbox
https://yhbt.net/yahns.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).