Skip to content

Commit

Permalink
Merge pull request #2938 from cesanta/isresp
Browse files Browse the repository at this point in the history
Honor c->is_resp with Connection:close
  • Loading branch information
scaprile authored Oct 10, 2024
2 parents 9fc92e9 + d37c300 commit 3c10b36
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mongoose.c
Original file line number Diff line number Diff line change
Expand Up @@ -3310,7 +3310,7 @@ static void http_cb(struct mg_connection *c, int ev, void *ev_data) {

if (c->is_accepted) c->is_resp = 1; // Start generating response
mg_call(c, MG_EV_HTTP_MSG, &hm); // User handler can clear is_resp
if (c->is_accepted) {
if (c->is_accepted && !c->is_resp) {
struct mg_str *cc = mg_http_get_header(&hm, "Connection");
if (cc != NULL && mg_strcasecmp(*cc, mg_str("close")) == 0) {
c->is_draining = 1; // honor "Connection: close"
Expand Down
2 changes: 1 addition & 1 deletion src/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,7 @@ static void http_cb(struct mg_connection *c, int ev, void *ev_data) {

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

0 comments on commit 3c10b36

Please sign in to comment.