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


In reply to HTTPS POST with LWP via Socks by hprince

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.