Skip to content

Commit d37c300

Browse files
committed
Honor c->is_resp with Connection:close
1 parent 9fc92e9 commit d37c300

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

mongoose.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3310,7 +3310,7 @@ static void http_cb(struct mg_connection *c, int ev, void *ev_data) {
33103310

33113311
if (c->is_accepted) c->is_resp = 1; // Start generating response
33123312
mg_call(c, MG_EV_HTTP_MSG, &hm); // User handler can clear is_resp
3313-
if (c->is_accepted) {
3313+
if (c->is_accepted && !c->is_resp) {
33143314
struct mg_str *cc = mg_http_get_header(&hm, "Connection");
33153315
if (cc != NULL && mg_strcasecmp(*cc, mg_str("close")) == 0) {
33163316
c->is_draining = 1; // honor "Connection: close"

src/http.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,7 @@ static void http_cb(struct mg_connection *c, int ev, void *ev_data) {
10941094

10951095
if (c->is_accepted) c->is_resp = 1; // Start generating response
10961096
mg_call(c, MG_EV_HTTP_MSG, &hm); // User handler can clear is_resp
1097-
if (c->is_accepted) {
1097+
if (c->is_accepted && !c->is_resp) {
10981098
struct mg_str *cc = mg_http_get_header(&hm, "Connection");
10991099
if (cc != NULL && mg_strcasecmp(*cc, mg_str("close")) == 0) {
11001100
c->is_draining = 1; // honor "Connection: close"

0 commit comments

Comments
 (0)