Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Dec 1995 22:52:55 +0100
From:      "Julian Stacey jhs@freebsd.org" <jhs@vector.enet>
To:        hackers@freebsd.org
Cc:        khe@muc.ditec.de
Subject:   WebCopy.pl http://www.inf.utfsm.cl/~vparada/webcopy.html
Message-ID:  <199512052152.WAA02755@vector.enet>

next in thread | raw e-mail | index | archive | help
--------
Hi hackers@freebsd.org, 
Has anyone tried
	http://www.inf.utfsm.cl/~vparada/webcopy.html
Its a useful tree copying Web tool written in perl,
Trouble is I can only get it to work on files served by my local httpd,
& of course I want to grab someone else's tree, not my own stuff :-)
(I keep getting 	connect: Operation timed out
on both my host with Perl 5, on a FreeBSD stable host with Perl 4 )

For anyone tempted to have a play, I'd appreciate hearing if you get it to 
work on FreeBSD current, PS I was given these patches by a friend (khe)
& have copied them to webcopy author,  but I'm not conversant in Perl,
so caveat emptor :-)

PS KHE has got this stuff to run, on some host I dont have access to,
(but he's at home, & I'm in a hurry :-)
-------
*** webcopy.distrib	Sat Jul  1 18:20:35 1995
--- webcopy.khe.tick	Tue Dec  5 10:35:32 1995
***************
*** 45,51 ****
  
  # Library routines required
  #
! require 'sys/socket.ph';
  require 'timelocal.pl';
  
  # Global setup
--- 45,53 ----
  
  # Library routines required
  #
! # Old style! Require Socket.pm instead! (KHE)
! #require 'sys/socket.ph';
! use Socket;
  require 'timelocal.pl';
  
  # Global setup
***************
*** 363,370 ****
      $sockaddr='S n a4 x8';
      chop($local_host=`hostname`);
      $local_prot=(getprotobyname('tcp'))[2];
!     $local_sock=pack($sockaddr,&AF_INET,0,(gethostbyname($local_host))[4]);
!     $remote_sock=pack($sockaddr,&AF_INET,$port,(gethostbyname($host))[4]);
  }
  
  sub transfer {
--- 365,375 ----
      $sockaddr='S n a4 x8';
      chop($local_host=`hostname`);
      $local_prot=(getprotobyname('tcp'))[2];
! #  (KHE)
! #    $local_sock=pack($sockaddr,&AF_INET,0,(gethostbyname($local_host))[4]);
! #    $remote_sock=pack($sockaddr,&AF_INET,$port,(gethostbyname($host))[4]);
!     $local_sock=pack($sockaddr,AF_INET,0,(gethostbyname($local_host))[4]);
!     $remote_sock=pack($sockaddr,AF_INET,$port,(gethostbyname($host))[4]);
  }
  
  sub transfer {
***************
*** 374,380 ****
      $update=(($_=&get_date($file)) &&
  	     ("If-Modified-Since: $_$rn")) unless $post;
      $uselocal && $update && return(304,"Use local",0);
!     socket(S,&PF_INET,&SOCK_STREAM,$local_prot) || die "$0: socket: $!\n";
      bind(S,$local_sock) || die "$0: bind: $!\n";
      connect(S,$remote_sock) || die "$0: connect: $!\n";
      $_=select(S); $|=1; select($_);
--- 379,387 ----
      $update=(($_=&get_date($file)) &&
  	     ("If-Modified-Since: $_$rn")) unless $post;
      $uselocal && $update && return(304,"Use local",0);
! # (KHE)
! #    socket(S,&PF_INET,&SOCK_STREAM,$local_prot) || die "$0: socket: $!\n";
!     socket(S,PF_INET,SOCK_STREAM,$local_prot) || die "$0: socket: $!\n";
      bind(S,$local_sock) || die "$0: bind: $!\n";
      connect(S,$remote_sock) || die "$0: connect: $!\n";
      $_=select(S); $|=1; select($_);
-------
Julian H. Stacey	jhs@freebsd.org  	http://www.freebsd.org/~jhs/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199512052152.WAA02755>