Skip Menu |

This queue is for tickets about the Captcha-reCAPTCHA CPAN distribution.

Report information
The Basics
Id: 61509
Status: resolved
Priority: 0/
Queue: Captcha-reCAPTCHA

People
Owner: Nobody in particular
Requestors: vik [...] catalyst.net.nz
Cc:
AdminCc:

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



Subject: Using Captcha::reCAPTCHA via a proxy
Date: Tue, 21 Sep 2010 16:10:27 +1200
To: bug-captcha-recaptcha [...] rt.cpan.org
From: Vik Olliver <vik [...] catalyst.net.nz>
Is there any way to get the verifying server to issue $c->check_answer() via a proxy? Our nice sysadmins have firewalled outgoing port 80 on the production web server cluster. I tried setting http_proxy envar with no success. Vik :v)
On Tue Sep 21 00:10:45 2010, vik@catalyst.net.nz wrote: Show quoted text
> Is there any way to get the verifying server to issue $c->check_answer() > via a proxy?
I also needed the outgoing requests to use a proxy. The attached patch implements that with a 1-line code change plus some additional POD. Regards Grant
Subject: proxy.patch
--- lib/Captcha/reCAPTCHA.pm 2011-12-20 16:53:35.000000000 +1300 +++ lib/Captcha/reCAPTCHA.pm 2011-12-20 17:13:07.000000000 +1300 @@ -117,6 +117,7 @@ my ( $url, $args ) = @_; my $ua = LWP::UserAgent->new(); + $ua->env_proxy(); return $ua->post( $url, $args ); } @@ -330,6 +331,12 @@ See the /examples subdirectory for examples of how to call C<check_answer>. +Note: this method will make an HTTP request to Google to verify the user input. +If this request must be routed via a proxy in your environment, use the +standard environment variable to specify the proxy address, e.g.: + + $ENV{http_proxy} = 'http://myproxy:3128'; + =back =head1 CONFIGURATION AND ENVIRONMENT
Applied thanks :)