From 6221fa4734eb95d3fd98421db4354d44f8cace8f Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 4 Oct 2016 13:12:40 -0400 Subject: add message bodies to error responses --- httpconnectd.sh.in | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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() { -- cgit v1.1-4-g5e80