# HG changeset patch # User Olaf Wintermann # Date 1652534557 -7200 # Node ID 79ddd772e8073414f62bb50501a8d025a686f1c5 # Parent 79b28ae7bfbd91e1a71d59a59d8d6f8a59568097 check if service SAFs sent a response, terminate connection in case no response was sent diff -r 79b28ae7bfbd -r 79ddd772e807 src/server/daemon/httprequest.c --- a/src/server/daemon/httprequest.c Sat May 14 15:21:59 2022 +0200 +++ b/src/server/daemon/httprequest.c Sat May 14 15:22:37 2022 +0200 @@ -579,6 +579,14 @@ // TODO: reuse buffer in next request rq->rq.rq_attr.keep_alive = 0; // workaround } + if(!rq->rq.senthdrs) { + // why was no response sent? + // something must have gone wrong + // terminate the session + char *clf_req = pblock_findkeyval(pb_key_clf_request, rq->rq.reqpb); + log_ereport(LOG_WARN, "nsapi_finish_request: no response header: request: %s", clf_req); + rq->rq.rq_attr.keep_alive = 0; + } if(rq->rq.rq_attr.keep_alive) { SessionHandler *sh = sn->connection->session_handler; @@ -891,9 +899,17 @@ if(ret != REQ_NOACTION) { if(ret == REQ_PROCEED) { - // flush buffer and add termination if chunked encoding - // is enabled - net_finish(sn->sn.csd); + if(rq->rq.senthdrs) { + // flush buffer and add termination if chunked encoding + // is enabled + net_finish(sn->sn.csd); + } else { + // a service SAF must send a response + // senthdrs == 0 indicators something has gone + // wrong + protocol_status(&sn->sn, &rq->rq, 500, NULL); + ret = REQ_ABORTED; + } } else if(ret == REQ_PROCESSING) { // save nsapi context rq->context.objset_index = i;