#! /usr/bin/perl

# need timeout
# return header in list or in hash

# http method[+] url data savefile

require "socket.ph";   # interprocess communication (internet) params
require "http.pl";     # perl functions for HTTP (WWW) access
use Time::Local;

sub comment
{
	local ($meth, $url, $data, $save) = (@_);
	local ($site, $port, $file) = &split_url ($url);
	local (%header);
	print "===========================================================================\n";
	print "HTTP @_\n";
	print "---------------------------------------------------------------------------\n";
	alarm 10;
	$SIG{'ALRM'} = 'handler';
	($status, $site, $port, $file, %header) =
		&http ($meth, $site, $port, $file, $data, $save);
	print "HTTP-status: $status\n";
	print "Content-type: $header{'content-type'}\n";
	print "Last-modified: $header{'last-modified'}\n";
	print "Content-length: $header{'content-length'}\n";
	alarm 0;
}

while ($ARGV[0]) {
	comment ("HEAD", $ARGV[0]);
	shift;
}

# comment ("HEAD", "http://www.cog.ohio-state.edu/homepage/cfaculty/palmer.html");
# comment ("GET", "http://www.acm.org/~perlman/", "data", "/tmp/http.tmp");
# unlink ("/tmp/http.tmp");

# comment ("HEAD", "http://www.digital.com/");

# comment ("HEAD", "http://cosi.org/");
# comment ("HEAD", "http://www.oclc.org/");
# comment ("HEAD", "http://www.acm.org/");
# comment ("HEAD", "http://www.hfes.org/");
# comment ("HEAD", "http://www.npr.org/");
# comment ("HEAD", "http://www.cas.org/");
# comment ("HEAD", "http://www.ibm.com/");
# comment ("HEAD", "http://www.sun.com/");
