diff options
author | Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> | 2023-05-16 16:01:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-16 16:01:55 +0200 |
commit | 4e186f6bfbd734bf44124e6e0f710a3a0372c92c (patch) | |
tree | 8c59a5ddd72d0e5feeb70ad512a8519cf65fddfc /src/lib/ndpi_main.c | |
parent | 8c224b464f36da0497c9ef7c2fe2ec3c135a01ba (diff) |
HTTP: rework state machine (#1966)
The goal if to correlate the right request-response pair, exporting
metadata from only one transaction (for example, the right url & return
state pair)
As a nice side effect, the code should be much cleaner, but that is a
matter of taste.
Two differences respect to the previous code:
* as it happens in the CI, if in the flow there are only one response
(before) and one request (after), only the metadata of the response are
saved/exported
* for performance reasons, we don't call `ndpi_parse_packet_line_info()`
anymore for ALL packets triggering the HTTP dissector, but only for the
packets that we already know belong to an HTTP flow. This is the reason
for the changes in RTSP/SOAP/... code
Diffstat (limited to 'src/lib/ndpi_main.c')
-rw-r--r-- | src/lib/ndpi_main.c | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index 0c9e2eca9..c4d8ce886 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -7232,20 +7232,6 @@ void ndpi_parse_single_packet_line(struct ndpi_detection_module_struct *ndpi_str packet->http_response.ptr = &packet->line[0].ptr[NDPI_STATICSTRING_LEN("HTTP/1.1 ")]; packet->http_response.len = packet->line[0].len - NDPI_STATICSTRING_LEN("HTTP/1.1 "); packet->http_num_headers++; - - /* Set server HTTP response code */ - if(packet->payload_packet_len >= 12) { - char buf[4]; - - /* Set server HTTP response code */ - strncpy(buf, (char *) &packet->payload[9], 3); - buf[3] = '\0'; - - flow->http.response_status_code = atoi(buf); - /* https://en.wikipedia.org/wiki/List_of_HTTP_status_codes */ - if((flow->http.response_status_code < 100) || (flow->http.response_status_code > 509)) - flow->http.response_status_code = 0; /* Out of range */ - } } if((packet->parsed_lines == 0) && (packet->line[0].len > 0)) { |