Sat, 18 Mar 2023 11:44:37 +0100
fix nsapi_error_request() could send empty error messages with http status 200, if the request status code wasn't set
src/server/daemon/error.c | file | annotate | diff | comparison | revisions |
--- a/src/server/daemon/error.c Sat Mar 18 11:34:48 2023 +0100 +++ b/src/server/daemon/error.c Sat Mar 18 11:44:37 2023 +0100 @@ -46,7 +46,10 @@ int nsapi_error_request(Session *sn, Request *rq) { short status = rq->status_num; cxmutstr msg; - if(status < 400) { + if(status <= 0) { + status = 500; + msg = error_500; + } else if(status < 400) { msg.ptr = NULL; msg.length = 0; } else { @@ -72,6 +75,7 @@ pblock_kninsert(pb_key_content_length, msg.length, rq->srvhdrs); pblock_nvinsert("content-type", "text/html", rq->srvhdrs); + protocol_status(sn, rq, status, NULL); http_start_response(sn, rq); if(msg.length > 0) {