Commit 2f911fa3 authored by Geoff Simmons's avatar Geoff Simmons

trackrdrd: Fixed off-by-one error in parse.c/Parse_ReqStart

           Mutexing increment of tbl.open after ReqStart
vcl: do not log the URL /ts-rcv
parent ed6f014b
......@@ -103,6 +103,7 @@ MON_StatsUpdate(stats_update_t update)
break;
case STATS_OCCUPANCY:
tbl.open++;
if (tbl.open + tbl.done > tbl.occ_hi)
tbl.occ_hi = tbl.open + tbl.done;
break;
......
......@@ -56,7 +56,7 @@ int
Parse_ReqStart(const char *ptr, int len, unsigned *xid)
{
int i;
for (i = len; ptr[i] != ' '; i--)
for (i = len-1; ptr[i] != ' '; i--)
if (i == 0)
return EINVAL;
return Parse_XID(&ptr[i+1], len-i-1, xid);
......
......@@ -122,6 +122,20 @@ static char
sprintf(errmsg, "ReqStart %s: returned XID=%d", REQSTART, xid);
mu_assert(errmsg, xid == 1253687608);
#define REQSTART2 "127.0.0.1 56431 18217014 "
err = Parse_ReqStart(REQSTART2, strlen(REQSTART2)-1, &xid);
sprintf(errmsg, "ReqStart %s: %s", REQSTART2, strerror(err));
mu_assert(errmsg, err == 0);
sprintf(errmsg, "ReqStart %s: returned XID=%d", REQSTART2, xid);
mu_assert(errmsg, xid == 18217014);
#define REQSTART3 "127.0.0.1 53890 18228551 "
err = Parse_ReqStart(REQSTART3, strlen(REQSTART3)-1, &xid);
sprintf(errmsg, "ReqStart %s: %s", REQSTART3, strerror(err));
mu_assert(errmsg, err == 0);
sprintf(errmsg, "ReqStart %s: returned XID=%d", REQSTART3, xid);
mu_assert(errmsg, xid == 18228551);
err = Parse_ReqStart("1253687608", 10, &xid);
sprintf(errmsg, "ReqStart 1253687608: expected EINVAL, got %d", err);
mu_assert(errmsg, err == EINVAL);
......
......@@ -126,7 +126,7 @@ static inline dataentry
entry->end = strlen(entry->data);
if (entry->end > tbl.data_hi)
tbl.data_hi = entry->end;
tbl.open++;
tbl.seen++;
MON_StatsUpdate(STATS_OCCUPANCY);
return entry;
......@@ -185,7 +185,6 @@ OSL_Track(void *priv, enum VSL_tag_e tag, unsigned fd, unsigned len,
AZ(err);
LOG_Log(LOG_DEBUG, "%s: XID=%d", VSL_tags[tag], xid);
tbl.seen++;
(void) insert(xid, tag, fd);
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment