Good idea! I used Ethereal, and here is the result. Win32::Internet sent the following request: GET /tile.ashx?T=1&S=13&X=321&Y=3329&Z=10 HTTP/1.1\r\n
Accept: , , , , , , M\360\017\204-\002\r\n
User_Agent: Perl-Win32::Internet/0.081\r\n
Host: terraserver-usa.com\r\n
\r\n
And Opera sent this:GET /tile.ashx?T=1&S=13&X=321&Y=3329&Z=10 HTTP/1.1\r\n
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows 98) Opera 7.23
+[en]\r\n
Host: terraserver-usa.com\r\n
Accept: text/html, application/xml;q=0.9, application/xhtml+xml;q=0.9,
+ image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1\r\n
Accept-Language: en\r\n
Accept-Charset: windows-1252, utf-8, utf-16, iso-8859-1;q=0.6, *;q=0.1
+\r\n
Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0\r\n
Cache-Control: no-cache\r\n
Connection: Keep-Alive, TE\r\n
TE: deflate, gzip, chunked, identity, trailers\r\n
\r\n
This is an obvious answer to my first question. I guess I need to expand that question to, "What part of this makes the difference?" And, again, my second question, "How do I make Win32::Internet do that?
Update: And to answer that I tried specifying the MIME types I would accept, as follows: sub Get {
my ($url, $req) = @_;
my ($http, $request);
my $result = $Internet->HTTP($http, $url, 'anonymous', 'none', );
if ($result) {
my ($status, $header, $content) = $http->Request("/$req", 'GET
+', 'HTTP/1.1', 'none', "image/gif\0image/jpeg");
$http->Close;
return ($header, $content)
} else {
return undef
}
}
And that, apparently, was all the server needed. The script now works as well as it did before. Thanks to NetWallah for pointing me to Ethereal!
|