Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
151 changes: 7 additions & 144 deletions include/proxy/PreTransactionLogData.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@

#pragma once

#include "proxy/logging/TransactionLogData.h"
#include "proxy/Milestones.h"
#include "proxy/hdrs/HTTP.h"
#include "tscore/ink_inet.h"

#include <string>

Expand All @@ -36,160 +38,21 @@
* copied request and session metadata needed to emit a best-effort
* transaction log entry for those failures.
*
* Unlike TransactionLogData (which reads from a live HttpSM), this class
* owns its milestones, addresses, and strings because the originating
* stream is about to be destroyed.
* This class owns its milestones, addresses, and strings because the
* originating stream is about to be destroyed.
*/
class PreTransactionLogData : public TransactionLogData
class PreTransactionLogData
{
public:
PreTransactionLogData() = default;

~PreTransactionLogData() override
~PreTransactionLogData()
{
if (owned_client_request.valid()) {
owned_client_request.destroy();
}
}

// ===== Milestones =====

TransactionMilestones const *
get_milestones() const override
{
return &owned_milestones;
}

// ===== Headers =====

HTTPHdr *
get_client_request() const override
{
if (owned_client_request.valid()) {
return const_cast<HTTPHdr *>(&owned_client_request);
}
return nullptr;
}

// ===== Client request URL / path =====

const char *
get_client_req_url_str() const override
{
return owned_url.empty() ? nullptr : owned_url.c_str();
}
int
get_client_req_url_len() const override
{
return static_cast<int>(owned_url.size());
}
const char *
get_client_req_url_path_str() const override
{
return owned_path.empty() ? nullptr : owned_path.c_str();
}
int
get_client_req_url_path_len() const override
{
return static_cast<int>(owned_path.size());
}

// ===== Client addressing =====

sockaddr const *
get_client_addr() const override
{
return &owned_client_addr.sa;
}
sockaddr const *
get_client_src_addr() const override
{
return &owned_client_src_addr.sa;
}
sockaddr const *
get_client_dst_addr() const override
{
return &owned_client_dst_addr.sa;
}
uint16_t
get_client_port() const override
{
return m_client_port;
}

// ===== Squid codes =====

SquidLogCode
get_log_code() const override
{
return m_log_code;
}
SquidHitMissCode
get_hit_miss_code() const override
{
return m_hit_miss_code;
}
SquidHierarchyCode
get_hier_code() const override
{
return m_hier_code;
}

// ===== Transaction identifiers =====

int64_t
get_connection_id() const override
{
return m_connection_id;
}
int
get_transaction_id() const override
{
return m_transaction_id;
}

// ===== Protocol info =====

const char *
get_client_protocol() const override
{
return owned_client_protocol_str.empty() ? nullptr : owned_client_protocol_str.c_str();
}

// ===== Connection flags =====

bool
get_client_connection_is_ssl() const override
{
return m_client_connection_is_ssl;
}

// ===== Server transaction count =====

int64_t
get_server_transact_count() const override
{
return m_server_transact_count;
}

// ===== Fallback fields for pre-transaction logging =====

std::string_view
get_method() const override
{
return owned_method;
}
std::string_view
get_scheme() const override
{
return owned_scheme;
}
std::string_view
get_client_protocol_str() const override
{
return owned_client_protocol_str;
}

// ===== Owned backing storage (public for ProxyTransaction to populate). =====

HTTPHdr owned_client_request;
Expand Down
208 changes: 0 additions & 208 deletions include/proxy/http/CompletedTransactionLogData.h

This file was deleted.

2 changes: 1 addition & 1 deletion include/proxy/logging/Log.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
@section example Example usage of the API

@code
// Populate a LogData (e.g. TransactionLogData or PreTransactionLogData), then:
// Populate a TransactionLogData, then:
LogAccess entry(data);
int ret = Log::access(&entry);
@endcode
Expand Down
Loading