Passes method_len param to ndpi_http_str2method

This commit is contained in:
Simone Mainardi
2020-08-27 10:05:38 +02:00
parent 2e8aa9f08e
commit f0325f713a
3 changed files with 8 additions and 8 deletions
+6 -3
View File
@@ -1567,7 +1567,10 @@ const char* ndpi_http_method2str(ndpi_http_method m) {
/* ******************************************************************** */
ndpi_http_method ndpi_http_str2method(const char* method) {
ndpi_http_method ndpi_http_str2method(const char* method, ssize_t method_len) {
if(!method || method_len < 3)
return(NDPI_HTTP_METHOD_UNKNOWN);
switch(method[0]) {
case 'O': return(NDPI_HTTP_METHOD_OPTIONS);
case 'G': return(NDPI_HTTP_METHOD_GET);
@@ -1584,7 +1587,7 @@ ndpi_http_method ndpi_http_str2method(const char* method) {
case 'D': return(NDPI_HTTP_METHOD_DELETE);
case 'T': return(NDPI_HTTP_METHOD_TRACE);
case 'C': return(NDPI_HTTP_METHOD_CONNECT);
default: return(NDPI_HTTP_METHOD_UNKNOWN);
}
return(NDPI_HTTP_METHOD_UNKNOWN);
}