Passes method_len param to ndpi_http_str2method
This commit is contained in:
@@ -930,7 +930,7 @@ extern "C" {
|
||||
void ndpi_md5(const u_char *data, size_t data_len, u_char hash[16]);
|
||||
|
||||
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);
|
||||
|
||||
/* ptree (trie) API */
|
||||
ndpi_ptree_t* ndpi_ptree_create(void);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -337,10 +337,7 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_
|
||||
ndpi_check_http_url(ndpi_struct, flow, &flow->http.url[packet->host_line.len]);
|
||||
}
|
||||
|
||||
if(flow->packet.http_method.len < 3)
|
||||
flow->http.method = NDPI_HTTP_METHOD_UNKNOWN;
|
||||
else
|
||||
flow->http.method = ndpi_http_str2method((const char*)flow->packet.http_method.ptr);
|
||||
flow->http.method = ndpi_http_str2method((const char*)flow->packet.http_method.ptr, flow->packet.http_method.len);
|
||||
}
|
||||
|
||||
if(packet->user_agent_line.ptr != NULL && packet->user_agent_line.len != 0) {
|
||||
|
||||
Reference in New Issue
Block a user