For the test, I need to make a request to the website - unfortunately, when using perl lwp, a “connection” appears in the b4 header of the host. As a result, the request is filtered through the web application firewall. All I need to do is delete or move the connection string in the header. When I make requests using a script:
use warnings; use IO::Socket; use LWP::UserAgent; use LWP::Protocol::http; use HTTP::Request; my $ua = LWP::UserAgent->new(); push(@LWP::Protocol::http::EXTRA_SOCK_OPTS, SendTE => 0, PeerHTTPVersion => "1.1"); $ua->default_header(Cookie => 'XXX', User-Agent => 'whateva'); my $request = $ua->get('https://www.test.com/test.html?...'); ....
The title is as follows:
GET /test.html?... HTTP/1.1 Connection: close Host: www.test.com User-Agent: whateva Cookie: XXXX
BUT this should look like this to work (conenction appears after the host):
GET /test.html?... HTTP/1.1 Host: www.test.com Connection: close User-Agent: whateva Cookie: XXXX
How do I get rid of this connection line in LWP? I just need to repeat it ... Not that it had to be completely removed; I will gladly add it later where
# $userAgent->default_header ("Connection" => "keep-alive");..
thanks a lot in advance!
source share