- From: Rainer Klute <klute@nads.de>
- Date: Wed, 31 May 1995 08:57:33 +0200
- To: frystyk@w3.org
- Cc: Multiple recipients of list <www-talk@www10.w3.org>, "Rainer Klute" <klute@nads.de>
frystyk@w3.org (Henrik Frystyk Nielsen): >Expires headers on 302 codes sounds like a good idea - not on 300! Here's a patch for the CERN server which does just that. See <http://www.nads.de/NADS/Ueberblick/heute> for an example what it is good for. Said URI redirects the requestor to the event diary of *today* of Düsseldorf and about. An Expires header is appended to the redirect response which makes it expire at midnight Düsseldorf time. This patch also enables the proxy to cache URI with parameters, i. e. with a '?' in it. However, this is not well tested and probably buggy. But so far it didn't do any harm. The patch also makes cgiutils to distinguish between its options -expires and -extra. (Hey, what did Ari pin down when he wrote cgiutils? "Written in a terrible hurry just before going to Italy..." Consequence: Never write programs when being in a hurry. Contradiction: Following that rule no programs would ever be written. :-) Best regards Rainer Klute Dipl.-Inform. Rainer Klute NADS - Advertising on nets NADS GmbH Emil-Figge-Str. 80 Tel.: +49 231 9742570 D-44227 Dortmund Fax: +49 231 9742571 <http://www.nads.de/~klute/> --- 1.1 1995/03/24 16:27:57 +++ ./WWW/Daemon/Implementation/HTDaemon.c 1995/03/24 16:34:06 @@ -13,6 +13,7 @@ ** AL Ari Luotonen, CERN ** MD Mark Donszelmann, CERN ** FM Foteos Macrides, WFEB +** RK Rainer Klute <klute@nads.de> ** ** History: ** Sep 91 TBL Made from earlier daemon files. (TBL) @@ -65,6 +66,7 @@ ** defined via "ServerRoot" in the configuration file. ** Commented out dead extern declarations. ** 8 Jul 94 FM Insulate free() from _free structure element. +** 24 Mar 95 RK Cache queries */ /* (c) CERN WorldWideWeb project 1990-1992. See Copyright.html for details */ @@ -1739,7 +1741,7 @@ proxy_access = YES; /* Write to proxy log instead of access log */ HTImServer = HTReqTranslated; - if (cc.cache_root && !req->authorization && !HTReqArgKeywords && + if (cc.cache_root && !req->authorization && (req->method==METHOD_GET || (req->method==METHOD_HEAD && (!strncmp(HTReqTranslated,"ftp:",4) || --- 1.1 1995/03/24 16:25:37 +++ ./WWW/Daemon/Implementation/HTCache.c 1995/03/24 16:39:20 @@ -5,12 +5,15 @@ ** AUTHORS: ** AL Ari Luotonen luotonen@dxcern.cern.ch ** FM Fote Macrides macrides@sci.wfeb.edu +** RK Rainer Klute klute@nads.de ** ** HISTORY: ** 31 Jan 94 AL Written from scratch on a *very* beautiful ** Sunday afternoon -- seems like the spring ** is already coming, yippee! ** 8 Jul 94 FM Insulate free() from _free structure element. +** 24 Mar 95 RK Brought one (!) of the many error messages +** statically in the source (argh!) into HTML ** ** BUGS: ** @@ -248,7 +251,7 @@ BOOL welcome = NO; BOOL res = NO; - if (!url || strchr(url, '?') || (res = reserved_name(url)) || + if (!url || (res = reserved_name(url)) || !(access = HTParse(url, "", PARSE_ACCESS)) || (0 != strcmp(access, "http") && 0 != strcmp(access, "ftp") && @@ -916,7 +919,7 @@ if (ch == LF || me->end >= me->last) { if (me->state == CW_STATUS_LINE) { me->status = get_status(me->buf); - if (me->status != 200 && + if (me->status != 200 && me->status != 302 && (me->status != 304 || !me->if_mod_since)) { me->state = CW_JUNK; buf_dump(me); @@ -932,7 +935,9 @@ me->state = CW_UPDATED; buf_discard(me); } - else if (me->status == 200) { + else if (me->status == 200 || me->status == 302) { + if (me->status == 302) + CTRACE(stderr,"Redirection response from remote\n"); if (figure_out_expires(me)) me->state = CW_COPY_BODY; /* Caching ok */ else @@ -1054,7 +1059,7 @@ { struct stat stat_info; - if (out.status_code == 200 && me->status != 200 && me->status != 304) + if (out.status_code == 200 && me->status != 200 && me->status != 302 && me->status != 304) out.status_code = me->status; if (me->state == CW_COPY_BODY) { --- 1.1 1995/03/24 16:27:57 +++ ./WWW/Daemon/Implementation/cgiutils.c 1995/03/24 16:40:57 @@ -8,10 +8,12 @@ ** ** AUTHORS: ** AL Ari Luotonen luotonen@dxcern.cern.ch +** RK Rainer Klute klute@nads.de ** ** HISTORY: ** 11 Mar 94 AL Written in a terrible hurry just before ** going to Italy... +** 24 Mar 95 RK Bugfix to distinguish between -expires and -extra ** ** BUGS: ** @@ -134,7 +136,7 @@ status = atoi(argv[i+1]); else if (!strncmp(argv[i],"-reason",2)) reason = argv[i+1]; - else if (!strncmp(argv[i],"-expires",2)) + else if (!strncmp(argv[i],"-expires",4)) expires = parse_expiry(argv[i+1]); else if (!strncmp(argv[i],"-location",3)) location = argv[i+1]; @@ -148,7 +150,7 @@ content_language = argv[i+1]; else if (!strncmp(argv[i],"-uri",2)) uri = argv[i+1]; - else if (!strncmp(argv[i],"-extra",2)) { + else if (!strncmp(argv[i],"-extra",4)) { char * buf = (char*)malloc(strlen(argv[i+1]) + 3); sprintf(buf, "%s\r\n", argv[i+1]); StrAllocCat(extras, buf); --- 1.1 1995/03/24 16:27:57 +++ ./WWW/Daemon/Implementation/HTRequest.c 1995/03/24 16:43:14 @@ -5,12 +5,15 @@ ** AUTHORS: ** AL Ari Luotonen luotonen@dxcern.cern.ch ** MD Mark Donszelmann duns@vxdeop.cern.ch +** RK Rainer Klute klute@nads.de ** ** HISTORY: ** 11 Dec 93 AL Written based on the old HTHandle(). ** 8 Jul 94 FM Insulate free() from _free structure element. ** Replaced free() with FREE() is some places where ** the pointer might already have been freed. +** 24 Mar 95 RK Brought one (!) of the many error messages +** statically in the source (argh!) into HTML */ #include <string.h> @@ -484,12 +487,13 @@ /* * Arrgh... ugly! */ - sprintf(body, "%s%s%s%s%s%s%s%s%s", + sprintf(body, "%s%s%s%s%s%s%s%s%s%s", "<HTML>\n<HEAD>\n<TITLE>Redirection</TITLE>\n</HEAD>\n<BODY>\n", - "<H1>Redirection</H1>\nThis document can be found\n<A HREF=\"", + "<H1>Redirection</H1>\n<P>This document can be found\n<A HREF=\"", url, - "\">elsewhere.</A><P>\nYou see this message because your browser ", - "doesn't support automatic\nredirection handeling. <P>\n<HR>\n", + "\">elsewhere.</A></P>\n<P>You see this message because your", + "browser doesn't support automatic redirection handling.</P>\n", + "<HR>\n", "<ADDRESS><A HREF=\"http://info.cern.ch/hypertext/WWW/Daemon/User", "/Guide.html\">\nCERN httpd ", HTAppVersion,
Received on Wednesday, 31 May 1995 02:57:53 UTC