MCPcopy Create free account
hub / github.com/apache/trafficserver / init

Method init

src/proxy/logging/LogAccess.cc:76–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74 -------------------------------------------------------------------------*/
75
76void
77LogAccess::init()
78{
79 HttpTransact::HeaderInfo *hdr = &(m_http_sm->t_state.hdr_info);
80
81 if (hdr->client_request.valid()) {
82 m_client_request = &(hdr->client_request);
83
84 // make a copy of the incoming url into the arena
85 const char *url_string_ref = m_client_request->url_string_get_ref(&m_client_req_url_len);
86 m_client_req_url_str = m_arena.str_alloc(m_client_req_url_len + 1);
87 memcpy(m_client_req_url_str, url_string_ref, m_client_req_url_len);
88 m_client_req_url_str[m_client_req_url_len] = '\0';
89
90 m_client_req_url_canon_str =
91 Encoding::escapify_url(&m_arena, m_client_req_url_str, m_client_req_url_len, &m_client_req_url_canon_len);
92 m_client_req_url_path_str = m_client_request->path_get(&m_client_req_url_path_len);
93 }
94
95 if (hdr->client_response.valid()) {
96 m_proxy_response = &(hdr->client_response);
97 MIMEField *field = m_proxy_response->field_find(MIME_FIELD_CONTENT_TYPE, MIME_LEN_CONTENT_TYPE);
98 if (field) {
99 auto proxy_resp_content_type{field->value_get()};
100 m_proxy_resp_content_type_str = const_cast<char *>(proxy_resp_content_type.data());
101 m_proxy_resp_content_type_len = proxy_resp_content_type.length();
102 LogUtils::remove_content_type_attributes(m_proxy_resp_content_type_str, &m_proxy_resp_content_type_len);
103 } else {
104 // If Content-Type field is missing, check for @Content-Type
105 field = m_proxy_response->field_find(HIDDEN_CONTENT_TYPE, HIDDEN_CONTENT_TYPE_LEN);
106 if (field) {
107 auto proxy_resp_content_type{field->value_get()};
108 m_proxy_resp_content_type_str = const_cast<char *>(proxy_resp_content_type.data());
109 m_proxy_resp_content_type_len = proxy_resp_content_type.length();
110 LogUtils::remove_content_type_attributes(m_proxy_resp_content_type_str, &m_proxy_resp_content_type_len);
111 }
112 }
113 m_proxy_resp_reason_phrase_str = const_cast<char *>(m_proxy_response->reason_get(&m_proxy_resp_reason_phrase_len));
114 }
115 if (hdr->server_request.valid()) {
116 m_proxy_request = &(hdr->server_request);
117 }
118 if (hdr->server_response.valid()) {
119 m_server_response = &(hdr->server_response);
120 }
121 if (hdr->cache_response.valid()) {
122 m_cache_response = &(hdr->cache_response);
123 }
124}
125
126int
127LogAccess::marshal_proxy_host_name(char *buf)

Callers 1

resolve_logfield_stringFunction · 0.45

Calls 11

escapify_urlFunction · 0.85
url_string_get_refMethod · 0.80
str_allocMethod · 0.80
field_findMethod · 0.80
reason_getMethod · 0.80
memcpyFunction · 0.50
validMethod · 0.45
path_getMethod · 0.45
value_getMethod · 0.45
dataMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected