# HG changeset patch # User Olaf Wintermann # Date 1679136277 -3600 # Node ID 39ebd50cfc12b9770011e27dcae4106977b284aa # Parent 477cbeec7b0bbee8ea435077361128d03c81f08c fix nsapi_error_request() could send empty error messages with http status 200, if the request status code wasn't set diff -r 477cbeec7b0b -r 39ebd50cfc12 src/server/daemon/error.c --- 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) {