Reputation: 4184
I am trying to send a simple HTTP GET request to a server at http://server/?id=
containing a cookie. I already found this question which should answer my question. But the following code errs with
Can't connect to server:443 (certificate verify failed)
Which is odd as I never requested to use https.
#!/usr/bin/perl
require HTTP::Request;
require HTTP::Cookies;
require HTTP::Message;
require HTTP::Response;
require HTTP::Headers;
require LWP::UserAgent;
$ua = LWP::UserAgent->new();
$cookies = HTTP::Cookies->new();
$cookies->set_cookie(0,'sid','/','server');
$ua->cookie_jar( $cookies );
$response = $ua->get( 'http://server/?id=user' );
print $response->content();
Upvotes: 1
Views: 198
Reputation: 19395
Presumably, the server is redirecting HTTP requests to HTTPS. The request() method will process redirects and authentication responses transparently. – Quentin
Upvotes: 1