httpfile

Installation

wget https://mojzis.com/software/httpfile/httpfile-20151206.tar.bz2
bunzip2 < httpfile-20151206.tar.bz2 | tar -xf -
cd httpfile-20151206
dpkg-buildpackage
dpkg -i ../httpfile_20151206_*.deb

Setup webserver - create root in /etc/httpfile

# httpfile-conf httpfile httpfilelog /etc/httpfile webserverexample.com
# cd /etc/httpfile
# ls -1
env
file
httpcurved
httpd

Start webserver using daemontools and check the log

# ln -s /etc/httpfile/httpd /service/
# svstat /service/httpd
/service/httpd: up (pid 8987) 1 seconds
# tail -f /etc/httpfile/httpd/log/main/current

Create content

# mkdir /etc/httpfile/tmp
# cd /etc/httpfile/tmp
# vi index.html
# mv index.html /etc/httpfile/file/plain/webserverexample.com

Create gzipped content

# httpfile-gzip /etc/httpfile/file

Test it using telnet - normal content

# telnet 127.0.0.1 80
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
HEAD / HTTP/1.0
Host: webserverexample.com
HTTP/1.0 200 OK
Server: httpfile
Date: Tue, 03 Dec 2013 06:30:37 GMT
Accept-Ranges: bytes
Content-Type: text/html
Content-Length: 129  

Test it using telnet - gzipped content

# telnet 127.0.0.1 80
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
HEAD / HTTP/1.0
Host: webserverexample.com
Accept-Encoding: gzip
HTTP/1.0 200 OK
Server: httpfile
Date: Tue, 03 Dec 2013 06:31:57 GMT
Accept-Ranges: bytes
Last-Modified: Tue, 03 Dec 2013 06:29:42 GMT
Content-Type: text/html
Content-Encoding: gzip
Content-Length: 122

Basic authentification

cd /etc/httpfile/
echo 'webserverexample.com:/:secretuser:secretpassword' &gt; accesslist.txt
httpfile-access access.cdb access.tmp &lt; accesslist.txt 
echo '/etc/httpfile/access.cdb' &gt; env/ACCESSFILE
svc -t /service/httpd

Test it using telnet - without Authorization header

# telnet 127.0.0.1 80
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
HEAD / HTTP/1.0
Host: webserverexample.com
HTTP/1.0 401 unauthorized
Server: httpfile
Date: Tue, 03 Dec 2013 06:44:42 GMT
Accept-Ranges: bytes
WWW-Authenticate: Basic realm="authorization required"
Content-Length: 40
Content-Type: text/html

Test it using telnet - with Authorization header

# telnet 127.0.0.1 80
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
HEAD / HTTP/1.0
Host: webserverexample.com
Authorization: Basic c2VjcmV0dXNlcjpzZWNyZXRwYXNzd29yZA==
HTTP/1.0 200 OK
Server: httpfile
Date: Tue, 03 Dec 2013 06:50:07 GMT
Accept-Ranges: bytes
Last-Modified: Tue, 03 Dec 2013 06:29:42 GMT
Content-Type: text/html
Content-Length: 129