Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch suggestion: enable reading from an arbitrary handle [rt.cpan.org #54055] #43

Closed
leejo opened this issue May 22, 2014 · 0 comments
Closed

Comments

@leejo
Copy link
Owner

leejo commented May 22, 2014

https://rt.cpan.org/Ticket/Display.html?id=54055

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
@leejo leejo closed this as completed May 22, 2014
@leejo leejo added the Deleted label May 22, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant