BUG/MEDIUM: logs: fix improper systematic use of quotes with a few tags
Dmitry Sivachenko reported the following build warning using Clang, which
is a real bug :
src/log.c:1538:22: warning: use of logical '&&' with constant operand
[-Wconstant-logical-operand]
if (tmp->options && LOG_OPT_QUOTE)
^ ~~~~~~~~~~~~~
The effect is that recent log tags related to HTTP method, path, uri,
query have a bug making them always use quotes.
This bug was introduced in 1.6-dev2 with commit 0ebc55f
("MEDIUM: logs:
Add HTTP request-line log format directives"), so no backport is needed.
This commit is contained in:
parent
7810ad7d59
commit
b7636d1a10
16
src/log.c
16
src/log.c
|
@ -1535,7 +1535,7 @@ int build_logline(struct stream *s, char *dst, size_t maxsize, struct list *list
|
||||||
case LOG_FMT_HTTP_PATH: // %HP
|
case LOG_FMT_HTTP_PATH: // %HP
|
||||||
uri = txn->uri ? txn->uri : "<BADREQ>";
|
uri = txn->uri ? txn->uri : "<BADREQ>";
|
||||||
|
|
||||||
if (tmp->options && LOG_OPT_QUOTE)
|
if (tmp->options & LOG_OPT_QUOTE)
|
||||||
LOGCHAR('"');
|
LOGCHAR('"');
|
||||||
|
|
||||||
end = uri + strlen(uri);
|
end = uri + strlen(uri);
|
||||||
|
@ -1566,7 +1566,7 @@ int build_logline(struct stream *s, char *dst, size_t maxsize, struct list *list
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
tmplog = ret;
|
tmplog = ret;
|
||||||
if (tmp->options && LOG_OPT_QUOTE)
|
if (tmp->options & LOG_OPT_QUOTE)
|
||||||
LOGCHAR('"');
|
LOGCHAR('"');
|
||||||
|
|
||||||
last_isspace = 0;
|
last_isspace = 0;
|
||||||
|
@ -1575,7 +1575,7 @@ int build_logline(struct stream *s, char *dst, size_t maxsize, struct list *list
|
||||||
case LOG_FMT_HTTP_URI: // %HU
|
case LOG_FMT_HTTP_URI: // %HU
|
||||||
uri = txn->uri ? txn->uri : "<BADREQ>";
|
uri = txn->uri ? txn->uri : "<BADREQ>";
|
||||||
|
|
||||||
if (tmp->options && LOG_OPT_QUOTE)
|
if (tmp->options & LOG_OPT_QUOTE)
|
||||||
LOGCHAR('"');
|
LOGCHAR('"');
|
||||||
|
|
||||||
end = uri + strlen(uri);
|
end = uri + strlen(uri);
|
||||||
|
@ -1606,7 +1606,7 @@ int build_logline(struct stream *s, char *dst, size_t maxsize, struct list *list
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
tmplog = ret;
|
tmplog = ret;
|
||||||
if (tmp->options && LOG_OPT_QUOTE)
|
if (tmp->options & LOG_OPT_QUOTE)
|
||||||
LOGCHAR('"');
|
LOGCHAR('"');
|
||||||
|
|
||||||
last_isspace = 0;
|
last_isspace = 0;
|
||||||
|
@ -1614,7 +1614,7 @@ int build_logline(struct stream *s, char *dst, size_t maxsize, struct list *list
|
||||||
|
|
||||||
case LOG_FMT_HTTP_METHOD: // %HM
|
case LOG_FMT_HTTP_METHOD: // %HM
|
||||||
uri = txn->uri ? txn->uri : "<BADREQ>";
|
uri = txn->uri ? txn->uri : "<BADREQ>";
|
||||||
if (tmp->options && LOG_OPT_QUOTE)
|
if (tmp->options & LOG_OPT_QUOTE)
|
||||||
LOGCHAR('"');
|
LOGCHAR('"');
|
||||||
|
|
||||||
end = uri + strlen(uri);
|
end = uri + strlen(uri);
|
||||||
|
@ -1636,7 +1636,7 @@ int build_logline(struct stream *s, char *dst, size_t maxsize, struct list *list
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
tmplog = ret;
|
tmplog = ret;
|
||||||
if (tmp->options && LOG_OPT_QUOTE)
|
if (tmp->options & LOG_OPT_QUOTE)
|
||||||
LOGCHAR('"');
|
LOGCHAR('"');
|
||||||
|
|
||||||
last_isspace = 0;
|
last_isspace = 0;
|
||||||
|
@ -1644,7 +1644,7 @@ int build_logline(struct stream *s, char *dst, size_t maxsize, struct list *list
|
||||||
|
|
||||||
case LOG_FMT_HTTP_VERSION: // %HV
|
case LOG_FMT_HTTP_VERSION: // %HV
|
||||||
uri = txn->uri ? txn->uri : "<BADREQ>";
|
uri = txn->uri ? txn->uri : "<BADREQ>";
|
||||||
if (tmp->options && LOG_OPT_QUOTE)
|
if (tmp->options & LOG_OPT_QUOTE)
|
||||||
LOGCHAR('"');
|
LOGCHAR('"');
|
||||||
|
|
||||||
end = uri + strlen(uri);
|
end = uri + strlen(uri);
|
||||||
|
@ -1681,7 +1681,7 @@ int build_logline(struct stream *s, char *dst, size_t maxsize, struct list *list
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
tmplog = ret;
|
tmplog = ret;
|
||||||
if (tmp->options && LOG_OPT_QUOTE)
|
if (tmp->options & LOG_OPT_QUOTE)
|
||||||
LOGCHAR('"');
|
LOGCHAR('"');
|
||||||
|
|
||||||
last_isspace = 0;
|
last_isspace = 0;
|
||||||
|
|
Loading…
Reference in New Issue