Token.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 #include "squid.h"
10 #include "format/Config.h"
11 #include "format/Token.h"
12 #include "format/TokenTableEntry.h"
13 #include "globals.h"
14 #include "parser/Tokenizer.h"
15 #include "proxyp/Elements.h"
16 #include "sbuf/Stream.h"
17 #include "SquidConfig.h"
18 #include "Store.h"
19 
20 // Due to token overlaps between 1 and 2 letter tokens (Bug 3310)
21 // We split the token table into sets determined by the token length
22 namespace Format
23 {
24 
27 
31 
35 
40 
42 
44 
45  TokenTableEntry(nullptr, LFT_NONE) /* this must be last */
46 };
47 
50 
55  /*TokenTableEntry( "lA", LFT_LOCAL_NAME ), */
56 
60 
67 
71  TokenTableEntry("busy_time", LFT_BUSY_TIME),
72 
75 
78  /*TokenTableEntry( "ur", LFT_USER_REALM ), */
79  /*TokenTableEntry( "us", LFT_USER_SCHEME ), */
81 
85  /*TokenTableEntry( "Ht", LFT_HTTP_STATUS ), */
87 
90 
92 
99  /*TokenTableEntry(">rq", LFT_CLIENT_REQ_QUERY),*/
101 
103  TokenTableEntry("ru", LFT_REQUEST_URI), /* doesn't include the query-string */
105  /* TokenTableEntry( "rq", LFT_REQUEST_QUERY ), * / / * the query-string, INCLUDING the leading ? */
108 
115  /*TokenTableEntry("<rq", LFT_SERVER_REQ_QUERY),*/
117 
120  /*TokenTableEntry( ">sb", LFT_REQUEST_SIZE_BODY ), */
121  /*TokenTableEntry( ">sB", LFT_REQUEST_SIZE_BODY_NO_TE ), */
122 
123  TokenTableEntry("<st", LFT_ADAPTED_REPLY_SIZE_TOTAL), // XXX: adapted should be code: <sta
126  TokenTableEntry("<sh", LFT_ADAPTED_REPLY_SIZE_HEADERS ), // XXX: adapted should be code: <sha
127  /*TokenTableEntry( "<sb", LFT_REPLY_SIZE_BODY ), */
128  /*TokenTableEntry( "<sB", LFT_REPLY_SIZE_BODY_NO_TE ), */
129 
130  TokenTableEntry("st", LFT_CLIENT_IO_SIZE_TOTAL), // XXX: total from client should be stC ??
131  /*TokenTableEntry("stP", LFT_SERVER_IO_SIZE_TOTAL),*/
132 
133  TokenTableEntry("et", LFT_TAG),
136 
137  TokenTableEntry(nullptr, LFT_NONE) /* this must be last */
138 };
139 
142  TokenTableEntry("byte", LFT_BYTE),
148  TokenTableEntry(">handshake", LFT_CLIENT_HANDSHAKE),
149  TokenTableEntry("err_code", LFT_SQUID_ERROR ),
150  TokenTableEntry("err_detail", LFT_SQUID_ERROR_DETAIL ),
151  TokenTableEntry("request_attempts", LFT_SQUID_REQUEST_ATTEMPTS),
152  TokenTableEntry("note", LFT_NOTE ),
153  TokenTableEntry("credentials", LFT_CREDENTIALS),
154  TokenTableEntry("master_xaction", LFT_MASTER_XACTION),
155  /*
156  * Legacy external_acl_type format tokens
157  */
161  TokenTableEntry("EXT_LOG", LFT_EXT_LOG),
162  TokenTableEntry("EXT_TAG", LFT_TAG),
163  TokenTableEntry("EXT_USER", LFT_USER_EXTERNAL),
173  TokenTableEntry("SRCPORT", LFT_CLIENT_PORT),
174  TokenTableEntry("SRC", LFT_CLIENT_IP_ADDRESS), // keep after longer SRC* tokens
175  TokenTableEntry("TAG", LFT_TAG),
177 #if USE_OPENSSL
180 #endif
181  TokenTableEntry(nullptr, LFT_NONE) /* this must be last */
182 };
183 
186 };
187 
190 };
191 
192 #if USE_ADAPTATION
197  TokenTableEntry(nullptr, LFT_NONE) /* this must be last */
198 };
199 #endif
200 
201 #if ICAP_CLIENT
202 static TokenTableEntry TokenTableIcap[] = {
204  TokenTableEntry("tt", LFT_ICAP_TOTAL_TIME),
205  TokenTableEntry("<last_h", LFT_ADAPTATION_LAST_HEADER), // deprecated
206 
207  TokenTableEntry("<A", LFT_ICAP_ADDR),
208  TokenTableEntry("<service_name", LFT_ICAP_SERV_NAME),
209  TokenTableEntry("ru", LFT_ICAP_REQUEST_URI),
210  TokenTableEntry("rm", LFT_ICAP_REQUEST_METHOD),
211  TokenTableEntry(">st", LFT_ICAP_BYTES_SENT),
212  TokenTableEntry("<st", LFT_ICAP_BYTES_READ),
213  TokenTableEntry("<bs", LFT_ICAP_BODY_BYTES_READ),
214 
215  TokenTableEntry(">h", LFT_ICAP_REQ_HEADER),
216  TokenTableEntry("<h", LFT_ICAP_REP_HEADER),
217 
218  TokenTableEntry("tr", LFT_ICAP_TR_RESPONSE_TIME),
219  TokenTableEntry("tio", LFT_ICAP_IO_TIME),
220  TokenTableEntry("to", LFT_ICAP_OUTCOME),
221  TokenTableEntry("Hs", LFT_ICAP_STATUS_CODE),
222 
223  TokenTableEntry(nullptr, LFT_NONE) /* this must be last */
224 };
225 #endif
226 
227 #if USE_OPENSSL
228 // TLS/SSL (tls:: or ssl::) tokens
230  TokenTableEntry("bump_mode", LFT_SSL_BUMP_MODE),
231  TokenTableEntry(">cert_subject", LFT_SSL_USER_CERT_SUBJECT),
232  TokenTableEntry(">cert_issuer", LFT_SSL_USER_CERT_ISSUER),
238  TokenTableEntry(">negotiated_version", LFT_TLS_CLIENT_NEGOTIATED_VERSION),
239  TokenTableEntry("<negotiated_version", LFT_TLS_SERVER_NEGOTIATED_VERSION),
240  TokenTableEntry(">negotiated_cipher", LFT_TLS_CLIENT_NEGOTIATED_CIPHER),
241  TokenTableEntry("<negotiated_cipher", LFT_TLS_SERVER_NEGOTIATED_CIPHER),
242  TokenTableEntry(">received_hello_version", LFT_TLS_CLIENT_RECEIVED_HELLO_VERSION),
243  TokenTableEntry("<received_hello_version", LFT_TLS_SERVER_RECEIVED_HELLO_VERSION),
244  TokenTableEntry(">received_supported_version", LFT_TLS_CLIENT_SUPPORTED_VERSION),
245  TokenTableEntry("<received_supported_version", LFT_TLS_SERVER_SUPPORTED_VERSION),
246  TokenTableEntry(nullptr, LFT_NONE)
247 };
248 #endif
249 } // namespace Format
250 
252 void
254 {
255  // TODO standard log tokens
256 
257 #if USE_ADAPTATION
259 #endif
260 #if ICAP_CLIENT
262 #endif
263 #if USE_OPENSSL
266 #endif
269 }
270 
273 const char *
275 {
276  for (TokenTableEntry const *lte = table; lte->configTag != nullptr; ++lte) {
277  debugs(46, 8, "compare tokens '" << lte->configTag << "' with '" << cur << "'");
278  if (strncmp(lte->configTag, cur, strlen(lte->configTag)) == 0) {
279  type = lte->tokenType;
280  label = lte->configTag;
281  debugs(46, 7, "Found token '" << label << "'");
282  return cur + strlen(lte->configTag);
283  }
284  }
285  return cur;
286 }
287 
288 // TODO: Reduce code duplication across this and other custom integer parsers.
290 template <typename Integer>
291 static Integer
292 ParseUnsignedDecimalInteger(const char *description, const SBuf &rawInput)
293 {
294  constexpr auto minValue = std::numeric_limits<Integer>::min();
295  constexpr auto maxValue = std::numeric_limits<Integer>::max();
296 
297  Parser::Tokenizer tok(rawInput);
298  if (tok.skip('0')) {
299  if (!tok.atEnd()) {
300  // e.g., 077, 0xFF, 0b101, or 0.1
301  throw TextException(ToSBuf("Malformed ", description,
302  ": Expected a decimal integer without leading zeros but got '",
303  rawInput, "'"), Here());
304  }
305  // for simplicity, we currently assume that zero is always in range
306  static_assert(minValue <= 0);
307  static_assert(0 <= maxValue);
308  return Integer(0);
309  }
310  // else the value might still be zero (e.g., -0)
311 
312  // check that our caller is compatible with Tokenizer::int64() use below
313  using ParsedInteger = int64_t;
314  static_assert(minValue >= std::numeric_limits<ParsedInteger>::min());
315  static_assert(maxValue <= std::numeric_limits<ParsedInteger>::max());
316 
317  ParsedInteger rawValue = 0;
318  if (!tok.int64(rawValue, 10, false)) {
319  // e.g., FF, -1, or 18446744073709551616
320  // TODO: Provide better diagnostic for values exceeding int64_t maximum.
321  throw TextException(ToSBuf("Malformed ", description,
322  ": Expected an unsigned decimal integer but got '",
323  rawInput, "'"), Here());
324  }
325 
326  if (!tok.atEnd()) {
327  // e.g., 1,000, 1.0, or 1e6
328  throw TextException(ToSBuf("Malformed ", description,
329  ": Trailing garbage after ", rawValue, " in '",
330  rawInput, "'"), Here());
331  }
332 
333  if (rawValue > maxValue) {
334  throw TextException(ToSBuf("Malformed ", description,
335  ": Expected an integer value not exceeding ", maxValue,
336  " but got ", rawValue), Here());
337  }
338 
339  if (rawValue < minValue) {
340  throw TextException(ToSBuf("Malformed ", description,
341  ": Expected an integer value not below ", minValue,
342  " but got ", rawValue), Here());
343  }
344 
345  return Integer(rawValue);
346 }
347 
348 /* parses a single token. Returns the token length in characters,
349  * and fills in the lt item with the token information.
350  * def is for sure null-terminated
351  */
352 int
353 Format::Token::parse(const char *def, Quoting *quoting)
354 {
355  const char *cur = def;
356 
357  int l;
358 
359  l = strcspn(cur, "%");
360 
361  if (l > 0) {
362  char *cp;
363  /* it's a string for sure, until \0 or the next % */
364  cp = (char *)xmalloc(l + 1);
365  xstrncpy(cp, cur, l + 1);
366  type = LFT_STRING;
367  data.string = cp;
368 
369  while (l > 0) {
370  switch (*cur) {
371 
372  case '"':
373 
374  if (*quoting == LOG_QUOTE_NONE)
375  *quoting = LOG_QUOTE_QUOTES;
376  else if (*quoting == LOG_QUOTE_QUOTES)
377  *quoting = LOG_QUOTE_NONE;
378 
379  break;
380 
381  case '[':
382  if (*quoting == LOG_QUOTE_NONE)
383  *quoting = LOG_QUOTE_MIMEBLOB;
384 
385  break;
386 
387  case ']':
388  if (*quoting == LOG_QUOTE_MIMEBLOB)
389  *quoting = LOG_QUOTE_NONE;
390 
391  break;
392  }
393 
394  ++cur;
395  --l;
396  }
397 
398  } else if (*cur) {
399 
400  ++cur;
401 
402  // select quoting style for his particular token
403  switch (*cur) {
404 
405  case '"':
406  quote = LOG_QUOTE_QUOTES;
407  ++cur;
408  break;
409 
410  case '\'':
411  quote = LOG_QUOTE_RAW;
412  ++cur;
413  break;
414 
415  case '[':
416  quote = LOG_QUOTE_MIMEBLOB;
417  ++cur;
418  break;
419 
420  case '#':
421  quote = LOG_QUOTE_URL;
422  ++cur;
423  break;
424 
425  case '/':
426  quote = LOG_QUOTE_SHELL;
427  ++cur;
428  break;
429 
430  default:
431  quote = *quoting;
432  break;
433  }
434 
435  if (*cur == '-') {
436  left = true;
437  ++cur;
438  }
439 
440  if (*cur == '0') {
441  zero = true;
442  ++cur;
443  }
444 
445  char *endp;
446  if (xisdigit(*cur)) {
447  widthMin = strtol(cur, &endp, 10);
448  cur = endp;
449  }
450 
451  if (*cur == '.' && xisdigit(*(++cur))) {
452  widthMax = strtol(cur, &endp, 10);
453  cur = endp;
454  }
455 
456  // when {arg} field is before the token (old logformat syntax)
457  if (*cur == '{') {
458  char *cp;
459  ++cur;
460  l = strcspn(cur, "}");
461  cp = (char *)xmalloc(l + 1);
462  xstrncpy(cp, cur, l + 1);
463  data.string = cp;
464  cur += l;
465 
466  if (*cur == '}')
467  ++cur;
468  }
469 
470  type = LFT_NONE;
471 
472  // Scan each registered token namespace
473  debugs(46, 9, "check for token in " << TheConfig.tokens.size() << " namespaces.");
474  for (const auto &itr : TheConfig.tokens) {
475  debugs(46, 7, "check for possible " << itr.prefix << ":: token");
476  const size_t len = itr.prefix.length();
477  if (itr.prefix.cmp(cur, len) == 0 && cur[len] == ':' && cur[len+1] == ':') {
478  debugs(46, 5, "check for " << itr.prefix << ":: token in '" << cur << "'");
479  const char *old = cur;
480  cur = scanForToken(itr.tokenSet, cur+len+2);
481  if (old != cur) // found
482  break;
483  else // reset to start of namespace
484  cur = cur - len - 2;
485  }
486  }
487 
488  if (type == LFT_NONE) {
489  // For upward compatibility, assume "http::" prefix as default prefix
490  // for all log access formatting codes, except those starting with a
491  // "%" or a known namespace. (ie "icap::", "adapt::")
492  if (strncmp(cur,"http::", 6) == 0 && *(cur+6) != '%' )
493  cur += 6;
494 
495  // NP: scan the sets of tokens in decreasing size to guarantee no
496  // mistakes made with overlapping names. (Bug 3310)
497 
498  // Scan for various long tokens
499  debugs(46, 5, "scan for possible Misc token");
500  cur = scanForToken(TokenTableMisc, cur);
501  // scan for 2-char tokens
502  if (type == LFT_NONE) {
503  debugs(46, 5, "scan for possible 2C token");
504  cur = scanForToken(TokenTable2C, cur);
505  }
506  // finally scan for 1-char tokens.
507  if (type == LFT_NONE) {
508  debugs(46, 5, "scan for possible 1C token");
509  cur = scanForToken(TokenTable1C, cur);
510  }
511  }
512 
513  if (type == LFT_NONE)
514  throw TexcHere(ToSBuf("Unsupported %code: '", def, "'"));
515 
516  // when {arg} field is after the token (old external_acl_type token syntax)
517  // but accept only if there was none before the token
518  if (*cur == '{' && !data.string) {
519  char *cp;
520  ++cur;
521  l = strcspn(cur, "}");
522  cp = (char *)xmalloc(l + 1);
523  xstrncpy(cp, cur, l + 1);
524  data.string = cp;
525  cur += l;
526 
527  if (*cur == '}')
528  ++cur;
529  }
530 
531  if (*cur == ' ') {
532  space = true;
533  ++cur;
534  }
535  }
536 
537  switch (type) {
538 
539  case LFT_BYTE:
540  if (!data.string)
541  throw TextException("logformat %byte requires a parameter (e.g., %byte{10})", Here());
542  // TODO: Convert Format::Token::data.string to SBuf.
543  if (const auto v = ParseUnsignedDecimalInteger<uint8_t>("logformat %byte{value}", SBuf(data.string)))
544  data.byteValue = v;
545  else
546  throw TextException("logformat %byte{n} does not support zero n values yet", Here());
547  break;
548 
549 #if USE_ADAPTATION
551 #endif
552 
553 #if ICAP_CLIENT
554  case LFT_ICAP_REQ_HEADER:
555 
556  case LFT_ICAP_REP_HEADER:
557 #endif
558 
560 
561  case LFT_REQUEST_HEADER:
562 
563  case LFT_REPLY_HEADER:
564 
565  case LFT_NOTE:
566 
568 
569  if (data.string) {
570  char *header = data.string;
571  const auto initialType = type;
572 
573  const auto pseudoHeader = header[0] == ':';
574  char *cp = strchr(pseudoHeader ? header+1 : header, ':');
575 
576  if (cp) {
577  *cp = '\0';
578  ++cp;
579 
580  if (*cp == ',' || *cp == ';' || *cp == ':') {
581  data.header.separator = *cp;
582  ++cp;
583  } else {
584  data.header.separator = ',';
585  }
586 
587  data.header.element = cp;
588 
589  switch (type) {
590  case LFT_REQUEST_HEADER:
592  break;
593 
596  break;
597 
598  case LFT_REPLY_HEADER:
599  type = LFT_REPLY_HEADER_ELEM;
600  break;
601 #if USE_ADAPTATION
604  break;
605 #endif
606 #if ICAP_CLIENT
607  case LFT_ICAP_REQ_HEADER:
609  break;
610  case LFT_ICAP_REP_HEADER:
612  break;
613 #endif
616  break;
617  default:
618  break;
619  }
620  }
621 
622  if (!*header)
623  throw TexcHere(ToSBuf("Can't parse configuration token: '", def, "': missing header name"));
624 
625  if (initialType == LFT_PROXY_PROTOCOL_RECEIVED_HEADER)
626  data.headerId = ProxyProtocol::FieldNameToFieldType(SBuf(header));
627  else if (pseudoHeader)
628  throw TexcHere(ToSBuf("Pseudo headers are not supported in this context; got: '", def, "'"));
629 
630  data.header.header = header;
631  } else {
632  switch (type) {
633  case LFT_REQUEST_HEADER:
635  break;
636 
639  break;
640 
641  case LFT_REPLY_HEADER:
642  type = LFT_REPLY_ALL_HEADERS;
643  break;
644 #if USE_ADAPTATION
647  break;
648 #endif
649 #if ICAP_CLIENT
650  case LFT_ICAP_REQ_HEADER:
652  break;
653  case LFT_ICAP_REP_HEADER:
655  break;
656 #endif
659  break;
660  default:
661  break;
662  }
664  }
665 
666  break;
667 
671  case LFT_DNS_WAIT_TIME:
672 #if ICAP_CLIENT
674  case LFT_ICAP_IO_TIME:
675  case LFT_ICAP_TOTAL_TIME:
676 #endif
677  case LFT_TIME_START:
678  case LFT_TIME_SUBSECOND:
679  divisor = 1000;
680 
681  if (widthMax > 0) {
682  divisor = 1000000;
683 
684  for (int i = widthMax; i > 0; --i)
685  divisor /= 10;
686 
687  if (!divisor)
688  divisor = 1;
689  }
690  break;
691 
693  debugs(46, DBG_PARSE_NOTE(DBG_IMPORTANT), "WARNING: The \"Hs\" formatting code is deprecated. Use the \">Hs\" instead.");
695  break;
696 
698  debugs(46, DBG_PARSE_NOTE(DBG_IMPORTANT), "WARNING: The \"oa\" formatting code is deprecated. Use the \"<la\" instead.");
699  type = LFT_SERVER_LOCAL_IP;
700  break;
701 
703  debugs(46, DBG_PARSE_NOTE(DBG_IMPORTANT), "WARNING: The \"rp\" formatting code is deprecated. Use the \">rp\" instead.");
704  type = LFT_CLIENT_REQ_URLPATH;
705  break;
706 
708  debugs(46, DBG_PARSE_NOTE(DBG_IMPORTANT), "WARNING: The \">v\" formatting code is deprecated. Use the \">rv\" instead.");
709  type = LFT_REQUEST_VERSION;
710  break;
711 
712 #if !USE_SQUID_EUI
713  case LFT_CLIENT_EUI:
714  debugs(46, DBG_CRITICAL, "WARNING: The \">eui\" formatting code requires EUI features which are disabled in this Squid.");
715  break;
716 #endif
717 
718 #if USE_OPENSSL
723  break;
724 #endif
725 
727  debugs(46, DBG_PARSE_NOTE(DBG_IMPORTANT), "WARNING: The \"rG\" formatting code is deprecated. Use \"note{urlgroup}\" instead.");
728  type = LFT_NOTE;
729  data.header.header = xstrdup("urlgroup");
730  break;
731 
732  default:
733  break;
734  }
735 
736  return (cur - def);
737 }
738 
740  label(nullptr),
741  widthMin(-1),
742  widthMax(-1),
743  quote(LOG_QUOTE_NONE),
744  left(false),
745  space(false),
746  zero(false),
747  divisor(1),
748  next(nullptr)
749 {
750  data.string = nullptr;
751  data.header.header = nullptr;
752  data.header.element = nullptr;
753  data.header.separator = ',';
755  data.byteValue = 0;
756 }
757 
759 {
760  label = nullptr; // drop reference to global static.
761  safe_free(data.string);
762  while (next) {
763  Token *tokens = next;
764  next = next->next;
765  tokens->next = nullptr;
766  delete tokens;
767  }
768 }
769 
@ LFT_ICAP_TR_RESPONSE_TIME
Definition: ByteCode.h:213
@ LFT_LOCAL_LISTENING_IP
Definition: ByteCode.h:56
@ LFT_TRANSPORT_CLIENT_CONNECTION_ID
Definition: ByteCode.h:51
@ LFT_TLS_CLIENT_NEGOTIATED_VERSION
Definition: ByteCode.h:229
@ LFT_EXT_ACL_USER_CERT_RAW
Definition: ByteCode.h:245
@ LFT_SQUID_ERROR_DETAIL
Definition: ByteCode.h:175
@ LFT_CLIENT_LOCAL_PORT
Definition: ByteCode.h:46
@ LFT_ICAP_REQUEST_METHOD
Definition: ByteCode.h:200
#define Here()
source code location of the caller
Definition: Here.h:15
@ LFT_ICAP_SERV_NAME
Definition: ByteCode.h:198
@ LFT_ICAP_BODY_BYTES_READ
Definition: ByteCode.h:203
@ LFT_CLIENT_REQ_URLSCHEME
Definition: ByteCode.h:75
@ LFT_SSL_SERVER_CERT_ERRORS
Definition: ByteCode.h:227
@ LFT_USER_NAME
Definition: ByteCode.h:151
#define DBG_CRITICAL
Definition: Stream.h:37
@ LFT_ADAPTATION_LAST_ALL_HEADERS
Definition: ByteCode.h:190
#define xmalloc
@ LOG_QUOTE_URL
Definition: ByteCode.h:266
@ LFT_ICAP_IO_TIME
Definition: ByteCode.h:214
struct Format::Token::@56 data
@ LFT_ADAPTATION_LAST_HEADER
Definition: ByteCode.h:188
static TokenTableEntry TokenTableTransport[]
Definition: Token.cc:188
@ LFT_TAG
Definition: ByteCode.h:180
@ LFT_TOTAL_SERVER_SIDE_RESPONSE_TIME
Definition: ByteCode.h:168
static TokenTableEntry TokenTable2C[]
2-char tokens
Definition: Token.cc:49
const char * scanForToken(TokenTableEntry const table[], const char *cur)
Definition: Token.cc:274
static TokenTableEntry TokenTableSsl[]
Definition: Token.cc:229
@ LFT_ICAP_REQ_HEADER_ELEM
Definition: ByteCode.h:206
static TokenTableEntry TokenTableIcap[]
ICAP (icap::) tokens.
Definition: Token.cc:203
@ LFT_CLIENT_LOCAL_IP
Definition: ByteCode.h:45
@ LFT_PROXY_PROTOCOL_RECEIVED_HEADER
Definition: ByteCode.h:256
@ LFT_CLIENT_EUI
Definition: ByteCode.h:42
@ LFT_SSL_USER_CERT_SUBJECT
Definition: ByteCode.h:222
@ LFT_REQUEST_VERSION
Definition: ByteCode.h:88
@ LFT_SERVER_LOCAL_IP_OLD_27
Definition: ByteCode.h:67
int log_mime_hdrs
Definition: SquidConfig.h:286
@ LFT_USER_LOGIN
Definition: ByteCode.h:152
@ LFT_TLS_CLIENT_SUPPORTED_VERSION
Definition: ByteCode.h:235
@ LFT_SERVER_REQ_URLDOMAIN
Definition: ByteCode.h:105
@ LFT_SSL_SERVER_CERT_ISSUER
Definition: ByteCode.h:226
@ LOG_QUOTE_RAW
Definition: ByteCode.h:268
int parse(const char *def, enum Quoting *quote)
Definition: Token.cc:353
@ LFT_EXT_LOG
Definition: ByteCode.h:181
Definition: SBuf.h:93
@ LFT_REQUEST_METHOD
Definition: ByteCode.h:83
@ LFT_SQUID_REQUEST_ATTEMPTS
Definition: ByteCode.h:177
@ LFT_SQUID_ERROR
Definition: ByteCode.h:174
#define xstrdup
@ LFT_CLIENT_REQ_URI
Definition: ByteCode.h:74
const A & max(A const &lhs, A const &rhs)
@ LFT_SERVER_LOCAL_IP
Definition: ByteCode.h:66
struct SquidConfig::@97 onoff
@ LFT_MIME_TYPE
Definition: ByteCode.h:179
@ LFT_USER_EXTERNAL
Definition: ByteCode.h:155
char * xstrncpy(char *dst, const char *src, size_t n)
Definition: xstring.cc:37
@ LFT_REQUEST_URLGROUP_OLD_2X
Definition: ByteCode.h:89
static TokenTableEntry TokenTableAdapt[]
Definition: Token.cc:193
@ LFT_SQUID_STATUS
Definition: ByteCode.h:173
@ LFT_REQUEST_HEADER
Definition: ByteCode.h:92
@ LFT_SERVER_REQ_URLSCHEME
Definition: ByteCode.h:104
struct tok * next
Definition: parse.c:165
One entry in a table of format tokens.
@ LFT_TIME_LOCALTIME
Definition: ByteCode.h:161
@ LFT_ADAPTED_REQUEST_HEADER
Definition: ByteCode.h:97
@ LFT_SERVER_IP_ADDRESS
Definition: ByteCode.h:61
@ LFT_TIME_START
Definition: ByteCode.h:163
static TokenTableEntry TokenTableMisc[]
Miscellaneous >2 byte tokens.
Definition: Token.cc:141
@ LFT_ICAP_TOTAL_TIME
Definition: ByteCode.h:195
@ LOG_QUOTE_NONE
Definition: ByteCode.h:263
@ LFT_TLS_SERVER_NEGOTIATED_CIPHER
Definition: ByteCode.h:232
@ LFT_REPLY_HIGHOFFSET
Definition: ByteCode.h:142
@ LFT_CLIENT_FQDN
Definition: ByteCode.h:40
@ LFT_SERVER_LOCAL_PORT
Definition: ByteCode.h:68
#define TexcHere(msg)
legacy convenience macro; it is not difficult to type Here() now
Definition: TextException.h:63
@ LFT_SSL_USER_CERT_ISSUER
Definition: ByteCode.h:223
@ LFT_ADAPTATION_LAST_HEADER_ELEM
Definition: ByteCode.h:189
@ LFT_ICAP_STATUS_CODE
Definition: ByteCode.h:216
@ LFT_PEER_RESPONSE_TIME
Definition: ByteCode.h:167
@ LFT_SERVER_REQ_VERSION
Definition: ByteCode.h:109
Two::FieldType FieldNameToFieldType(const SBuf &nameOrId)
Definition: Elements.cc:102
@ LFT_REQUEST_URLPATH_OLD_31
Definition: ByteCode.h:85
@ LFT_TIME_GMT
Definition: ByteCode.h:162
@ LFT_TLS_CLIENT_RECEIVED_HELLO_VERSION
Definition: ByteCode.h:233
@ LFT_SERVER_LOCAL_NFMARK
Definition: ByteCode.h:70
static Integer ParseUnsignedDecimalInteger(const char *description, const SBuf &rawInput)
interprets input as an unsigned decimal integer that fits the specified Integer type
Definition: Token.cc:292
@ LOG_QUOTE_SHELL
Definition: ByteCode.h:267
@ LFT_MASTER_XACTION
Definition: ByteCode.h:241
struct tok tokens[]
Definition: parse.c:168
static TokenTableEntry TokenTableProxyProtocol[]
Definition: Token.cc:184
@ LFT_CLIENT_REQUEST_SIZE_TOTAL
Definition: ByteCode.h:112
@ LFT_TLS_SERVER_NEGOTIATED_VERSION
Definition: ByteCode.h:230
bool logTlsServerHelloDetails
Definition: SquidConfig.h:341
@ LFT_BUSY_TIME
Definition: ByteCode.h:170
@ LFT_ICAP_BYTES_READ
Definition: ByteCode.h:202
@ LFT_ADAPTATION_ALL_XACT_TIMES
Definition: ByteCode.h:187
@ LFT_ICAP_REP_HEADER
Definition: ByteCode.h:209
#define DBG_PARSE_NOTE(x)
Definition: Stream.h:42
@ LFT_TLS_CLIENT_NEGOTIATED_CIPHER
Definition: ByteCode.h:231
FmtConfig TheConfig
Definition: Config.cc:14
@ LFT_HTTP_SENT_STATUS_CODE_OLD_30
Definition: ByteCode.h:124
@ LFT_REQUEST_URI
Definition: ByteCode.h:84
@ LFT_SERVER_REQ_URLPATH
Definition: ByteCode.h:107
@ LFT_HTTP_BODY_BYTES_READ
Definition: ByteCode.h:128
@ LFT_TLS_SERVER_SUPPORTED_VERSION
Definition: ByteCode.h:236
@ LFT_DNS_WAIT_TIME
Definition: ByteCode.h:169
@ LFT_STRING
Definition: ByteCode.h:34
@ LFT_ICAP_OUTCOME
Definition: ByteCode.h:215
@ LFT_CLIENT_REQUEST_SIZE_HEADERS
Definition: ByteCode.h:113
@ LFT_EXT_ACL_CLIENT_EUI64
Definition: ByteCode.h:251
@ LFT_EXT_ACL_USER_CERTCHAIN_RAW
Definition: ByteCode.h:246
@ LFT_CLIENT_REQ_METHOD
Definition: ByteCode.h:73
#define safe_free(x)
Definition: xalloc.h:73
@ LFT_CLIENT_REQ_URLPATH
Definition: ByteCode.h:78
@ LFT_REQUEST_ALL_HEADERS
Definition: ByteCode.h:94
@ LFT_REPLY_HEADER
Definition: ByteCode.h:131
static TokenTableEntry TokenTable1C[]
1-char tokens.
Definition: Token.cc:26
@ LFT_SERVER_LOCAL_TOS
Definition: ByteCode.h:69
@ LFT_EXT_ACL_DATA
Definition: ByteCode.h:253
static void Init()
Initialize the format token registrations.
Definition: Token.cc:253
std::list< TokenNamespace > tokens
list of token namespaces registered
Definition: Config.h:49
@ LFT_ICAP_REP_ALL_HEADERS
Definition: ByteCode.h:211
#define xisdigit(x)
Definition: xis.h:18
@ LFT_TIME_TO_HANDLE_REQUEST
Definition: ByteCode.h:166
@ LFT_ICAP_REQ_ALL_HEADERS
Definition: ByteCode.h:207
@ LFT_ICAP_REQ_HEADER
Definition: ByteCode.h:205
@ LFT_ICAP_REP_HEADER_ELEM
Definition: ByteCode.h:210
@ LFT_CLIENT_IP_ADDRESS
Definition: ByteCode.h:39
@ LFT_REPLY_OBJECTSIZE
Definition: ByteCode.h:143
int cur
Definition: ModDevPoll.cc:68
@ LFT_ADAPTED_REPLY_SIZE_TOTAL
Definition: ByteCode.h:141
@ LFT_ADAPTATION_SUM_XACT_TIMES
Definition: ByteCode.h:186
@ LFT_CLIENT_PORT
Definition: ByteCode.h:41
@ LFT_SERVER_REQ_URLPORT
Definition: ByteCode.h:106
@ LFT_EXT_ACL_NAME
Definition: ByteCode.h:252
@ LFT_ADAPTED_REPLY_SIZE_HEADERS
Definition: ByteCode.h:144
@ LFT_TLS_SERVER_RECEIVED_HELLO_VERSION
Definition: ByteCode.h:234
@ LFT_PROXY_PROTOCOL_RECEIVED_ALL_HEADERS
Definition: ByteCode.h:258
@ LFT_SEQUENCE_NUMBER
Definition: ByteCode.h:183
@ LFT_REPLY_ALL_HEADERS
Definition: ByteCode.h:133
@ LFT_ADAPTED_REQUEST_HEADER_ELEM
Definition: ByteCode.h:98
@ LFT_SERVER_PORT
Definition: ByteCode.h:63
Definition: parse.c:160
@ LOG_QUOTE_QUOTES
Definition: ByteCode.h:264
@ LFT_ADAPTED_REQUEST_ALL_HEADERS
Definition: ByteCode.h:99
an std::runtime_error with thrower location info
Definition: TextException.h:20
@ LFT_CLIENT_REQ_VERSION
Definition: ByteCode.h:80
@ LOG_QUOTE_MIMEBLOB
Definition: ByteCode.h:265
@ LFT_PROXY_PROTOCOL_RECEIVED_HEADER_ELEM
Definition: ByteCode.h:257
@ LFT_CLIENT_REQ_URLDOMAIN
Definition: ByteCode.h:76
SBuf ToSBuf(Args &&... args)
slowly stream-prints all arguments into a freshly allocated SBuf
Definition: Stream.h:63
@ LFT_CLIENT_LOCAL_NFMARK
Definition: ByteCode.h:49
@ LFT_HTTP_SENT_STATUS_CODE
Definition: ByteCode.h:125
#define DBG_IMPORTANT
Definition: Stream.h:38
@ LFT_TIME_SECONDS_SINCE_EPOCH
Definition: ByteCode.h:159
@ LFT_REQUEST_HEADER_ELEM
Definition: ByteCode.h:93
@ LFT_SSL_SERVER_CERT_WHOLE
Definition: ByteCode.h:228
@ LFT_REQUEST_VERSION_OLD_2X
Definition: ByteCode.h:87
@ LFT_SERVER_REQ_METHOD
Definition: ByteCode.h:102
@ LFT_CLIENT_IO_SIZE_TOTAL
Definition: ByteCode.h:148
@ LFT_SSL_BUMP_MODE
Definition: ByteCode.h:221
@ LFT_PERCENT
Definition: ByteCode.h:240
@ LFT_BYTE
Definition: ByteCode.h:36
@ LFT_CLIENT_REQ_URLPORT
Definition: ByteCode.h:77
@ LFT_REPLY_HEADER_ELEM
Definition: ByteCode.h:132
@ LFT_HTTP_RECEIVED_STATUS_CODE
Definition: ByteCode.h:126
@ LFT_NONE
Definition: ByteCode.h:31
@ LFT_SSL_CLIENT_SNI
Definition: ByteCode.h:224
@ LFT_CLIENT_HANDSHAKE
Definition: ByteCode.h:53
@ LFT_NOTE
Definition: ByteCode.h:239
@ LFT_CREDENTIALS
Definition: ByteCode.h:218
@ LFT_SERVER_REQ_URI
Definition: ByteCode.h:103
void registerTokens(const SBuf &nsName, TokenTableEntry const *tokenArray)
Definition: Config.cc:17
@ LFT_ICAP_REQUEST_URI
Definition: ByteCode.h:199
@ LFT_TIME_SUBSECOND
Definition: ByteCode.h:160
@ LFT_SSL_SERVER_CERT_SUBJECT
Definition: ByteCode.h:225
@ LFT_ICAP_ADDR
Definition: ByteCode.h:197
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Stream.h:192
const A & min(A const &lhs, A const &rhs)
@ LFT_CLIENT_LOCAL_TOS
Definition: ByteCode.h:48
@ LFT_SERVER_FQDN_OR_PEER_NAME
Definition: ByteCode.h:62
@ LFT_LOCAL_LISTENING_PORT
Definition: ByteCode.h:57
@ LFT_EXT_ACL_CLIENT_EUI48
Definition: ByteCode.h:250
@ LFT_ICAP_BYTES_SENT
Definition: ByteCode.h:201
class SquidConfig Config
Definition: SquidConfig.cc:12
Quoting
Quoting style for a format output.
Definition: ByteCode.h:262
@ LFT_SQUID_HIERARCHY
Definition: ByteCode.h:176

 

Introduction

Documentation

Support

Miscellaneous