struct http *http_New(void);
void http_Delete(struct http *hp);
int http_GetHdr(struct http *hp, const char *hdr, char **ptr);
+int http_GetStatus(struct http *hp);
int http_HdrIs(struct http *hp, const char *hdr, const char *val);
int http_GetTail(struct http *hp, unsigned len, char **b, char **e);
int http_GetURL(struct http *hp, char **b);
event_base_loop(w->eb, 0);
http_Dissect(hp, fd, 2);
- /* XXX: fill in object from headers */
- sp->obj->valid = 1;
- sp->obj->cacheable = 1;
+ switch (http_GetStatus(hp)) {
+ case 200:
+ /* XXX: fill in object from headers */
+ sp->obj->valid = 1;
+ sp->obj->cacheable = 1;
+ break;
+ case 301:
+ sp->obj->valid = 0;
+ sp->obj->cacheable = 0;
+ break;
+ default:
+ break;
+ }
sp->handling = HND_Insert;
sp->vcl->fetch_func(sp);
return (1);
}
+int
+http_GetStatus(struct http *hp)
+{
+
+ return (strtoul(hp->status, NULL /* XXX */, 10));
+}
+
/*--------------------------------------------------------------------*/
void
sess->done++;
}
-void VCL_error(VCL_FARGS, unsigned err, const char *str) {
+void
+VCL_error(VCL_FARGS, unsigned err, const char *str)
+{
+
+ VSL(SLT_Debug, 0, "VCL_error(%u, %s)", err, str);
}
void