nghttpx: Convert LogFragmentType to enum class

This commit is contained in:
Tatsuhiro Tsujikawa 2018-10-17 11:21:06 +09:00
parent e62258713e
commit 4d562b773b
8 changed files with 124 additions and 123 deletions

View File

@ -44,4 +44,4 @@ HEADERS = [
]
if __name__ == '__main__':
gentokenlookup(HEADERS, 'HD')
gentokenlookup(HEADERS, 'HD_')

View File

@ -50,4 +50,4 @@ if __name__ == '__main__':
continue
_, m, _ = line.split(',', 2)
methods.append(m.strip())
gentokenlookup(methods, 'HTTP')
gentokenlookup(methods, 'HTTP_')

View File

@ -208,5 +208,5 @@ LOGVARS = [
]
if __name__ == '__main__':
gentokenlookup(OPTIONS, 'SHRPX_OPTID', value_type='char', comp_fun='util::strieq_l')
gentokenlookup(LOGVARS, 'SHRPX_LOGF', value_type='char', comp_fun='util::strieq_l', return_type='LogFragmentType', fail_value='SHRPX_LOGF_NONE')
gentokenlookup(OPTIONS, 'SHRPX_OPTID_', value_type='char', comp_fun='util::strieq_l')
gentokenlookup(LOGVARS, 'LogFragmentType::', value_type='char', comp_fun='util::strieq_l', return_type='LogFragmentType', fail_value='LogFragmentType::NONE')

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
def to_enum_hd(k, prefix):
res = prefix + '_'
res = prefix
for c in k.upper():
if c == ':' or c == '-':
res += '_'
@ -30,7 +30,7 @@ enum {'''
print '''\
{},'''.format(to_enum_hd(k, prefix))
print '''\
{}_MAXIDX,
{}MAXIDX,
}};'''.format(prefix)
def gen_index_header(tokens, prefix, value_type, comp_fun, return_type, fail_value):

View File

@ -379,7 +379,7 @@ LogFragmentType log_var_lookup_token(const char *name, size_t namelen) {
switch (name[2]) {
case 'd':
if (util::strieq_l("pi", name, 2)) {
return SHRPX_LOGF_PID;
return LogFragmentType::PID;
}
break;
}
@ -388,7 +388,7 @@ LogFragmentType log_var_lookup_token(const char *name, size_t namelen) {
switch (name[3]) {
case 'n':
if (util::strieq_l("alp", name, 3)) {
return SHRPX_LOGF_ALPN;
return LogFragmentType::ALPN;
}
break;
}
@ -397,7 +397,7 @@ LogFragmentType log_var_lookup_token(const char *name, size_t namelen) {
switch (name[5]) {
case 's':
if (util::strieq_l("statu", name, 5)) {
return SHRPX_LOGF_STATUS;
return LogFragmentType::STATUS;
}
break;
}
@ -406,12 +406,12 @@ LogFragmentType log_var_lookup_token(const char *name, size_t namelen) {
switch (name[6]) {
case 'i':
if (util::strieq_l("tls_sn", name, 6)) {
return SHRPX_LOGF_TLS_SNI;
return LogFragmentType::TLS_SNI;
}
break;
case 't':
if (util::strieq_l("reques", name, 6)) {
return SHRPX_LOGF_REQUEST;
return LogFragmentType::REQUEST;
}
break;
}
@ -420,15 +420,15 @@ LogFragmentType log_var_lookup_token(const char *name, size_t namelen) {
switch (name[9]) {
case 'l':
if (util::strieq_l("time_loca", name, 9)) {
return SHRPX_LOGF_TIME_LOCAL;
return LogFragmentType::TIME_LOCAL;
}
break;
case 'r':
if (util::strieq_l("ssl_ciphe", name, 9)) {
return SHRPX_LOGF_SSL_CIPHER;
return LogFragmentType::SSL_CIPHER;
}
if (util::strieq_l("tls_ciphe", name, 9)) {
return SHRPX_LOGF_TLS_CIPHER;
return LogFragmentType::TLS_CIPHER;
}
break;
}
@ -437,15 +437,15 @@ LogFragmentType log_var_lookup_token(const char *name, size_t namelen) {
switch (name[10]) {
case 'r':
if (util::strieq_l("remote_add", name, 10)) {
return SHRPX_LOGF_REMOTE_ADDR;
return LogFragmentType::REMOTE_ADDR;
}
break;
case 't':
if (util::strieq_l("remote_por", name, 10)) {
return SHRPX_LOGF_REMOTE_PORT;
return LogFragmentType::REMOTE_PORT;
}
if (util::strieq_l("server_por", name, 10)) {
return SHRPX_LOGF_SERVER_PORT;
return LogFragmentType::SERVER_PORT;
}
break;
}
@ -454,28 +454,28 @@ LogFragmentType log_var_lookup_token(const char *name, size_t namelen) {
switch (name[11]) {
case '1':
if (util::strieq_l("time_iso860", name, 11)) {
return SHRPX_LOGF_TIME_ISO8601;
return LogFragmentType::TIME_ISO8601;
}
break;
case 'e':
if (util::strieq_l("request_tim", name, 11)) {
return SHRPX_LOGF_REQUEST_TIME;
return LogFragmentType::REQUEST_TIME;
}
break;
case 'l':
if (util::strieq_l("ssl_protoco", name, 11)) {
return SHRPX_LOGF_SSL_PROTOCOL;
return LogFragmentType::SSL_PROTOCOL;
}
if (util::strieq_l("tls_protoco", name, 11)) {
return SHRPX_LOGF_TLS_PROTOCOL;
return LogFragmentType::TLS_PROTOCOL;
}
break;
case 't':
if (util::strieq_l("backend_hos", name, 11)) {
return SHRPX_LOGF_BACKEND_HOST;
return LogFragmentType::BACKEND_HOST;
}
if (util::strieq_l("backend_por", name, 11)) {
return SHRPX_LOGF_BACKEND_PORT;
return LogFragmentType::BACKEND_PORT;
}
break;
}
@ -484,10 +484,10 @@ LogFragmentType log_var_lookup_token(const char *name, size_t namelen) {
switch (name[13]) {
case 'd':
if (util::strieq_l("ssl_session_i", name, 13)) {
return SHRPX_LOGF_SSL_SESSION_ID;
return LogFragmentType::SSL_SESSION_ID;
}
if (util::strieq_l("tls_session_i", name, 13)) {
return SHRPX_LOGF_TLS_SESSION_ID;
return LogFragmentType::TLS_SESSION_ID;
}
break;
}
@ -496,7 +496,7 @@ LogFragmentType log_var_lookup_token(const char *name, size_t namelen) {
switch (name[14]) {
case 't':
if (util::strieq_l("body_bytes_sen", name, 14)) {
return SHRPX_LOGF_BODY_BYTES_SENT;
return LogFragmentType::BODY_BYTES_SENT;
}
break;
}
@ -505,7 +505,7 @@ LogFragmentType log_var_lookup_token(const char *name, size_t namelen) {
switch (name[16]) {
case 'l':
if (util::strieq_l("tls_client_seria", name, 16)) {
return SHRPX_LOGF_TLS_CLIENT_SERIAL;
return LogFragmentType::TLS_CLIENT_SERIAL;
}
break;
}
@ -514,10 +514,10 @@ LogFragmentType log_var_lookup_token(const char *name, size_t namelen) {
switch (name[17]) {
case 'd':
if (util::strieq_l("ssl_session_reuse", name, 17)) {
return SHRPX_LOGF_SSL_SESSION_REUSED;
return LogFragmentType::SSL_SESSION_REUSED;
}
if (util::strieq_l("tls_session_reuse", name, 17)) {
return SHRPX_LOGF_TLS_SESSION_REUSED;
return LogFragmentType::TLS_SESSION_REUSED;
}
break;
}
@ -526,7 +526,7 @@ LogFragmentType log_var_lookup_token(const char *name, size_t namelen) {
switch (name[21]) {
case 'e':
if (util::strieq_l("tls_client_issuer_nam", name, 21)) {
return SHRPX_LOGF_TLS_CLIENT_ISSUER_NAME;
return LogFragmentType::TLS_CLIENT_ISSUER_NAME;
}
break;
}
@ -535,7 +535,7 @@ LogFragmentType log_var_lookup_token(const char *name, size_t namelen) {
switch (name[22]) {
case 'e':
if (util::strieq_l("tls_client_subject_nam", name, 22)) {
return SHRPX_LOGF_TLS_CLIENT_SUBJECT_NAME;
return LogFragmentType::TLS_CLIENT_SUBJECT_NAME;
}
break;
}
@ -544,7 +544,7 @@ LogFragmentType log_var_lookup_token(const char *name, size_t namelen) {
switch (name[26]) {
case '1':
if (util::strieq_l("tls_client_fingerprint_sha", name, 26)) {
return SHRPX_LOGF_TLS_CLIENT_FINGERPRINT_SHA1;
return LogFragmentType::TLS_CLIENT_FINGERPRINT_SHA1;
}
break;
}
@ -553,13 +553,13 @@ LogFragmentType log_var_lookup_token(const char *name, size_t namelen) {
switch (name[28]) {
case '6':
if (util::strieq_l("tls_client_fingerprint_sha25", name, 28)) {
return SHRPX_LOGF_TLS_CLIENT_FINGERPRINT_SHA256;
return LogFragmentType::TLS_CLIENT_FINGERPRINT_SHA256;
}
break;
}
break;
}
return SHRPX_LOGF_NONE;
return LogFragmentType::NONE;
}
} // namespace
@ -613,16 +613,16 @@ std::vector<LogFragment> parse_log_format(BlockAllocator &balloc,
auto type = log_var_lookup_token(var_name, var_namelen);
if (type == SHRPX_LOGF_NONE) {
if (type == LogFragmentType::NONE) {
if (util::istarts_with_l(StringRef{var_name, var_namelen}, "http_")) {
if (util::streq_l("host", StringRef{var_name + str_size("http_"),
var_namelen - str_size("http_")})) {
// Special handling of host header field. We will use
// :authority header field if host header is missing. This
// is a typical case in HTTP/2.
type = SHRPX_LOGF_AUTHORITY;
type = LogFragmentType::AUTHORITY;
} else {
type = SHRPX_LOGF_HTTP;
type = LogFragmentType::HTTP;
value = var_name + str_size("http_");
}
} else {
@ -634,7 +634,7 @@ std::vector<LogFragment> parse_log_format(BlockAllocator &balloc,
if (literal_start < var_start) {
res.emplace_back(
SHRPX_LOGF_LITERAL,
LogFragmentType::LITERAL,
make_string_ref(balloc, StringRef{literal_start, var_start}));
}
@ -661,7 +661,7 @@ std::vector<LogFragment> parse_log_format(BlockAllocator &balloc,
}
if (literal_start != eop) {
res.emplace_back(SHRPX_LOGF_LITERAL,
res.emplace_back(LogFragmentType::LITERAL,
make_string_ref(balloc, StringRef{literal_start, eop}));
}

View File

@ -79,84 +79,84 @@ void test_shrpx_config_parse_log_format(void) {
R"("${http_referer}" $http_host "$http_user_agent")"));
CU_ASSERT(16 == res.size());
CU_ASSERT(SHRPX_LOGF_REMOTE_ADDR == res[0].type);
CU_ASSERT(LogFragmentType::REMOTE_ADDR == res[0].type);
CU_ASSERT(SHRPX_LOGF_LITERAL == res[1].type);
CU_ASSERT(LogFragmentType::LITERAL == res[1].type);
CU_ASSERT(" - $remote_user [" == res[1].value);
CU_ASSERT(SHRPX_LOGF_TIME_LOCAL == res[2].type);
CU_ASSERT(LogFragmentType::TIME_LOCAL == res[2].type);
CU_ASSERT(SHRPX_LOGF_LITERAL == res[3].type);
CU_ASSERT(LogFragmentType::LITERAL == res[3].type);
CU_ASSERT("] \"" == res[3].value);
CU_ASSERT(SHRPX_LOGF_REQUEST == res[4].type);
CU_ASSERT(LogFragmentType::REQUEST == res[4].type);
CU_ASSERT(SHRPX_LOGF_LITERAL == res[5].type);
CU_ASSERT(LogFragmentType::LITERAL == res[5].type);
CU_ASSERT("\" " == res[5].value);
CU_ASSERT(SHRPX_LOGF_STATUS == res[6].type);
CU_ASSERT(LogFragmentType::STATUS == res[6].type);
CU_ASSERT(SHRPX_LOGF_LITERAL == res[7].type);
CU_ASSERT(LogFragmentType::LITERAL == res[7].type);
CU_ASSERT(" " == res[7].value);
CU_ASSERT(SHRPX_LOGF_BODY_BYTES_SENT == res[8].type);
CU_ASSERT(LogFragmentType::BODY_BYTES_SENT == res[8].type);
CU_ASSERT(SHRPX_LOGF_LITERAL == res[9].type);
CU_ASSERT(LogFragmentType::LITERAL == res[9].type);
CU_ASSERT(" \"" == res[9].value);
CU_ASSERT(SHRPX_LOGF_HTTP == res[10].type);
CU_ASSERT(LogFragmentType::HTTP == res[10].type);
CU_ASSERT("referer" == res[10].value);
CU_ASSERT(SHRPX_LOGF_LITERAL == res[11].type);
CU_ASSERT(LogFragmentType::LITERAL == res[11].type);
CU_ASSERT("\" " == res[11].value);
CU_ASSERT(SHRPX_LOGF_AUTHORITY == res[12].type);
CU_ASSERT(LogFragmentType::AUTHORITY == res[12].type);
CU_ASSERT(SHRPX_LOGF_LITERAL == res[13].type);
CU_ASSERT(LogFragmentType::LITERAL == res[13].type);
CU_ASSERT(" \"" == res[13].value);
CU_ASSERT(SHRPX_LOGF_HTTP == res[14].type);
CU_ASSERT(LogFragmentType::HTTP == res[14].type);
CU_ASSERT("user-agent" == res[14].value);
CU_ASSERT(SHRPX_LOGF_LITERAL == res[15].type);
CU_ASSERT(LogFragmentType::LITERAL == res[15].type);
CU_ASSERT("\"" == res[15].value);
res = parse_log_format(balloc, StringRef::from_lit("$"));
CU_ASSERT(1 == res.size());
CU_ASSERT(SHRPX_LOGF_LITERAL == res[0].type);
CU_ASSERT(LogFragmentType::LITERAL == res[0].type);
CU_ASSERT("$" == res[0].value);
res = parse_log_format(balloc, StringRef::from_lit("${"));
CU_ASSERT(1 == res.size());
CU_ASSERT(SHRPX_LOGF_LITERAL == res[0].type);
CU_ASSERT(LogFragmentType::LITERAL == res[0].type);
CU_ASSERT("${" == res[0].value);
res = parse_log_format(balloc, StringRef::from_lit("${a"));
CU_ASSERT(1 == res.size());
CU_ASSERT(SHRPX_LOGF_LITERAL == res[0].type);
CU_ASSERT(LogFragmentType::LITERAL == res[0].type);
CU_ASSERT("${a" == res[0].value);
res = parse_log_format(balloc, StringRef::from_lit("${a "));
CU_ASSERT(1 == res.size());
CU_ASSERT(SHRPX_LOGF_LITERAL == res[0].type);
CU_ASSERT(LogFragmentType::LITERAL == res[0].type);
CU_ASSERT("${a " == res[0].value);
res = parse_log_format(balloc, StringRef::from_lit("$$remote_addr"));
CU_ASSERT(2 == res.size());
CU_ASSERT(SHRPX_LOGF_LITERAL == res[0].type);
CU_ASSERT(LogFragmentType::LITERAL == res[0].type);
CU_ASSERT("$" == res[0].value);
CU_ASSERT(SHRPX_LOGF_REMOTE_ADDR == res[1].type);
CU_ASSERT(LogFragmentType::REMOTE_ADDR == res[1].type);
CU_ASSERT("" == res[1].value);
}

View File

@ -609,19 +609,19 @@ void upstream_accesslog(const std::vector<LogFragment> &lfv,
for (auto &lf : lfv) {
switch (lf.type) {
case SHRPX_LOGF_LITERAL:
case LogFragmentType::LITERAL:
std::tie(p, last) = copy(lf.value, p, last);
break;
case SHRPX_LOGF_REMOTE_ADDR:
case LogFragmentType::REMOTE_ADDR:
std::tie(p, last) = copy(lgsp.remote_addr, p, last);
break;
case SHRPX_LOGF_TIME_LOCAL:
case LogFragmentType::TIME_LOCAL:
std::tie(p, last) = copy(tstamp->time_local, p, last);
break;
case SHRPX_LOGF_TIME_ISO8601:
case LogFragmentType::TIME_ISO8601:
std::tie(p, last) = copy(tstamp->time_iso8601, p, last);
break;
case SHRPX_LOGF_REQUEST:
case LogFragmentType::REQUEST:
std::tie(p, last) = copy(method, p, last);
std::tie(p, last) = copy(' ', p, last);
std::tie(p, last) = copy_escape(path, p, last);
@ -632,13 +632,13 @@ void upstream_accesslog(const std::vector<LogFragment> &lfv,
std::tie(p, last) = copy(req.http_minor, p, last);
}
break;
case SHRPX_LOGF_STATUS:
case LogFragmentType::STATUS:
std::tie(p, last) = copy(resp.http_status, p, last);
break;
case SHRPX_LOGF_BODY_BYTES_SENT:
case LogFragmentType::BODY_BYTES_SENT:
std::tie(p, last) = copy(downstream->response_sent_body_length, p, last);
break;
case SHRPX_LOGF_HTTP: {
case LogFragmentType::HTTP: {
auto hd = req.fs.header(lf.value);
if (hd) {
std::tie(p, last) = copy_escape((*hd).value, p, last);
@ -649,7 +649,7 @@ void upstream_accesslog(const std::vector<LogFragment> &lfv,
break;
}
case SHRPX_LOGF_AUTHORITY:
case LogFragmentType::AUTHORITY:
if (!req.authority.empty()) {
std::tie(p, last) = copy(req.authority, p, last);
break;
@ -658,13 +658,13 @@ void upstream_accesslog(const std::vector<LogFragment> &lfv,
std::tie(p, last) = copy('-', p, last);
break;
case SHRPX_LOGF_REMOTE_PORT:
case LogFragmentType::REMOTE_PORT:
std::tie(p, last) = copy(lgsp.remote_port, p, last);
break;
case SHRPX_LOGF_SERVER_PORT:
case LogFragmentType::SERVER_PORT:
std::tie(p, last) = copy(lgsp.server_port, p, last);
break;
case SHRPX_LOGF_REQUEST_TIME: {
case LogFragmentType::REQUEST_TIME: {
auto t = std::chrono::duration_cast<std::chrono::milliseconds>(
lgsp.request_end_time - downstream->get_request_start_time())
.count();
@ -678,20 +678,20 @@ void upstream_accesslog(const std::vector<LogFragment> &lfv,
std::tie(p, last) = copy(frac, p, last);
break;
}
case SHRPX_LOGF_PID:
case LogFragmentType::PID:
std::tie(p, last) = copy(lgsp.pid, p, last);
break;
case SHRPX_LOGF_ALPN:
case LogFragmentType::ALPN:
std::tie(p, last) = copy_escape(lgsp.alpn, p, last);
break;
case SHRPX_LOGF_TLS_CIPHER:
case LogFragmentType::TLS_CIPHER:
if (!lgsp.ssl) {
std::tie(p, last) = copy('-', p, last);
break;
}
std::tie(p, last) = copy(SSL_get_cipher_name(lgsp.ssl), p, last);
break;
case SHRPX_LOGF_TLS_PROTOCOL:
case LogFragmentType::TLS_PROTOCOL:
if (!lgsp.ssl) {
std::tie(p, last) = copy('-', p, last);
break;
@ -699,7 +699,7 @@ void upstream_accesslog(const std::vector<LogFragment> &lfv,
std::tie(p, last) =
copy(nghttp2::tls::get_tls_protocol(lgsp.ssl), p, last);
break;
case SHRPX_LOGF_TLS_SESSION_ID: {
case LogFragmentType::TLS_SESSION_ID: {
auto session = SSL_get_session(lgsp.ssl);
if (!session) {
std::tie(p, last) = copy('-', p, last);
@ -714,7 +714,7 @@ void upstream_accesslog(const std::vector<LogFragment> &lfv,
std::tie(p, last) = copy_hex_low(session_id, session_id_length, p, last);
break;
}
case SHRPX_LOGF_TLS_SESSION_REUSED:
case LogFragmentType::TLS_SESSION_REUSED:
if (!lgsp.ssl) {
std::tie(p, last) = copy('-', p, last);
break;
@ -722,15 +722,15 @@ void upstream_accesslog(const std::vector<LogFragment> &lfv,
std::tie(p, last) =
copy(SSL_session_reused(lgsp.ssl) ? 'r' : '.', p, last);
break;
case SHRPX_LOGF_TLS_SNI:
case LogFragmentType::TLS_SNI:
if (lgsp.sni.empty()) {
std::tie(p, last) = copy('-', p, last);
break;
}
std::tie(p, last) = copy_escape(lgsp.sni, p, last);
break;
case SHRPX_LOGF_TLS_CLIENT_FINGERPRINT_SHA1:
case SHRPX_LOGF_TLS_CLIENT_FINGERPRINT_SHA256: {
case LogFragmentType::TLS_CLIENT_FINGERPRINT_SHA1:
case LogFragmentType::TLS_CLIENT_FINGERPRINT_SHA256: {
if (!lgsp.ssl) {
std::tie(p, last) = copy('-', p, last);
break;
@ -743,8 +743,9 @@ void upstream_accesslog(const std::vector<LogFragment> &lfv,
std::array<uint8_t, 32> buf;
auto len = tls::get_x509_fingerprint(
buf.data(), buf.size(), x,
lf.type == SHRPX_LOGF_TLS_CLIENT_FINGERPRINT_SHA256 ? EVP_sha256()
: EVP_sha1());
lf.type == LogFragmentType::TLS_CLIENT_FINGERPRINT_SHA256
? EVP_sha256()
: EVP_sha1());
X509_free(x);
if (len <= 0) {
std::tie(p, last) = copy('-', p, last);
@ -753,8 +754,8 @@ void upstream_accesslog(const std::vector<LogFragment> &lfv,
std::tie(p, last) = copy_hex_low(buf.data(), len, p, last);
break;
}
case SHRPX_LOGF_TLS_CLIENT_ISSUER_NAME:
case SHRPX_LOGF_TLS_CLIENT_SUBJECT_NAME: {
case LogFragmentType::TLS_CLIENT_ISSUER_NAME:
case LogFragmentType::TLS_CLIENT_SUBJECT_NAME: {
if (!lgsp.ssl) {
std::tie(p, last) = copy('-', p, last);
break;
@ -764,7 +765,7 @@ void upstream_accesslog(const std::vector<LogFragment> &lfv,
std::tie(p, last) = copy('-', p, last);
break;
}
auto name = lf.type == SHRPX_LOGF_TLS_CLIENT_ISSUER_NAME
auto name = lf.type == LogFragmentType::TLS_CLIENT_ISSUER_NAME
? tls::get_x509_issuer_name(balloc, x)
: tls::get_x509_subject_name(balloc, x);
X509_free(x);
@ -775,7 +776,7 @@ void upstream_accesslog(const std::vector<LogFragment> &lfv,
std::tie(p, last) = copy(name, p, last);
break;
}
case SHRPX_LOGF_TLS_CLIENT_SERIAL: {
case LogFragmentType::TLS_CLIENT_SERIAL: {
if (!lgsp.ssl) {
std::tie(p, last) = copy('-', p, last);
break;
@ -794,21 +795,21 @@ void upstream_accesslog(const std::vector<LogFragment> &lfv,
std::tie(p, last) = copy(sn, p, last);
break;
}
case SHRPX_LOGF_BACKEND_HOST:
case LogFragmentType::BACKEND_HOST:
if (!downstream_addr) {
std::tie(p, last) = copy('-', p, last);
break;
}
std::tie(p, last) = copy(downstream_addr->host, p, last);
break;
case SHRPX_LOGF_BACKEND_PORT:
case LogFragmentType::BACKEND_PORT:
if (!downstream_addr) {
std::tie(p, last) = copy('-', p, last);
break;
}
std::tie(p, last) = copy(downstream_addr->port, p, last);
break;
case SHRPX_LOGF_NONE:
case LogFragmentType::NONE:
break;
default:
break;

View File

@ -215,38 +215,38 @@ void dec(Log &log);
#define TTY_HTTP_HD (log_config()->errorlog_tty ? "\033[1;34m" : "")
#define TTY_RST (log_config()->errorlog_tty ? "\033[0m" : "")
enum LogFragmentType {
SHRPX_LOGF_NONE,
SHRPX_LOGF_LITERAL,
SHRPX_LOGF_REMOTE_ADDR,
SHRPX_LOGF_TIME_LOCAL,
SHRPX_LOGF_TIME_ISO8601,
SHRPX_LOGF_REQUEST,
SHRPX_LOGF_STATUS,
SHRPX_LOGF_BODY_BYTES_SENT,
SHRPX_LOGF_HTTP,
SHRPX_LOGF_AUTHORITY,
SHRPX_LOGF_REMOTE_PORT,
SHRPX_LOGF_SERVER_PORT,
SHRPX_LOGF_REQUEST_TIME,
SHRPX_LOGF_PID,
SHRPX_LOGF_ALPN,
SHRPX_LOGF_TLS_CIPHER,
SHRPX_LOGF_SSL_CIPHER = SHRPX_LOGF_TLS_CIPHER,
SHRPX_LOGF_TLS_PROTOCOL,
SHRPX_LOGF_SSL_PROTOCOL = SHRPX_LOGF_TLS_PROTOCOL,
SHRPX_LOGF_TLS_SESSION_ID,
SHRPX_LOGF_SSL_SESSION_ID = SHRPX_LOGF_TLS_SESSION_ID,
SHRPX_LOGF_TLS_SESSION_REUSED,
SHRPX_LOGF_SSL_SESSION_REUSED = SHRPX_LOGF_TLS_SESSION_REUSED,
SHRPX_LOGF_TLS_SNI,
SHRPX_LOGF_TLS_CLIENT_FINGERPRINT_SHA1,
SHRPX_LOGF_TLS_CLIENT_FINGERPRINT_SHA256,
SHRPX_LOGF_TLS_CLIENT_ISSUER_NAME,
SHRPX_LOGF_TLS_CLIENT_SERIAL,
SHRPX_LOGF_TLS_CLIENT_SUBJECT_NAME,
SHRPX_LOGF_BACKEND_HOST,
SHRPX_LOGF_BACKEND_PORT,
enum class LogFragmentType {
NONE,
LITERAL,
REMOTE_ADDR,
TIME_LOCAL,
TIME_ISO8601,
REQUEST,
STATUS,
BODY_BYTES_SENT,
HTTP,
AUTHORITY,
REMOTE_PORT,
SERVER_PORT,
REQUEST_TIME,
PID,
ALPN,
TLS_CIPHER,
SSL_CIPHER = TLS_CIPHER,
TLS_PROTOCOL,
SSL_PROTOCOL = TLS_PROTOCOL,
TLS_SESSION_ID,
SSL_SESSION_ID = TLS_SESSION_ID,
TLS_SESSION_REUSED,
SSL_SESSION_REUSED = TLS_SESSION_REUSED,
TLS_SNI,
TLS_CLIENT_FINGERPRINT_SHA1,
TLS_CLIENT_FINGERPRINT_SHA256,
TLS_CLIENT_ISSUER_NAME,
TLS_CLIENT_SERIAL,
TLS_CLIENT_SUBJECT_NAME,
BACKEND_HOST,
BACKEND_PORT,
};
struct LogFragment {