aboutsummaryrefslogtreecommitdiff
path: root/src/lib/ndpi_utils.c
diff options
context:
space:
mode:
authorSimone Mainardi <mainardi@ntop.org>2020-08-27 10:05:38 +0200
committerSimone Mainardi <mainardi@ntop.org>2020-08-27 10:05:38 +0200
commitf0325f713a741c6ed5f896ba0e11cca9638258ef (patch)
tree640e3dacb76dc780af9d847df35c1140a05c643b /src/lib/ndpi_utils.c
parent2e8aa9f08e59e77a518a483876b7f81e8ddb4c15 (diff)
Passes method_len param to ndpi_http_str2method
Diffstat (limited to 'src/lib/ndpi_utils.c')
-rw-r--r--src/lib/ndpi_utils.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lib/ndpi_utils.c b/src/lib/ndpi_utils.c
index 72653bb69..5db42cffa 100644
--- a/src/lib/ndpi_utils.c
+++ b/src/lib/ndpi_utils.c
@@ -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);
}