develooper Front page | perl.beginners | Postings from October 2011

LWP::UserAgent 501 Not Implemented only for https?? [firefox works fine]

Thread Next
From:
Rajeev Prasad
Date:
October 19, 2011 10:43
Subject:
LWP::UserAgent 501 Not Implemented only for https?? [firefox works fine]
Message ID:
1319046208.70777.YahooMailNeo@web114220.mail.gq1.yahoo.com
here is my script which is trying to access two websites, from my linux box. i am not able to figure, why am i getting "501 Not Implemented" for any https website.


especially when the firefox browser from the same box can access the websites fine using same proxy. proxy does not require username/password authentication.


I do have Crypt::SSLeay installed.



#!/usr/bin/perl
use strict;
use warnings;
use LWP::UserAgent;

my $ua = LWP::UserAgent->new;
$ua->proxy(['https', 'http', 'ftp'], 'http://myproxy.net:8080/');
$ua->agent('Mozilla/5.0');


my $response = $ua->get( 'http://www.yahoo.com' , ':content_file' => "testhttp.html" );
 if ($response->is_success) {
     print "success\n";
 }
 else {
    print "error\n";
    # die $response->status_line;
 }

$response = $ua->get('https://mail.yahoo.com', ':content_file' => 'testhttps.html');
 if ($response->is_success) {
     print "success\n";   #$response->decoded_content;  # or whatever
 }
 else {
    print "error\n";
     die $response->status_line;
 }

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About