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
2 changes: 1 addition & 1 deletion include/proxy/logging/LogAccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ class LogAccess
void set_http_header_field(LogField::Container container, char *field, char *buf, int len);

// Plugin
int marshal_custom_field(char *buf, const LogField::CustomMarshalFunc &plugin_marshal_func);
int marshal_custom_field(char *buf, LogField::Type type, const LogField::CustomMarshalFunc &plugin_marshal_func);

//
// unmarshalling routines
Expand Down
26 changes: 24 additions & 2 deletions src/proxy/logging/LogAccess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -465,9 +465,31 @@ LogAccess::marshal_ip(char *dest, sockaddr const *ip)
}

int
LogAccess::marshal_custom_field(char *buf, const LogField::CustomMarshalFunc &plugin_marshal_func)
LogAccess::marshal_custom_field(char *buf, LogField::Type type, const LogField::CustomMarshalFunc &plugin_marshal_func)
{
int len = plugin_marshal_func(m_data->http_sm_for_plugins(), buf);
void *sm = m_data->http_sm_for_plugins();
if (sm == nullptr) {
switch (type) {
case LogField::sINT:
case LogField::dINT:
if (buf) {
marshal_int(buf, 0);
}
return INK_MIN_ALIGN;
case LogField::STRING: {
int len = LogAccess::padded_strlen(nullptr);
if (buf) {
marshal_str(buf, nullptr, len);
}
return len;
}
case LogField::IP:
return marshal_ip(buf, nullptr);
case LogField::N_TYPES:
break;
}
}
int len = plugin_marshal_func(sm, buf);
return LogAccess::padded_length(len);
}

Expand Down
4 changes: 2 additions & 2 deletions src/proxy/logging/LogField.cc
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ LogField::marshal_len(LogAccess *lad)
if (!m_custom_marshal_func) {
return (lad->*m_marshal_func)(nullptr);
} else {
return lad->marshal_custom_field(nullptr, m_custom_marshal_func);
return lad->marshal_custom_field(nullptr, m_type, m_custom_marshal_func);
}
}

Expand Down Expand Up @@ -633,7 +633,7 @@ LogField::marshal(LogAccess *lad, char *buf)
if (!m_custom_marshal_func) {
return (lad->*m_marshal_func)(buf);
} else {
return lad->marshal_custom_field(buf, m_custom_marshal_func);
return lad->marshal_custom_field(buf, m_type, m_custom_marshal_func);
}
}

Expand Down