Skip to content

svenwiltink/httpawk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

A webserver implemented in AWK.

Start it with awk -f http.awk. Edit the port and http dir by changing the values at line 2 and 4.

Why?

Why not?

How?

The GNU implementation of awk (gawk) has builtin tcp and udp networking support. Opening a socket or listening on one is fairly trivial. HttpService |& getline line creates a bidirectional pipe that can be read from or written to. The pipe is a tcp connection because of the way the path is constructed. Since the HTTP protocol is old it is easy to handroll. Simply check if something is a GET request and serve the file that is asked for. realpath is used to prevent directory escaping.

networking in awk: https://www.gnu.org/software/gawk/manual/html_node/TCP_002fIP-Networking.html

More?

About

A http fileserver written in AWK

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages