r2758 - trunk/varnish-cache/bin/varnishd
phk at projects.linpro.no
phk at projects.linpro.no
Sat Jun 21 20:55:13 CEST 2008
Author: phk
Date: 2008-06-21 20:55:13 +0200 (Sat, 21 Jun 2008)
New Revision: 2758
Modified:
trunk/varnish-cache/bin/varnishd/cache_http.c
trunk/varnish-cache/bin/varnishd/rfc2616.c
Log:
NB: some of this commit sneaked into #2757
Fix http_GetHdrField() to use the correct RFC2616 syntax for tokens
and separators.
Fixes ticket #255.
Modified: trunk/varnish-cache/bin/varnishd/cache_http.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_http.c 2008-06-21 18:51:29 UTC (rev 2757)
+++ trunk/varnish-cache/bin/varnishd/cache_http.c 2008-06-21 18:55:13 UTC (rev 2758)
@@ -269,22 +269,25 @@
h++;
continue;
}
+ /* Check for substrings before memcmp() */
if ((h + fl == e || vct_issepctl(h[fl])) &&
!memcmp(h, field, fl)) {
/* got it */
h += fl;
if (ptr != NULL) {
- while (vct_issp(*h))
+ /* Skip whitespace, looking for '=' */
+ while (*h && vct_issp(*h))
h++;
if (*h == '=') {
h++;
- while (vct_issp(*h))
+ while (*h && vct_issp(*h))
h++;
*ptr = h;
}
}
return (1);
}
+ /* Skip token */
while (*h && !vct_issepctl(*h))
h++;
}
Modified: trunk/varnish-cache/bin/varnishd/rfc2616.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/rfc2616.c 2008-06-21 18:51:29 UTC (rev 2757)
+++ trunk/varnish-cache/bin/varnishd/rfc2616.c 2008-06-21 18:55:13 UTC (rev 2758)
@@ -110,9 +110,9 @@
retirement_age = INT_MAX;
u1 = u2 = 0;
- if (http_GetHdrField(hp, H_Cache_Control, "s-maxage", &p) ||
- http_GetHdrField(hp, H_Cache_Control, "max-age", &p)) {
- AN(p);
+ if ((http_GetHdrField(hp, H_Cache_Control, "s-maxage", &p) ||
+ http_GetHdrField(hp, H_Cache_Control, "max-age", &p)) &&
+ p != NULL {
u1 = strtoul(p, NULL, 0);
u2 = 0;
if (http_GetHdr(hp, H_Age, &p)) {
More information about the varnish-commit
mailing list