]> err.no Git - varnish/commit
Add an API for synthetic objects, and use it to implement negative
authordes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 25 May 2007 10:00:38 +0000 (10:00 +0000)
committerdes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 25 May 2007 10:00:38 +0000 (10:00 +0000)
commit85ae04d4391b748e39a855042f2a7aec2a6dae7f
treef2ed6e3eb0f31140aa2e16bc876f61667985dd4e
parent34cdfd0495da047f636f425d969ab19a356d4962
Add an API for synthetic objects, and use it to implement negative
caching of backend issues.

Brief summary:

 - moved http_msg array from cache_response.c to cache_http.c,
   introduced http_StatusMessage() lookup function

 - introduced http_Put{Protocol,Status,Response} to complement
   http_PrintfHeader().

 - introduced SYN_ErrorPage() in a new file, cache_synthetic.c.
   SYN_ErrorPage() populates the session's current object with the
   specified error code and a corresponding HTML error page; it is the
   caller's responsibility to ensure that the session has a suitable
   object (i.e. one that doesn't already have headers or a body)

 - rewrote RES_Error() to simply call SYN_ErrorPage() (with ttl = 0) and
   RES_WriteObj().

 - rewrote cnt_fetch() to use SYN_ErrorPage() to create a 503 page with
   a TTL of 30 seconds when Fetch() fails.

 - removed the call to RES_Error() in cache_backend.c; the error
   trickles back up to cnt_fetch() anyway.

Comments from review:

 - Memory allocation and pointer gymnastics for the header and body
   are duplicated all over the place (in new and pre-existing code)
   and should be centralized and hidden behind a suitable API.

 - The http_*() API needs refactoring, we shouldn't need four
   different functions to manipulate four different entries in the
   same array.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1474 d4fa192b-c00b-0410-8231-f00ffab90ce4
varnish-cache/bin/varnishd/Makefile.am
varnish-cache/bin/varnishd/cache.h
varnish-cache/bin/varnishd/cache_backend.c
varnish-cache/bin/varnishd/cache_center.c
varnish-cache/bin/varnishd/cache_http.c
varnish-cache/bin/varnishd/cache_response.c
varnish-cache/bin/varnishd/cache_synthetic.c [new file with mode: 0644]