aboutsummaryrefslogtreecommitdiff
path: root/src/lib/protocols/http.c
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2017-01-31 15:04:24 +0100
committerLuca Deri <deri@ntop.org>2017-01-31 15:04:24 +0100
commit8805d8523b6f2f22d4db0a1344439f36e5f3f9c2 (patch)
tree8ff2ff1bfb898889d5b2e56f1841fd6a85fb925a /src/lib/protocols/http.c
parent0610ae2d21d08a1e13d42e672362fdd05c72f33a (diff)
Optimized code to avoid multiple calls to ndpi_network_ptree_match()
HTTP-based subprotocols have not HTTP set as master_protocols
Diffstat (limited to 'src/lib/protocols/http.c')
-rw-r--r--src/lib/protocols/http.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/protocols/http.c b/src/lib/protocols/http.c
index 4b381f067..d405e407b 100644
--- a/src/lib/protocols/http.c
+++ b/src/lib/protocols/http.c
@@ -41,10 +41,11 @@ static void ndpi_int_http_add_connection(struct ndpi_detection_module_struct *nd
/* If no custom protocol has been detected */
if(flow->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN) {
- if(protocol == NDPI_PROTOCOL_HTTP)
+ if(protocol == NDPI_PROTOCOL_HTTP) {
ndpi_int_reset_protocol(flow);
-
- ndpi_set_detected_protocol(ndpi_struct, flow, protocol, NDPI_PROTOCOL_UNKNOWN);
+ ndpi_set_detected_protocol(ndpi_struct, flow, flow->guessed_host_protocol_id, protocol);
+ } else
+ ndpi_set_detected_protocol(ndpi_struct, flow, protocol, NDPI_PROTOCOL_HTTP);
}
flow->http_detected = 1;
@@ -382,7 +383,8 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_
if(!ndpi_struct->http_dont_dissect_response && flow->http_detected)
parseHttpSubprotocol(ndpi_struct, flow);
- flow->guessed_protocol_id = NDPI_PROTOCOL_HTTP;
+ if(flow->guessed_protocol_id == NDPI_PROTOCOL_UNKNOWN)
+ flow->guessed_protocol_id = NDPI_PROTOCOL_HTTP;
/* check for accept line */
if(packet->accept_line.ptr != NULL) {