Skip to content

Latest commit

 

History

History
46 lines (33 loc) · 770 Bytes

README.md

File metadata and controls

46 lines (33 loc) · 770 Bytes

shellscripthttpd

HTTPD written entirely in shell (works with Busybox)

Start with ACME micro_inetd or any other inetd.

##Features:

  • works with inetd
  • supports HTTP/1.0
  • supports GET, POST and HEAD methods
  • follows POST/Redirect/GET pattern
  • single file
  • exports request headers according to CGI standard: HTTP_

built-in functions

  • add_route
  • require_POST
  • redirect
  • read_post_var
  • _e

create own actions

Add following:

add_route '^/hello/$' hello

action_hello(){
    X=`wc -l < /etc/passwd`
}

view_hello(){
    echo "<html>"
    echo "<p>lines in passwd: $X</p>"
    cat file.txt | _e
    echo "</html>"
}

start the HTTPD

$ micro-inetd 8080 /path/to/httpd.sh