Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the CGI CPAN distribution.

Report information
The Basics
Id: 54055
Status: rejected
Priority: 0/
Queue: CGI

People
Owner: Nobody in particular
Requestors: JSTENZEL [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)

Attachments
CGI.pm-3.48-patch-to-read-from-an-arbitrary-handle



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.

This issue has been copied to: https://github.com/leejo/CGI.pm/issues/68 please take all future correspondence there. This ticket will remain open but please do not reply here. This ticket will be closed when the github issue is dealt with.
I don't think this patch is necessary. CGI takes a file handle as the first argument to the constructor, and this works for both GET and POST requests. t/arbitrary_handles.t has been added to check this.