-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
10 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# v0.03: lewismc: 2021/01/21 ensure bash-httpd will run as of 2021...! | ||
# bash-httpd, by Morty Abzug <[email protected]> | ||
# v0.02: morty: 1998/11/22: does simple file queries | ||
# v0.01: morty: 1998/11/??: proof of concept |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,10 @@ | ||
#!/bin/bash | ||
|
||
# bash-httpd, by Morty Abzug <[email protected]> | ||
# v0.02: morty: 1998/11/22: does simple file queries | ||
# v0.01: morty: 1998/11/??: proof of concept | ||
|
||
# Configurable variables | ||
PATH=/bin:/usr/bin | ||
DOC_ROOT=~morty/www/server | ||
PATH=/bin:/usr/bin:/usr/local/bin | ||
DOC_ROOT=~/Downloads/bash-httpd/www/ | ||
DEF_HTML=index.html | ||
DEF_DIR=www | ||
LOG_FACILITY=local1 | ||
|
||
# End of configurables | ||
HTTP_VERSION="HTTP/1.0" | ||
SERVER="bash-httpd/0.02" | ||
|
@@ -40,9 +34,7 @@ error(){ | |
if [ "$2" ]; then problem="$2"; else problem="$err"; fi | ||
cat <<EOF | ||
Content-Type: text/html | ||
<html> <head> <title> $problem </title> | ||
<body> <h1> $num $problem </h1> $problem </body> </html> | ||
<!DOCTYPE html><html><head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><title> $problem </title></head><body><h1> $num $problem </h1> $problem </body></html> | ||
EOF | ||
log err "$problem" | ||
exit 1 | ||
|
@@ -53,8 +45,6 @@ log(){ | |
logger -p $LOG_FACILITY."$level" "$program[$$]: $method $url $version: $message" | ||
} | ||
|
||
|
||
|
||
read method url version | ||
|
||
method="${method%$CR}"; | ||
|
@@ -123,5 +113,4 @@ case $type in | |
*) | ||
error 501 "Messed up internal type" | ||
;; | ||
esac | ||
|
||
esac |