Skip to content

Commit af02569

Browse files
committed
fix: handle HTTP_STATUS_CLOSE before and after postprocessor
1 parent d232bc0 commit af02569

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

http/server/HttpHandler.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,11 @@ int HttpHandler::HandleHttpRequest() {
492492
}
493493
}
494494
}
495+
// Handle HTTP_STATUS_CLOSE: close connection without response
496+
if (status_code == HTTP_STATUS_CLOSE) {
497+
state = WANT_CLOSE;
498+
return HTTP_STATUS_CLOSE;
499+
}
495500
if (fc) {
496501
pResp->content = fc->filebuf.base;
497502
pResp->content_length = fc->filebuf.len;
@@ -501,12 +506,10 @@ int HttpHandler::HandleHttpRequest() {
501506
}
502507
if (service->postprocessor) {
503508
status_code = customHttpHandler(service->postprocessor);
504-
}
505-
506-
// Handle HTTP_STATUS_CLOSE: close connection without response
507-
if (status_code == HTTP_STATUS_CLOSE) {
508-
state = WANT_CLOSE;
509-
return HTTP_STATUS_CLOSE;
509+
if (status_code == HTTP_STATUS_CLOSE) {
510+
state = WANT_CLOSE;
511+
return HTTP_STATUS_CLOSE;
512+
}
510513
}
511514

512515
if (writer && writer->state != hv::HttpResponseWriter::SEND_BEGIN) {

0 commit comments

Comments
 (0)