[vlc-commits] httpd: do not blindly echo the Connection header line

Rémi Denis-Courmont git at videolan.org
Sun Oct 8 17:28:00 CEST 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Oct  8 17:52:43 2017 +0300| [a81000187840432b27fba9ee36543548e3423efb] | committer: 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.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a81000187840432b27fba9ee36543548e3423efb
---

 src/network/httpd.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/network/httpd.c b/src/network/httpd.c
index 6fa6d45cc0..84c8e699cc 100644
--- a/src/network/httpd.c
+++ b/src/network/httpd.c
@@ -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,
         free(p_body);
 
     /* 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);
 



More information about the vlc-commits mailing list