Skip to content

Commit

Permalink
Upd: do not set "Connection: close", use nc->is_draining
Browse files Browse the repository at this point in the history
  • Loading branch information
jcorporation committed Nov 17, 2024
1 parent 4f54354 commit 29670c1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/lib/http_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ static void http_client_ev_handler(struct mg_connection *nc, int ev, void *ev_da
"Host: %.*s\r\n"
"%s"
"Content-Length: %lu\r\n"
"Connection: close\r\n"
"Accept: */*\r\n"
"Accept-Encoding: none\r\n"
"User-Agent: myMPD/"MYMPD_VERSION" (https://github.com/jcorporation/myMPD)\r\n"
Expand All @@ -218,7 +217,6 @@ static void http_client_ev_handler(struct mg_connection *nc, int ev, void *ev_da
"%s %s HTTP/1.1\r\n"
"Host: %.*s\r\n"
"%s"
"Connection: close\r\n"
"Accept: */*\r\n"
"Accept-Encoding: none\r\n"
"User-Agent: myMPD/"MYMPD_VERSION" (https://github.com/jcorporation/myMPD)\r\n"
Expand Down Expand Up @@ -270,7 +268,7 @@ static void http_client_ev_handler(struct mg_connection *nc, int ev, void *ev_da
MYMPD_LOG_INFO(NULL, "HTTP client response code \"%d\"", mg_client_response->response_code);
}
//Tell mongoose to close this connection
nc->is_closing = 1;
nc->is_draining = 1;
}
else if (ev == MG_EV_ERROR) {
struct mg_client_response_t *mg_client_response = (struct mg_client_response_t *) nc->fn_data;
Expand Down
3 changes: 2 additions & 1 deletion src/web_server/proxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ void send_backend_request(struct mg_connection *nc) {
"User-Agent: myMPD/"MYMPD_VERSION" (https://github.com/jcorporation/myMPD)\r\n"
"Accept: */*\r\n"
"Accept-Encoding: none\r\n"
"Connection: close\r\n"
"\r\n",
mg_url_uri(backend_nc_data->uri),
(int)host.len, host.buf
Expand Down Expand Up @@ -261,6 +260,8 @@ void forward_backend_to_frontend_covercache(struct mg_connection *nc, int ev, vo
MYMPD_LOG_ERROR(NULL, "Invalid response from connection \"%lu\", response code %d", nc->id, response_code);
webserver_redirect_placeholder_image(backend_nc_data->frontend_nc, PLACEHOLDER_NA);
}
//Tell mongoose to close this connection
nc->is_draining = 1;
break;
}
case MG_EV_CLOSE: {
Expand Down

0 comments on commit 29670c1

Please sign in to comment.