httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Hartill <r...@imdb.com>
Subject Re: HTTP/1.1 is expiring my content
Date Sat, 21 Sep 1996 12:08:47 GMT

A few days back I wrote:

>I'm using ErrorDocument to implement caching for CGI (well, mod_perl_fast
>now) scripts so that the script only gets run if the cache file needs to
>be generated.
>
>Apache insists on pushing out an Expires header because (I think) it
>originally spotted an error and therefore insists that the output is
>not to be cached by clients. However, my scripts are "recovering" from
>the error and like good little boys they change the status to 200.
>
>Can we (someone else ;-) make ErrorDocuments cacheable if they
>return a 200 ?

I've now looked at fixing this problem. As far as I can gather, "r->no_cache"
is being used to do two jobs. One is to prevent "Not Modified" responses
being returned to the client and the other is to send cache busting
headers to stop the client from caching what it receives.

Those two jobs should (I believe) be separate, and here's a patch than
creates r->no_local_copy to handle the former case..


*** http_request.c.orig	Sat Sep 21 12:25:04 1996
--- http_request.c	Sat Sep 21 13:04:42 1996
***************
*** 713,721 ****
  	    r->status = REDIRECT;
  	    table_set (r->headers_out, "Location", custom_response);
  	} else if ( custom_response[0] == '/') {
! 	    r->no_cache = 1;	/* Do NOT send USE_LOCAL_COPY for
! 				 * error documents!
! 				 */
  	    /* This redirect needs to be a GET no matter what the original
  	     * method was.
  	     */
--- 713,721 ----
  	    r->status = REDIRECT;
  	    table_set (r->headers_out, "Location", custom_response);
  	} else if ( custom_response[0] == '/') {
! 	    r->no_local_copy = 1; /* Do NOT send USE_LOCAL_COPY for
! 				   * error documents!
! 				   */
  	    /* This redirect needs to be a GET no matter what the original
  	     * method was.
  	     */
***************
*** 950,955 ****
--- 950,956 ----
      new->no_cache = r->no_cache; /* If we've already made up our minds
  				  * about this, don't change 'em back!
  				  */
+     new->no_local_copy = r->no_local_copy;
  
      sprintf (t, "%d", r->status);
      table_set (new->subprocess_env, "REDIRECT_STATUS", pstrdup (r->pool, t));
*** httpd.h.orig	Sat Sep 21 12:45:18 1996
--- httpd.h	Sat Sep 21 12:47:04 1996
***************
*** 407,412 ****
--- 407,413 ----
    char *content_language;
    
    int no_cache;
+   int no_local_copy;
    
    /* What object is being requested (either directly, or via include
     * or content-negotiation mapping).
*** http_protocol.c.orig	Sat Sep 21 12:23:04 1996
--- http_protocol.c	Sat Sep 21 12:48:44 1996
***************
*** 360,366 ****
       * not allowing conditional GETs.
       */
  
!     if (r->no_cache) return OK;
  
      /* Check for conditional GETs --- note that we only want this check
       * to succeed if the GET was successful; ErrorDocuments *always* get sent.
--- 360,366 ----
       * not allowing conditional GETs.
       */
  
!     if (r->no_local_copy) return OK;
  
      /* Check for conditional GETs --- note that we only want this check
       * to succeed if the GET was successful; ErrorDocuments *always* get sent.
***************
*** 707,713 ****
  void set_sub_req_protocol (request_rec *rnew, request_rec *r)
  {
      rnew->assbackwards = 1;	/* Don't send headers from this. */
!     rnew->no_cache = 1;		/* Don't try to send USE_LOCAL_COPY for a
  				 * fragment.
  				 */
      rnew->method = "GET"; rnew->method_number = M_GET;
--- 707,713 ----
  void set_sub_req_protocol (request_rec *rnew, request_rec *r)
  {
      rnew->assbackwards = 1;	/* Don't send headers from this. */
!     rnew->no_local_copy = 1;	/* Don't try to send USE_LOCAL_COPY for a
  				 * fragment.
  				 */
      rnew->method = "GET"; rnew->method_number = M_GET;

Mime
View raw message