Commit a8100018 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

httpd: do not blindly echo the Connection header line

Only the "close" token should actually be echoed. Other token would be
header line names, and must not be echoed unless we specifically do not
want a proxy to pass it up.

For now, force theclose token if there is an inbound connection header.
This is not optimal as it might close a connection needlessly, but at
least it works correctly.
parent 399f680f
......@@ -310,7 +310,7 @@ httpd_FileCallBack(httpd_callback_sys_t *p_sys, httpd_client_t *cl,
httpd_message_t *answer, const httpd_message_t *query)
httpd_file_t *file = (httpd_file_t*)p_sys;
uint8_t **pp_body, *p_body; const char *psz_connection;
uint8_t **pp_body, *p_body;
int *pi_body, i_body;
if (!answer || !query )
......@@ -347,9 +347,8 @@ httpd_FileCallBack(httpd_callback_sys_t *p_sys, httpd_client_t *cl,
/* We respect client request */
psz_connection = httpd_MsgGet(&cl->query, "Connection");
if (psz_connection)
httpd_MsgAdd(answer, "Connection", "%s", psz_connection);
if (httpd_MsgGet(&cl->query, "Connection") != NULL)
httpd_MsgAdd(answer, "Connection", "close");
httpd_MsgAdd(answer, "Content-Length", "%d", answer->i_body);
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment