This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 19974 - The link checker will use a proxy and it will handle https but it does not do both
Summary: The link checker will use a proxy and it will handle https but it does not do...
Status: RESOLVED INVALID
Alias: None
Product: LinkChecker
Classification: Unclassified
Component: checklink (show other bugs)
Version: unspecified
Hardware: PC All
: P2 major
Target Milestone: ---
Assignee: Ville Skyttä
QA Contact: qa-dev tracking
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-15 23:13 UTC by Mark Pohl
Modified: 2012-11-17 07:46 UTC (History)
1 user (show)

See Also:


Attachments

Description Mark Pohl 2012-11-15 23:13:20 UTC
The link checker will use a proxy just fine with http but if you use a proxy with https it will not send the https through the proxy.  It will time out.  There is a simple fix for this.  There is a simple fix.  Here is the code to replace the current "new" constructor.  The comment and new code start at line 29 in the method

sub new
{
    my $proto = shift;
    my $class = ref($proto) || $proto;
    my ($name, $from, $rules) = @_;

    # For security/privacy reasons, if $from was not given, do not send it.
    # Cheat by defining something for the constructor, and resetting it later.
    my $from_ok = $from;
    $from ||= 'www-validator@w3.org';

    my $self;
    if (USE_ROBOT_UA) {
        $self = $class->SUPER::new($name, $from, $rules);
    }
    else {
        my %cnf;
        @cnf{qw(agent from)} = ($name, $from);
        $self = LWP::UserAgent->new(%cnf);
        $self = bless $self, $class;
    }

    $self->from(undef) unless $from_ok;

    $self->env_proxy();
    
     #Added this to set the proxy for https as well as http
    #This is not included with the standard distribution.
    #The standard distribution will work with a proxy and will work with https but it 
    #does not work with both a proxy and https at the same time.
    $self->{proxy} = { https => $ua->{proxy}->{http},
                       http => $ua->{proxy}->{http}
                  };
    

    $self->allow_private_ips(1);

    $self->protocols_forbidden([qw(mailto javascript)]);

    return $self;
}
Comment 1 Ville Skyttä 2012-11-17 07:46:41 UTC
If you want to send https through a proxy, set the https_proxy environment variable.