| 74 | -------------------------------------------------------------------------*/ |
| 75 | |
| 76 | void |
| 77 | LogAccess::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 | |
| 126 | int |
| 127 | LogAccess::marshal_proxy_host_name(char *buf) |
no test coverage detected