Commit 744a7f30 by Nils Goroll

when joining the UA string from additional headers, seperate with a space

dont truncate the last character
parent 4dcf6aa8
......@@ -158,20 +158,32 @@ dcs_varnish_classify(dcs_ctx *ctx) {
} while(0);
ua = uabuf;
if (space == 0)
goto nospc;
for (i = 0; i < DCS_VARNISH2_NHDRS; i++) {
r = DCS_GetHdr(ctx, &hdrs[i]);
if (r && *r) {
if (ua_prepend[i])
if (ua_prepend[i]) {
appnd(w, space, ua_prepend[i], l);
} else {
// space==0 will heave left the loop
assert(space > 0);
*w++ = ' ';
w[1] = '\0';
if (--space == 0)
break;
}
appnd(w, space, r, l);
}
}
nospc:
/* ensure the string is always terminated */
if (w == (uabuf + UA_LIMIT))
uabuf[UA_LIMIT] = '\0';
else
w[-1] = '\0';
*w = '\0';
assert(ua == uabuf);
assert(w > uabuf);
......
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