hprince has asked for the wisdom of the Perl Monks concerning the following question:
Hello, I'm trying to post a registration form to an HTTPS form through a socks proxy, but I've run into some problems.
I get...
'Bad arg length for Socket6::unpack_sockaddr_in6, length is 16, should be 28 at /System/Library/Perl/Extras/5.16/darwin-thread-multi-2level/Socket6.pm line 282, <STDIN> line 5.'
...when I run this code:use LWP::UserAgent; use LWP::Protocol::socks; use HTTP::Request; my $ua = new LWP::UserAgent(agent => 'Mozilla/5.0 (Windows; U; Windows + NT 5.1; en-US; rv:1.8.0.5) Gecko/20060719 Firefox/1.5.0.5'); $ua->proxy([qw(http https)] => "socks4://xx.xx.xx.xx:1080"); $ua->ssl_opts( verify_hostnames => 0 ); my $user_form_data = ["user"=>"$username", "pass"=>"$password", "passc +heck"=>"$password"]; my $response = $ua->post("https://ssl.xxxxxx.com/post/register",$user_ +form_data); die "Error: ", $response->status_line . "\n" unless $response->content;
I've seen a bit about this error online, but nothing that is clear. This code works fine with GET requests via HTTP (not HTTPS).
Also, I'm not sure if I need an ENV proxy variable entered, but, if I do, there is another problem: I have to change proxies halfway through the script and connect to another server.
Any ideas would be GREATLY appreciated!
Many thanks in advance,
Henry
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: HTTPS POST with LWP via Socks
by noxxi (Pilgrim) on Apr 27, 2014 at 19:02 UTC |