Commit b6e6fe93 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp Committed by Tollef Fog Heen

Use VCT instead of <ctype.h>. Trust HTTP_GetHdr() to remove leading

white space.
parent 22c0814c
...@@ -54,11 +54,11 @@ ...@@ -54,11 +54,11 @@
#include "config.h" #include "config.h"
#include <ctype.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include "cache.h" #include "cache.h"
#include "vct.h"
struct vsb * struct vsb *
VRY_Create(const struct sess *sp, const struct http *hp) VRY_Create(const struct sess *sp, const struct http *hp)
...@@ -86,9 +86,9 @@ VRY_Create(const struct sess *sp, const struct http *hp) ...@@ -86,9 +86,9 @@ VRY_Create(const struct sess *sp, const struct http *hp)
for (p = v; *p; p++) { for (p = v; *p; p++) {
/* Find next header-name */ /* Find next header-name */
if (isspace(*p)) if (vct_issp(*p))
continue; continue;
for (q = p; *q && !isspace(*q) && *q != ','; q++) for (q = p; *q && !vct_issp(*q) && *q != ','; q++)
continue; continue;
/* Build a header-matching string out of it */ /* Build a header-matching string out of it */
...@@ -98,11 +98,10 @@ VRY_Create(const struct sess *sp, const struct http *hp) ...@@ -98,11 +98,10 @@ VRY_Create(const struct sess *sp, const struct http *hp)
AZ(VSB_finish(sbh)); AZ(VSB_finish(sbh));
if (http_GetHdr(sp->http, VSB_data(sbh), &h)) { if (http_GetHdr(sp->http, VSB_data(sbh), &h)) {
/* Trim leading and trailing space */ AZ(vct_issp(*h));
while (isspace(*h)) /* Trim trailing space */
h++;
e = strchr(h, '\0'); e = strchr(h, '\0');
while (e > h && isspace(e[-1])) while (e > h && vct_issp(e[-1]))
e--; e--;
/* Encode two byte length and contents */ /* Encode two byte length and contents */
l = e - h; l = e - h;
...@@ -117,7 +116,7 @@ VRY_Create(const struct sess *sp, const struct http *hp) ...@@ -117,7 +116,7 @@ VRY_Create(const struct sess *sp, const struct http *hp)
if (e != h) if (e != h)
VSB_bcat(sb, h, e - h); VSB_bcat(sb, h, e - h);
while (isspace(*q)) while (vct_issp(*q))
q++; q++;
if (*q == '\0') if (*q == '\0')
break; break;
...@@ -175,11 +174,9 @@ VRY_Match(const struct sess *sp, const uint8_t *vary) ...@@ -175,11 +174,9 @@ VRY_Match(const struct sess *sp, const uint8_t *vary)
if (!i) if (!i)
continue; continue;
/* Trim leading & trailing space */ /* Trim trailing space */
while (isspace(*h))
h++;
e = strchr(h, '\0'); e = strchr(h, '\0');
while (e > h && isspace(e[-1])) while (e > h && vct_issp(e[-1]))
e--; e--;
/* Fail if wrong length */ /* Fail if wrong length */
......
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