in reply to Re: user and pass in IO socket
in thread user and pass in IO socket

Thanks for the pointer Kanji, I eventually figured out that my request needed a line like:
Authorization: Basic foobar

For the posterity of future monks, my final code looks like this:


snip
my $userPass = base64("user:password"); # Need two \n in the get request my $get =<<EOF; GET $path HTTP/1.0 Authorization: Basic $userPass EOF # Open the socket my $http_request = IO::Socket::INET->new( Proto => "tcp", PeerAddr => $host, PeerPort => $port, ) or return $!; print $http_request $get; # Write the request my $webPage; { # Grab the output local($/) = undef; $webPage = <$http_request>; } return $webPage;

snip