mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-24 12:20:59 +01:00
[MINOR] halog: make SKIP_CHAR stop on field delimiters
The SKIP_CHAR() macro did not consider field delimiters, causing the timer parser to be able to search timers at wrong places when fed with TCP logs.
This commit is contained in:
parent
812e7a73b2
commit
c82570edec
@ -36,7 +36,13 @@
|
|||||||
#define MAXLINE 16384
|
#define MAXLINE 16384
|
||||||
#define QBITS 4
|
#define QBITS 4
|
||||||
|
|
||||||
#define SKIP_CHAR(p,c) do { while (1) if (!*p) break; else if (*(p++) == c) break; } while (0)
|
const char sep[256] = {
|
||||||
|
[0] = 1,
|
||||||
|
[' '] = 1, ['\t'] = 1,
|
||||||
|
['\r'] = 1, ['\n'] = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
#define SKIP_CHAR(p,c) do { while (1) if (sep[(unsigned char)*p]) break; else if (*(p++) == c) break; } while (0)
|
||||||
|
|
||||||
/* [0] = err/date, [1] = req, [2] = conn, [3] = resp, [4] = data */
|
/* [0] = err/date, [1] = req, [2] = conn, [3] = resp, [4] = data */
|
||||||
static struct eb_root timers[5] = {
|
static struct eb_root timers[5] = {
|
||||||
@ -507,7 +513,7 @@ int main(int argc, char **argv)
|
|||||||
p = b;
|
p = b;
|
||||||
err = 0;
|
err = 0;
|
||||||
f = 0;
|
f = 0;
|
||||||
while (*p) {
|
while (!sep[(unsigned char)*p]) {
|
||||||
tps = str2ic(p);
|
tps = str2ic(p);
|
||||||
if (tps < 0) {
|
if (tps < 0) {
|
||||||
tps = -1;
|
tps = -1;
|
||||||
@ -580,7 +586,7 @@ int main(int argc, char **argv)
|
|||||||
p = b;
|
p = b;
|
||||||
err = 0;
|
err = 0;
|
||||||
f = 0;
|
f = 0;
|
||||||
while (*p) {
|
while (!sep[(unsigned char)*p]) {
|
||||||
array[f] = str2ic(p);
|
array[f] = str2ic(p);
|
||||||
if (array[f] < 0) {
|
if (array[f] < 0) {
|
||||||
array[f] = -1;
|
array[f] = -1;
|
||||||
@ -745,7 +751,7 @@ int main(int argc, char **argv)
|
|||||||
p = b;
|
p = b;
|
||||||
err = 0;
|
err = 0;
|
||||||
f = 0;
|
f = 0;
|
||||||
while (*p) {
|
while (!sep[(unsigned char)*p]) {
|
||||||
array[f] = str2ic(p);
|
array[f] = str2ic(p);
|
||||||
if (array[f] < 0) {
|
if (array[f] < 0) {
|
||||||
array[f] = -1;
|
array[f] = -1;
|
||||||
@ -813,7 +819,7 @@ int main(int argc, char **argv)
|
|||||||
* parse the 5 timers to detect errors, it takes avg 55 ns per line.
|
* parse the 5 timers to detect errors, it takes avg 55 ns per line.
|
||||||
*/
|
*/
|
||||||
e = b; err = 0; f = 0;
|
e = b; err = 0; f = 0;
|
||||||
while (*e) {
|
while (!sep[(unsigned char)*e]) {
|
||||||
array[f] = str2ic(e);
|
array[f] = str2ic(e);
|
||||||
if (array[f] < 0) {
|
if (array[f] < 0) {
|
||||||
array[f] = -1;
|
array[f] = -1;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user