diff options
Diffstat (limited to 'plugin/business/tsg-http/src/tsg_logger.cpp')
| -rw-r--r-- | plugin/business/tsg-http/src/tsg_logger.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/plugin/business/tsg-http/src/tsg_logger.cpp b/plugin/business/tsg-http/src/tsg_logger.cpp index e1cc528..51cefe9 100644 --- a/plugin/business/tsg-http/src/tsg_logger.cpp +++ b/plugin/business/tsg-http/src/tsg_logger.cpp @@ -175,6 +175,17 @@ static int get_ip_server_geolocation(struct tfe_cmsg * cmsg, cJSON *per_hit_obj) return 0; } +int proxy_add_host_to_object(cJSON *common_obj, const char *req_spec_host) +{ + unsigned int port; + char *format_host=ALLOC(char, strlen(req_spec_host)+1); + sscanf(req_spec_host, "%[^:]:%u", format_host, &port); + cJSON_AddStringToObject(common_obj, "http_host", format_host); + cJSON_AddStringToObject(common_obj, "server_fqdn", format_host); + FREE(&format_host); + return 0; +} + int proxy_send_log(struct proxy_logger* handle, const struct proxy_log* log_msg) { const struct tfe_http_session* http=log_msg->http; @@ -300,8 +311,7 @@ int proxy_send_log(struct proxy_logger* handle, const struct proxy_log* log_msg) cJSON_AddNumberToObject(common_obj, "sent_bytes", c2s_byte_num); cJSON_AddNumberToObject(common_obj, "received_bytes", s2c_byte_num); cJSON_AddStringToObject(common_obj, "http_url", http->req->req_spec.url); - cJSON_AddStringToObject(common_obj, "http_host", http->req->req_spec.host); - cJSON_AddStringToObject(common_obj, "server_fqdn", http->req->req_spec.host); + proxy_add_host_to_object(common_obj, http->req->req_spec.host); if(handle->effective_device_tag) { |
