NAME
http_this - export the current directory over HTTP
SYNOPSIS
## Export the current directory with HTTP
$ http_this
## Export the dir_name directory with HTTP
$ http_this dir_name
## Bind the server to a specific port
$ http_this --port 9001
## Bind the server to a specific host/IP address
$ http_this --host 0.0.0.0
## Announces the HTTP server via Bonjour with the specified name
$ http_this --name "My cool webserver"
## Start the server using index.html for directory requests
$ http_this --autoindex
## Start the server using prettier CSS for index pages
$ http_this --pretty
## Load config from a file
$ http_this --config /path/to/configrc
## Show documentation about our options
$ http_this --help
## Show the entire man page
$ http_this --man
DESCRIPTION
The http_this command exports the current directory via HTTP. You can also export any directory by providing the path as a parameter.
A simple web server is started and is kept running until you kill it with Ctrl-C.
All the files and directories will be availble to a browser under the URL the script outputs.
ARGUMENTS
The script accepts a single optional argument: the path of the directory to export.
OPTIONS
The following options are available:
- --port PORT
-
Start the HTTP server on a specific
PORT. - --host HOST
-
Bind the server to a specific
HOSTor IP address. By default the server binds to all network interfaces, which means other machines on your network can reach it. To make the server available only on this computer, use--host 127.0.0.1(or--host ::1for IPv6). - --name NAME
-
Announces the server over Bonjour.
This feature requires the Net::Rendezvous::Publish module and the appropriate backend for your operating system, both available from MetaCPAN. If one of them cannot be found, a warning message will be displayed.
- --autoindex
-
By default, if the server gets a request that ends in / then it displays a listing of that directory. With the
--autoindexflag, it will serve theindex.htmlfile from that directory (if it exists). - --pretty
-
Creates default index listings using a prettier cascading stylesheet.
- --config FILE
-
Read configuration options from
FILE. See "CONFIGURATION FILE" below. - --help
-
Print information about the script usage and its options.
- --man
-
Print the entire man page for the command.
CONFIGURATION FILE
The script can read configuration options from a file. By default, it looks for a file named .http_thisrc in the current directory or your home directory. You can specify a different file with the --config option or by setting the HTTP_THIS_CONFIG environment variable.
The config file consists of lines in the format key=value. The valid keys are:
- port:
-
The port to use for the HTTP server.
- name:
-
The name to use when announcing the server over Bonjour.
- autoindex:
-
If set to a true value, the server will serve the
index.htmlfile from a directory when it gets a request that ends in / (instead of displaying a listing of that directory). - pretty:
-
If set to a true value, the server will use a prettier cascading stylesheet for directory listings.