You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Brian Pane <bp...@pacbell.net> on 2001/12/14 17:53:37 UTC

[PATCH] suppress last-modified on subrequests

This is what I'm planning to commit next week to keep
mod_include subrequests from generating a last-modified
timestamp.  But if anybody has major objections (e.g.,
because this will clash with other subrequest handling
changes in progress), please let me know.

Thanks,
--Brian


Index: server/protocol.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/protocol.c,v
retrieving revision 1.61
diff -u -r1.61 protocol.c
--- server/protocol.c    2001/12/13 16:41:43    1.61
+++ server/protocol.c    2001/12/14 16:44:23
@@ -1267,10 +1267,14 @@
  */
 AP_DECLARE(void) ap_set_last_modified(request_rec *r)
 {
-    apr_time_t mod_time = ap_rationalize_mtime(r, r->mtime);
-    char *datestr = apr_palloc(r->pool, APR_RFC822_DATE_LEN);
-    apr_rfc822_date(datestr, mod_time);
-    apr_table_setn(r->headers_out, "Last-Modified", datestr);
+    apr_time_t mod_time;
+    char *datestr;
+    if (!r->assbackwards) {
+        mod_time = ap_rationalize_mtime(r, r->mtime);
+        datestr = apr_palloc(r->pool, APR_RFC822_DATE_LEN);
+        apr_rfc822_date(datestr, mod_time);
+        apr_table_setn(r->headers_out, "Last-Modified", datestr);
+    }
 }
 
 AP_IMPLEMENT_HOOK_RUN_ALL(int,post_read_request,



Re: [PATCH] suppress last-modified on subrequests

Posted by Brian Pane <br...@cnet.com>.
Justin Erenkrantz wrote:

>On Fri, Dec 14, 2001 at 10:20:59AM -0800, Brian Pane wrote:
>
>>>You mean !r->main right?  assbackwards is for HTTP/0.9, IIRC.  
>>>
>>It's also set for subrequests, though
>>
>
>Why wouldn't we want it to be !r->main?  Isn't that the best way
>to check for subrequests?  I'm missing something here.  -- justin
>

I think either would work.  The conditional that I'm trying to
implement is: "if (we should be setting a response header)".
Using "if (!r->assbackwards)" just seems like a more direct
approximation of that than "if (!r->main)".

--Brian




Re: [PATCH] suppress last-modified on subrequests

Posted by Justin Erenkrantz <je...@ebuilt.com>.
On Fri, Dec 14, 2001 at 10:20:59AM -0800, Brian Pane wrote:
> >You mean !r->main right?  assbackwards is for HTTP/0.9, IIRC.  
> >
> 
> It's also set for subrequests, though

Why wouldn't we want it to be !r->main?  Isn't that the best way
to check for subrequests?  I'm missing something here.  -- justin


Re: [PATCH] suppress last-modified on subrequests

Posted by Brian Pane <br...@cnet.com>.
Justin Erenkrantz wrote:

...

>>AP_DECLARE(void) ap_set_last_modified(request_rec *r)
>>{
>>-    apr_time_t mod_time = ap_rationalize_mtime(r, r->mtime);
>>-    char *datestr = apr_palloc(r->pool, APR_RFC822_DATE_LEN);
>>-    apr_rfc822_date(datestr, mod_time);
>>-    apr_table_setn(r->headers_out, "Last-Modified", datestr);
>>+    apr_time_t mod_time;
>>+    char *datestr;
>>+    if (!r->assbackwards) {
>>+        mod_time = ap_rationalize_mtime(r, r->mtime);
>>+        datestr = apr_palloc(r->pool, APR_RFC822_DATE_LEN);
>>+        apr_rfc822_date(datestr, mod_time);
>>+        apr_table_setn(r->headers_out, "Last-Modified", datestr);
>>+    }
>>}
>>
>
>You mean !r->main right?  assbackwards is for HTTP/0.9, IIRC.  
>

It's also set for subrequests, though

--Brian



Re: [PATCH] suppress last-modified on subrequests

Posted by Justin Erenkrantz <je...@ebuilt.com>.
On Fri, Dec 14, 2001 at 08:53:37AM -0800, Brian Pane wrote:
> Index: server/protocol.c
> ===================================================================
> RCS file: /home/cvs/httpd-2.0/server/protocol.c,v
> retrieving revision 1.61
> diff -u -r1.61 protocol.c
> --- server/protocol.c    2001/12/13 16:41:43    1.61
> +++ server/protocol.c    2001/12/14 16:44:23
> @@ -1267,10 +1267,14 @@
>  */
> AP_DECLARE(void) ap_set_last_modified(request_rec *r)
> {
> -    apr_time_t mod_time = ap_rationalize_mtime(r, r->mtime);
> -    char *datestr = apr_palloc(r->pool, APR_RFC822_DATE_LEN);
> -    apr_rfc822_date(datestr, mod_time);
> -    apr_table_setn(r->headers_out, "Last-Modified", datestr);
> +    apr_time_t mod_time;
> +    char *datestr;
> +    if (!r->assbackwards) {
> +        mod_time = ap_rationalize_mtime(r, r->mtime);
> +        datestr = apr_palloc(r->pool, APR_RFC822_DATE_LEN);
> +        apr_rfc822_date(datestr, mod_time);
> +        apr_table_setn(r->headers_out, "Last-Modified", datestr);
> +    }
> }

You mean !r->main right?  assbackwards is for HTTP/0.9, IIRC.  
-- justin