diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-10-04 13:12:40 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-10-04 13:12:40 -0400 |
commit | 6221fa4734eb95d3fd98421db4354d44f8cace8f (patch) | |
tree | 309395ad27ffcbb3b0849bb467073d93bbacaa0f | |
parent | 860e60d30810a7c30de67cd5acc1e17aa27f4f17 (diff) |
add message bodies to error responses
-rw-r--r-- | httpconnectd.sh.in | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/httpconnectd.sh.in b/httpconnectd.sh.in index 36303bb..bcbdb1d 100644 --- a/httpconnectd.sh.in +++ b/httpconnectd.sh.in @@ -19,38 +19,50 @@ OK() { } Forbidden() { + body='403 Forbidden' printf '%s\r\n' \ 'HTTP/1.1 403 Forbidden' \ "Server: $server" \ "Date: $(date -R)" \ 'Allow: CONNECT' \ + "Content-Length: ${#body}" \ '' + printf '%s' "$body" } MethodNotAllowed() { + body='405 Method Not Allowed' printf '%s\r\n' \ 'HTTP/1.1 405 Method Not Allowed' \ "Server: $server" \ "Date: $(date -R)" \ 'Allow: CONNECT' \ + "Content-Length: ${#body}" \ '' + printf '%s' "$body" } ProxyAuthenticationRequired() { + body='407 Proxy Authentication Required' printf '%s\r\n' \ 'HTTP/1.1 407 Proxy Authentication Required' \ "Server: $server" \ "Date: $(date -R)" \ "Proxy-Authenticate: $(echo $(declare -F|sed -n 's/^declare -f authenticate_//p')|sed 's/ /, /g')" \ + "Content-Length: ${#body}" \ '' + printf '%s' "$body" } InternalServerError() { + body='500 Internal Server Error' printf '%s\r\n' \ 'HTTP/1.1 500 Internal Server Error' \ "Server: $server" \ "Date: $(date -R)" \ + "Content-Length: ${#body}" \ '' + printf '%s' "$body" } checkdest() { |