改进HTTP访问日志格式
This commit is contained in:
@@ -1091,17 +1091,15 @@ void __write_access_log(struct http_session_private * hs_private)
|
||||
}
|
||||
|
||||
/* Content Type */
|
||||
const char * __str_cont_type = resp_spec ? resp_spec->content_type : "-";
|
||||
/* Content Length */
|
||||
const char * __str_cont_length = resp_spec ? resp_spec->content_length : "-";
|
||||
const char * __str_cont_type = resp_spec ? resp_spec->content_type != NULL ? resp_spec->content_type : "-" : "-";
|
||||
/* Content Encoding */
|
||||
const char * __str_cont_encoding = resp_spec ? resp_spec->content_encoding : "-";
|
||||
const char * __str_cont_encoding = resp_spec ? resp_spec->content_encoding != NULL ? resp_spec->content_encoding: "-" : "-";
|
||||
/* Upgrade Tag */
|
||||
const char * __str_upgrade = response->is_upgrade ? "UPGRADE" : "-";
|
||||
const char * __str_upgrade = response ? response->is_upgrade ? "UPGRADE" : "-" : "-";
|
||||
|
||||
char * __access_log;
|
||||
asprintf(&__access_log, "%s %s %s %s %s %s %s", __str_method,
|
||||
__str_url, __str_resp_code, __str_cont_type, __str_cont_length, __str_cont_encoding, __str_upgrade);
|
||||
asprintf(&__access_log, "%d %s %s HTTP/%d.%d %s %s %s %s", hs_private->hs_public.session_id, __str_method,
|
||||
__str_url, request->major, request->minor, __str_resp_code, __str_cont_type, __str_cont_encoding, __str_upgrade);
|
||||
|
||||
const struct tfe_stream * stream = hs_private->hc_private->stream;
|
||||
tfe_stream_write_access_log(stream, RLOG_LV_INFO, "%s", __access_log);
|
||||
|
||||
Reference in New Issue
Block a user