patch for &www'stat
Brooks Cutter (bcutter@pdn.paradyne.com)
Thu, 21 Jul 1994 19:45:50 -0400 (EDT)
With the addition of the &set_def_header routine in libwww-perl v0.20
it is no longer necessary (or desirable) to pass the User Agent
or From headers to &www'stat... In the below patch, I've removed the
references to them in the code and documentation/examples.
Unlike my last message about wwwbot'allowed changes, www'stat doesn't
need these arguments except to inform the remote server... wwwbot'allowed
needs to know the User Agent field for checking against /robots.txt..
start of patch 21-Jul-1994
(suggested archive name: libwww-perl-0.20-stat.Z)
It should be applied by changing directory to the root
of the source tree and using the command:
patch -p0 < this_file
*** www.pl.old Thu Jul 21 04:49:47 1994
--- www.pl Thu Jul 21 19:36:08 1994
***************
*** 239,245 ****
# $content_encoding,
# $content_language,
# $expires,
! # $message_id) = &www'stat($url, $user_agent, $reply_to);
#
# WHERE,
#
--- 239,245 ----
# $content_encoding,
# $content_language,
# $expires,
! # $message_id) = &www'stat($url);
#
# WHERE,
#
***************
*** 262,279 ****
# Values passed to &www'stat():
#
# $url: Fully qualified http: or file: URL
- # $user_agent: String that includes the name of program calling &www'stat()
- # $reply_to: Your fully-qualified internet Email address
#
# ----------------------------------------------------------------------
# Example: retrieve Last modified and size of What's New with NCSA Mosaic
#
# $url = 'http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/Docs/whats-new.html';
! # chop($domain = `hostname`);
! # if (index($domain,'.')==-1) { $domain .= '.' . `domainname`; chop($domain); }
! # $ReplyTo = "$ENV{'USER'}@$domain";
! # $UserAgent = "myprog/0.1 $www'Library";
! # ($rcode,$lastmod,$size) = (&www'stat($url,$UserAgent,$ReplyTo))[0,1,2];
#
# For more information on the returned headers, see the Hypertext Transfer
# Protocol specification, section "The Response/Response Headers" at the URL
--- 262,273 ----
# Values passed to &www'stat():
#
# $url: Fully qualified http: or file: URL
#
# ----------------------------------------------------------------------
# Example: retrieve Last modified and size of What's New with NCSA Mosaic
#
# $url = 'http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/Docs/whats-new.html';
! # ($rcode,$lastmod,$size) = (&www'stat($url))[0,1,2];
#
# For more information on the returned headers, see the Hypertext Transfer
# Protocol specification, section "The Response/Response Headers" at the URL
***************
*** 281,293 ****
#
sub stat
{
! local($url, $user_agent, $reply_to) = @_;
local(%headers, $content, $response, $last_modified);
-
- # Define the HTTP request headers
-
- if ($user_agent) { $headers{'User-Agent'} = $user_agent; }
- if ($reply_to) { $headers{'From'} = $reply_to; }
$response = &request('HEAD', $url, *headers, *content, 30);
--- 275,282 ----
#
sub stat
{
! local($url) = @_;
local(%headers, $content, $response, $last_modified);
$response = &request('HEAD', $url, *headers, *content, 30);