[vlc-devel] [PATCH 3/9] httpd: match protocol before request verb

RĂ©mi Denis-Courmont remi at remlab.net
Sat Jun 6 19:31:15 CEST 2020


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

diff --git a/src/network/httpd.c b/src/network/httpd.c
index c2cd6afee3..1935487c50 100644
--- a/src/network/httpd.c
+++ b/src/network/httpd.c
@@ -1423,15 +1423,11 @@ static void httpd_ClientRecv(httpd_client_t *cl)
                 cl->query.i_type = HTTPD_MSG_NONE;
 
                 for (unsigned i = 0; i < ARRAY_SIZE(msg_type); i++)
-                    if (!strncmp((char *)cl->p_buffer, msg_type[i].name,
-                                strlen(msg_type[i].name))) {
+                    if (cl->query.i_proto == msg_type[i].i_proto
+                     && strncmp((char *)cl->p_buffer, msg_type[i].name,
+                                strlen(msg_type[i].name)) == 0) {
                         p = (char *)&cl->p_buffer[strlen(msg_type[i].name) + 1 ];
                         cl->query.i_type = msg_type[i].i_type;
-                        if (cl->query.i_proto != msg_type[i].i_proto) {
-                            p = NULL;
-                            cl->query.i_proto = HTTPD_PROTO_NONE;
-                            cl->query.i_type = HTTPD_MSG_NONE;
-                        }
                         break;
                     }
 
-- 
2.27.0



More information about the vlc-devel mailing list