tests:webclient: add User-Agent header to request.
Michael
This commit is contained in:
parent
8c5391ab6e
commit
df4892d939
@ -23,7 +23,10 @@ use strict;
|
|||||||
use IO::Socket;
|
use IO::Socket;
|
||||||
|
|
||||||
my $EOL = "\015\012";
|
my $EOL = "\015\012";
|
||||||
my $BLANK = $EOL x 2;
|
|
||||||
|
my $VERSION = "0.1";
|
||||||
|
my $NAME = "Tinyproxy-Web-Client";
|
||||||
|
my $user_agent = "$NAME/$VERSION";
|
||||||
|
|
||||||
unless (@ARGV > 1) {
|
unless (@ARGV > 1) {
|
||||||
die "usage: $0 host[:port] document ...";
|
die "usage: $0 host[:port] document ...";
|
||||||
@ -49,9 +52,13 @@ foreach my $document (@ARGV) {
|
|||||||
|
|
||||||
$remote->autoflush(1);
|
$remote->autoflush(1);
|
||||||
|
|
||||||
print $remote "GET $document HTTP/1.0" . $BLANK;
|
print $remote "GET $document HTTP/1.0" . $EOL .
|
||||||
|
"User-Agent: $user_agent$EOL" .
|
||||||
|
$EOL;
|
||||||
|
|
||||||
while (<$remote>) {
|
while (<$remote>) {
|
||||||
print;
|
print;
|
||||||
}
|
}
|
||||||
|
|
||||||
close $remote;
|
close $remote;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user