Package: thttpd Version: 2.25b-11 Severity: wishlist Tags: patch It would be nice to pass the Cache-Control header to spawned CGI processes.
Here is a minimal patch that does just this. -- System Information: Debian Release: 6.0.1 APT prefers stable APT policy: (500, 'stable') Architecture: kfreebsd-amd64 (x86_64) Kernel: kFreeBSD 8.1-1-amd64 Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) Shell: /bin/sh linked to /bin/dash Versions of packages thttpd depends on: ii libc0.1 2.11.2-10 Embedded GNU C Library: Shared lib Versions of packages thttpd recommends: ii logrotate 3.7.8-6 Log rotation utility Versions of packages thttpd suggests: pn thttpd-util <none> (no description available) -- no debconf information
diff -u thttpd-2.25b.orig/libhttpd.c thttpd-2.25b/libhttpd.c --- thttpd-2.25b.orig/libhttpd.c 2011-04-21 12:03:04.000000000 +0200 +++ thttpd-2.25b/libhttpd.c 2011-04-21 12:03:10.000000000 +0200 @@ -1733,6 +1733,7 @@ hc->acceptl = ""; hc->cookie = ""; hc->contenttype = ""; + hc->cachecontrol = ""; hc->reqhost[0] = '\0'; hc->hdrhost = ""; hc->hostdir[0] = '\0'; @@ -2189,6 +2190,12 @@ cp += strspn( cp, " \t" ); hc->contenttype = cp; } + else if ( strncasecmp( buf, "Cache-Control:", 14 ) == 0 ) + { + cp = &buf[14]; + cp += strspn( cp, " \t" ); + hc->cachecontrol = cp; + } else if ( strncasecmp( buf, "Content-Length:", 15 ) == 0 ) { cp = &buf[15]; @@ -2211,7 +2218,6 @@ else if ( strncasecmp( buf, "Accept-Charset:", 15 ) == 0 || strncasecmp( buf, "Accept-Language:", 16 ) == 0 || strncasecmp( buf, "Agent:", 6 ) == 0 || - strncasecmp( buf, "Cache-Control:", 14 ) == 0 || strncasecmp( buf, "Cache-Info:", 11 ) == 0 || strncasecmp( buf, "Charge-To:", 10 ) == 0 || strncasecmp( buf, "Client-IP:", 10 ) == 0 || @@ -3063,6 +3069,8 @@ envp[envn++] = build_env( "HTTP_COOKIE=%s", hc->cookie ); if ( hc->contenttype[0] != '\0' ) envp[envn++] = build_env( "CONTENT_TYPE=%s", hc->contenttype ); + if ( hc->cachecontrol[0] != '\0' ) + envp[envn++] = build_env( "HTTP_CACHE_CONTROL=%s", hc->cachecontrol ); if ( hc->hdrhost[0] != '\0' ) envp[envn++] = build_env( "HTTP_HOST=%s", hc->hdrhost ); if ( hc->contentlength != -1 ) diff -u thttpd-2.25b.orig/libhttpd.h thttpd-2.25b/libhttpd.h --- thttpd-2.25b.orig/libhttpd.h 2011-04-21 12:03:04.000000000 +0200 +++ thttpd-2.25b/libhttpd.h 2011-04-21 12:03:10.000000000 +0200 @@ -114,6 +114,7 @@ char* acceptl; char* cookie; char* contenttype; + char* cachecontrol; char* reqhost; char* hdrhost; char* hostdir;