glen danzig
glen danzig

Reputation: 43

Trying to use 'proxyheader' in LWP::Protocol::Net::Curl perl module results in a segfault

Trying to send header to proxy only, getting segfault

#!/usr/bin/perl -w

$| = 1;

use LWP::Protocol::Net::Curl ssl_verifyhost => 0, ssl_verifypeer => 0, verbose => 1, proxy_ssl_verifypeer => 0, proxy_ssl_verifyhost => 0, headeropt => 1, proxyheader => ['ab: ba'];

use LWP::UserAgent;

my $ua = LWP::UserAgent->new();
$ua->proxy([ 'https' ] => 'http://45.144.165.248:8080');
$ua->agent('curl');

my $content = $ua->get('https://google.com/');

print $content->decoded_content;
root@cyrillpetroff:~# perl t.pl
*   Trying 45.144.165.248:8080...
* Connected to 45.144.165.248 (45.144.165.248) port 8080 (#0)
* allocate connect buffer
* Establish HTTP proxy tunnel to google.com:443
Segmentation fault (core dumped)

I can't figure out what I'm doing wrong. Or, it's a bug in the module. It is necessary to send a custom proxy header and nothing more.

Thank you in advance.

Upvotes: 1

Views: 71

Answers (1)

Håkon Hægland
Håkon Hægland

Reputation: 40778

$ua->proxy([ 'https' ] => 'http://45.144.165.248:8080');

I don't think you can mix https and http protocols like this, see https://stackoverflow.com/a/56657721/2173773 for more information. If I use the following using a squid proxy server on localhost:

$ua->proxy([ 'https' ] => 'https://localhost:3128');

it works fine, but if I use http instead of https:

$ua->proxy([ 'https' ] => 'http://localhost:3128');

I get the same segfault as you got.

Upvotes: 0

Related Questions