GET abspath Host: hostname #### #!/usr/local/bin/perl -w use strict; use HTTP::Request; use LWP::UserAgent; my $orig_url = shift @ARGV; my ($host, $tail); if ($orig_url =~ m%^http://([^/]+)(.*)%) { ($host, $tail) = ($1, $2); } else { die ("Invalid URL: $orig_url\n"); } my $http_request = HTTP::Request->new('GET', $tail, [ 'Host', $host ]); $http_request->protocol('HTTP/1.1'); print $http_request->as_string; my $ua = LWP::UserAgent->new (); my $http_response = $ua->request ($http_request); my $http_response_code = $http_response->code; print "HTTP response code: $http_response_code\n"; print $http_response->decoded_content; #### http://www.tristatelogic.com/index.html #### GET /index.html HTTP/1.1 Host: www.tristatelogic.com HTTP response code: 400 400 URL must be absolute