Subject: | Patch suggestion: enable reading from an arbitrary handle |
Summary
This ticket suggests a patch to read input not only from STDIN but from
an arbitrary handle.
Description:
CGI.pm is used to read input from STDIN. This works perfectly
when the script is running under web server control. For proxy
solutions, the situation is different as input and output of the final
CGI script are received (and written) via a socket.
client <===> web server
<===> STDIN/STDOUT | cgi-bin/proxy-script
<===> socket | script using CGI.pm
For this to work for GET *and* POST requests it is required to pass the
socket as a parameter to CGI.pm. So, I'd like to suggest a patch that
adds this feature.
The constructor allows to pass a handle parameter already, but (as I
understand) this is meant for initialization in order to restore
sessions, or to read CGI parameters provided in Boulderio format, not to
process client data. So, I added another (optional) constructor
parameter. To allow further extensions it is a reference to a hash
containing "configuration settings", and is used like so:
my $cgi = new CGI(undef, {client_handle => $handle});
The client_handle setting takes a handle to read input from. If this
setting is omitted the module should fall back to STDIN as usual.
This way, there should be no need to touch existing scripts - existing
features should be preserved and initialization via the first parameter
should continue to work.
Please see the attached patch against CGI.pm 3.48 that adds this
functionality.
The patched module passes all tests of the original distribution 3.48
and works successfully in a real project (using perl v5.10.0 built for
i686-pc-linux-gnu-64int, on Linux 2.6.30.9-64).
Would it be possible to add this feature to the distribution?
Thank you in advance
Jochen
Subject: | CGI.pm-3.48-patch-to-read-from-an-arbitrary-handle |
Message body not shown because it is not plain text.