Revision as of 14:48, 18 October 2019 by Admin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

HTTP copy (HCP) is a small perl script which allows you to upload data through your Apache Server to disk.
The script has been tested on Debian 10 (Buster) but should work on other distros as well.
It was made to establish an alternative to scp without the need of dealing with PAM or Shell issues.
HCP is using the HTTP POST method and there shouldn't be a size limit unless you define one.
HCP comes with the client script ( and the Server (cgi) script.


perl -f <filename> -url <url> -u <username> -p <password> -g (optional gzip data)
perl -f c:\path\to\file\myfile.doc  -url -u myUser -p myPwd -g

Server script index.cgi, you need to specify the upload path within the script:

my $uploadpath='/path/to/upload/';

The server script is able to send syslog messages, if this is an option then the syslog module must be installed
using cpan, build-essential is needed to do this:

apt-get install build-essential
cpan install Net::Syslog

Then specify the ip to your syslog server in index.cgi:

my $SyslogHost='';

Apache sample configuration, it allows http/https using basic auth

<Directory "/var/www/">
 Options ExecCGI
 DirectoryIndex index.cgi
 Order allow,deny
 Allow from all
 #Make sure to enable the Apache cgi and perl module
 AddHandler cgi-script .cgi .pl
 AuthName "HCP Access"
 AuthType Basic
 AuthUserFile /var/www/
 Require valid-user
# =================================================
# SSL/TLS settings
# =================================================
<VirtualHost *:443>
 DocumentRoot /var/www/
 ErrorLog /var/log/apache2/
 CustomLog /var/log/apache2/ common
 SSLStrictSNIVHostCheck off
 SSLCertificateFile /path/.../fullchain.pem
 SSLCertificateKeyFile /path/.../privkey.pem
 SSLHonorCipherOrder On
 SSLProtocol +ALL -SSLv3 -SSLv2

<VirtualHost *:80>
 DocumentRoot /var/www/
 ErrorLog /var/log/apache2/
 CustomLog /var/log/apache2/ common

Download the script