diff options
author | Luca Deri <deri@ntop.org> | 2021-01-06 18:28:24 +0100 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2021-01-06 18:28:24 +0100 |
commit | eb37f8f1fbf62fce7e8997a24408b998f895d07b (patch) | |
tree | d56b4cc326b9f8f3a6d3aa31741702bab017bb51 /example | |
parent | cd21f0d31647444d93536bed2516ddc175e09b25 (diff) |
Split HTTP request from response Content-Type. Request Content-Type should be present with POSTs and not with other methods such as GET
Diffstat (limited to 'example')
-rw-r--r-- | example/ndpiReader.c | 3 | ||||
-rw-r--r-- | example/reader_util.c | 1 | ||||
-rw-r--r-- | example/reader_util.h | 2 |
3 files changed, 5 insertions, 1 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c index 9c882101b..3e69d2bad 100644 --- a/example/ndpiReader.c +++ b/example/ndpiReader.c @@ -1376,6 +1376,9 @@ static void printFlow(u_int16_t id, struct ndpi_flow_info *flow, u_int16_t threa fprintf(out, "[URL: %s][StatusCode: %u]", flow->http.url, flow->http.response_status_code); + if(flow->http.request_content_type[0] != '\0') + fprintf(out, "[Req Content-Type: %s]", flow->http.request_content_type); + if(flow->http.content_type[0] != '\0') fprintf(out, "[Content-Type: %s]", flow->http.content_type); } diff --git a/example/reader_util.c b/example/reader_util.c index 8258b27cc..7089a4122 100644 --- a/example/reader_util.c +++ b/example/reader_util.c @@ -1120,6 +1120,7 @@ void process_ndpi_collected_info(struct ndpi_workflow * workflow, struct ndpi_fl snprintf(flow->http.url, sizeof(flow->http.url), "%s", flow->ndpi_flow->http.url); flow->http.response_status_code = flow->ndpi_flow->http.response_status_code; snprintf(flow->http.content_type, sizeof(flow->http.content_type), "%s", flow->ndpi_flow->http.content_type ? flow->ndpi_flow->http.content_type : ""); + snprintf(flow->http.request_content_type, sizeof(flow->http.request_content_type), "%s", flow->ndpi_flow->http.request_content_type ? flow->ndpi_flow->http.request_content_type : ""); snprintf(flow->http.user_agent, sizeof(flow->http.user_agent), "%s", flow->ndpi_flow->http.user_agent ? flow->ndpi_flow->http.user_agent : ""); } } else if(is_ndpi_proto(flow, NDPI_PROTOCOL_TELNET)) { diff --git a/example/reader_util.h b/example/reader_util.h index f471c365f..1fee437a9 100644 --- a/example/reader_util.h +++ b/example/reader_util.h @@ -221,7 +221,7 @@ typedef struct ndpi_flow_info { } ssh_tls; struct { - char url[256], content_type[64], user_agent[128]; + char url[256], request_content_type[64], content_type[64], user_agent[128]; u_int response_status_code; } http; |