httpd.sh: change some comments - randomcrap - random crap programs of varying quality
(HTM) git clone git://git.codemadness.org/randomcrap
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 4d880456778d286c56c65d2a63f911bf7305cb86
(DIR) parent 7e0ebe1832d1da8872703c7d2518a56b9f55fa28
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Fri, 15 Aug 2025 14:53:52 +0200
httpd.sh: change some comments
Diffstat:
M minihttpd/httpd.sh | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
---
(DIR) diff --git a/minihttpd/httpd.sh b/minihttpd/httpd.sh
@@ -1,21 +1,20 @@
#!/bin/sh
# insecure mini httpd intended for local testing.
-# Dependencies: socat, file, UNIX tools, etc.
+# Dependencies: socat, file, awk, UNIX tools, etc.
-# log(msg)
+# log(status)
log() {
- # log
printf '%s\t%s\t%s\t%s\t%s\t%s\n' "$REMOTE_ADDR" "$1" "$REQUEST_METHOD" "HTTP/1.0" "$REQUEST_PATH" "$QUERY_STRING" >&2
}
-# httpheader(msg) {
+# httpheader(status) {
httpheader() {
log "$1"
printf 'HTTP/1.0 %s \r\nDate: %s\r\nConnection: close\r\n'\
"$1" "$(TZ=UTC date +'%a, %d %b %Y %H:%M:%S +0000')"
}
-# httpstatus(msg)
+# httpstatus(status)
httpstatus() {
httpheader "$1"
printf 'Content-Type: text/plain\r\n\r\n%s\n' "$1"
@@ -71,12 +70,12 @@ servescript() {
rm -f "$t"
}
-# percentdecode(str)
+# percentdecode(path)
percentdecode() {
printf '%s' "$1" | sed 's@+@ @g;s@%@\\x@g' | xargs -0 printf '%b'
}
-# sanitizepath(str)
+# sanitizepath(path)
sanitizepath() {
# good enough for this crappy insecure local httpd.
printf '%s' "$1" | sed 's@\.\./@@;s@\./@@g'