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
This commit is contained in:
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user