You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Justin Erenkrantz <je...@ebuilt.com> on 2001/06/05 08:43:00 UTC

[PATCH] Remove ap_parseHTTPdate

This is the httpd-2.0 companion patch for the date functions that have
already been moved to apr-util.

You'll also need to place the following files in the Attic:
include/util_date.h
server/util_date.c
test/test_date.c

The summary for those who might need to update modules:

ap_parseHTTPdate -> apr_parseHTTPdate
BAD_DATE -> APR_DATE_BAD

Compiles and runs fine here.  Let me know if you run into any 
problems.  -- justin

Index: modules/http/http_protocol.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/http/http_protocol.c,v
retrieving revision 1.321
diff -u -r1.321 http_protocol.c
--- modules/http/http_protocol.c	2001/05/17 18:04:18	1.321
+++ modules/http/http_protocol.c	2001/06/05 06:35:37
@@ -86,7 +86,7 @@
 #include "http_vhost.h"
 #include "http_log.h"           /* For errors detected in basic auth common
                                  * support code... */
-#include "util_date.h"          /* For parseHTTPdate and BAD_DATE */
+#include "apr_date.h"          /* For apr_parseHTTPdate and APR_DATE_BAD */
 #include "util_charset.h"
 #include "util_ebcdic.h"
 
@@ -235,9 +235,9 @@
          */
         if_unmodified = apr_table_get(r->headers_in, "If-Unmodified-Since");
         if (if_unmodified != NULL) {
-            apr_time_t ius = ap_parseHTTPdate(if_unmodified);
+            apr_time_t ius = apr_parseHTTPdate(if_unmodified);
 
-            if ((ius != BAD_DATE) && (mtime > ius)) {
+            if ((ius != APR_DATE_BAD) && (mtime > ius)) {
                 return HTTP_PRECONDITION_FAILED;
             }
         }
@@ -290,7 +290,7 @@
              && ((if_modified_since =
                   apr_table_get(r->headers_in,
 				"If-Modified-Since")) != NULL)) {
-        apr_time_t ims = ap_parseHTTPdate(if_modified_since);
+        apr_time_t ims = apr_parseHTTPdate(if_modified_since);
 
 	if ((ims >= mtime) && (ims <= r->request_time)) {
             return HTTP_NOT_MODIFIED;
Index: server/Makefile.in
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/Makefile.in,v
retrieving revision 1.45
diff -u -r1.45 Makefile.in
--- server/Makefile.in	2001/05/22 01:35:52	1.45
+++ server/Makefile.in	2001/06/05 06:35:45
@@ -9,7 +9,7 @@
 LTLIBRARY_NAME    = libmain.la
 LTLIBRARY_SOURCES = \
     test_char.h \
-	config.c log.c main.c vhost.c util.c util_date.c \
+	config.c log.c main.c vhost.c util.c \
 	util_script.c util_md5.c util_cfgtree.c util_ebcdic.c \
 	rfc1413.c connection.c listen.c \
         mpm_common.c util_charset.c util_debug.c util_xml.c \
Index: server/protocol.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/protocol.c,v
retrieving revision 1.22
diff -u -r1.22 protocol.c
--- server/protocol.c	2001/05/22 01:31:11	1.22
+++ server/protocol.c	2001/06/05 06:35:45
@@ -86,7 +86,6 @@
 #include "http_vhost.h"
 #include "http_log.h"           /* For errors detected in basic auth common
                                  * support code... */
-#include "util_date.h"          /* For parseHTTPdate and BAD_DATE */
 #include "util_charset.h"
 #include "util_ebcdic.h"
 
Index: server/util_script.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/util_script.c,v
retrieving revision 1.57
diff -u -r1.57 util_script.c
--- server/util_script.c	2001/05/08 20:55:23	1.57
+++ server/util_script.c	2001/06/05 06:35:45
@@ -77,7 +77,7 @@
 #include "http_protocol.h"
 #include "http_request.h"	/* for sub_req_lookup_uri() */
 #include "util_script.h"
-#include "util_date.h"		/* For parseHTTPdate() */
+#include "apr_date.h"		/* For apr_parseHTTPdate() */
 #include "util_ebcdic.h"
 
 #ifdef OS2
@@ -546,7 +546,7 @@
 	 * pass it on blindly because of restrictions on future values.
 	 */
 	else if (!strcasecmp(w, "Last-Modified")) {
-	    ap_update_mtime(r, ap_parseHTTPdate(l));
+	    ap_update_mtime(r, apr_parseHTTPdate(l));
 	    ap_set_last_modified(r);
 	}
 	else if (!strcasecmp(w, "Set-Cookie")) {


Re: [PATCH] Remove ap_parseHTTPdate and rename it.

Posted by Jeff Trawick <tr...@bellsouth.net>.
Cliff Woolley <cl...@yahoo.com> writes:

> I was going to commit it yesterday and then realized it'd break Win32
> (again).  I could kind of guess at which lines to remove from the .DSP
> files, but obviously that's not my area of expertise.  So if you want to
> do it instead, I'd be grateful.  =-)

I haven't broken Win32 in the last few days... what the heck...

-- 
Jeff Trawick | trawickj@bellsouth.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...


Re: [PATCH] Remove ap_parseHTTPdate and rename it.

Posted by Cliff Woolley <cl...@yahoo.com>.
On 6 Jun 2001, Jeff Trawick wrote:

> Justin Erenkrantz <je...@ebuilt.com> writes:
>
> > On Wed, Jun 06, 2001 at 09:30:01AM -0400, Jeff Trawick wrote:
> > > Justin Erenkrantz <je...@ebuilt.com> writes:
> > >
> > > Tell me again what happens to ap_checkmask()?  It looks like proxy
> > > uses it.  sorry if this is a faq, but I don't see relevant discussion
> > > on new-httpd...
> >
> > It's already in apr-util as apr_date_checkmask.  What's the
> > question?
>
> the question is the sentence above ending in '?' (which you answered,
> by the way :) )...
>
> I'm happy, I'll commit it...  I simply saw a remaining call to
> ap_checkmask() which the proxy folks will have to clean up... it
> wasn't immediately obvious to me what they would replace the call
> with, but now I know.

I was going to commit it yesterday and then realized it'd break Win32
(again).  I could kind of guess at which lines to remove from the .DSP
files, but obviously that's not my area of expertise.  So if you want to
do it instead, I'd be grateful.  =-)

--Cliff


--------------------------------------------------------------
   Cliff Woolley
   cliffwoolley@yahoo.com
   Charlottesville, VA



Re: [PATCH] Remove ap_parseHTTPdate and rename it.

Posted by Jeff Trawick <tr...@bellsouth.net>.
Justin Erenkrantz <je...@ebuilt.com> writes:

> On Wed, Jun 06, 2001 at 09:30:01AM -0400, Jeff Trawick wrote:
> > Justin Erenkrantz <je...@ebuilt.com> writes:
> > 
> > Tell me again what happens to ap_checkmask()?  It looks like proxy
> > uses it.  sorry if this is a faq, but I don't see relevant discussion
> > on new-httpd...
> 
> It's already in apr-util as apr_date_checkmask.  What's the
> question?

the question is the sentence above ending in '?' (which you answered,
by the way :) )...

I'm happy, I'll commit it...  I simply saw a remaining call to
ap_checkmask() which the proxy folks will have to clean up... it
wasn't immediately obvious to me what they would replace the call
with, but now I know.

Thanks,

-- 
Jeff Trawick | trawickj@bellsouth.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...


Re: [PATCH] Remove ap_parseHTTPdate and rename it.

Posted by Justin Erenkrantz <je...@ebuilt.com>.
On Wed, Jun 06, 2001 at 09:30:01AM -0400, Jeff Trawick wrote:
> Justin Erenkrantz <je...@ebuilt.com> writes:
> 
> Tell me again what happens to ap_checkmask()?  It looks like proxy
> uses it.  sorry if this is a faq, but I don't see relevant discussion
> on new-httpd...

It's already in apr-util as apr_date_checkmask.  What's the question?
-- justin


Re: [PATCH] Remove ap_parseHTTPdate and rename it.

Posted by Jeff Trawick <tr...@bellsouth.net>.
Justin Erenkrantz <je...@ebuilt.com> writes:

> With Dean's suggestion to rename.  The relevant stuff is already
> committed into APR.  -- justin

Tell me again what happens to ap_checkmask()?  It looks like proxy
uses it.  sorry if this is a faq, but I don't see relevant discussion
on new-httpd...

-- 
Jeff Trawick | trawickj@bellsouth.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...


[PATCH] Remove ap_parseHTTPdate and rename it.

Posted by Justin Erenkrantz <je...@ebuilt.com>.
With Dean's suggestion to rename.  The relevant stuff is already
committed into APR.  -- justin

Index: modules/http/http_protocol.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/http/http_protocol.c,v
retrieving revision 1.321
diff -u -r1.321 http_protocol.c
--- modules/http/http_protocol.c	2001/05/17 18:04:18	1.321
+++ modules/http/http_protocol.c	2001/06/05 06:35:37
@@ -86,7 +86,7 @@
 #include "http_vhost.h"
 #include "http_log.h"           /* For errors detected in basic auth common
                                  * support code... */
-#include "util_date.h"          /* For parseHTTPdate and BAD_DATE */
+#include "apr_date.h"           /* For apr_date_parse_http and APR_DATE_BAD */
 #include "util_charset.h"
 #include "util_ebcdic.h"
 
@@ -235,9 +235,9 @@
          */
         if_unmodified = apr_table_get(r->headers_in, "If-Unmodified-Since");
         if (if_unmodified != NULL) {
-            apr_time_t ius = ap_parseHTTPdate(if_unmodified);
+            apr_time_t ius = apr_date_parse_http(if_unmodified);
 
-            if ((ius != BAD_DATE) && (mtime > ius)) {
+            if ((ius != APR_DATE_BAD) && (mtime > ius)) {
                 return HTTP_PRECONDITION_FAILED;
             }
         }
@@ -290,7 +290,7 @@
              && ((if_modified_since =
                   apr_table_get(r->headers_in,
 				"If-Modified-Since")) != NULL)) {
-        apr_time_t ims = ap_parseHTTPdate(if_modified_since);
+        apr_time_t ims = apr_date_parse_http(if_modified_since);
 
 	if ((ims >= mtime) && (ims <= r->request_time)) {
             return HTTP_NOT_MODIFIED;
Index: server/Makefile.in
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/Makefile.in,v
retrieving revision 1.45
diff -u -r1.45 Makefile.in
--- server/Makefile.in	2001/05/22 01:35:52	1.45
+++ server/Makefile.in	2001/06/05 06:35:45
@@ -9,7 +9,7 @@
 LTLIBRARY_NAME    = libmain.la
 LTLIBRARY_SOURCES = \
     test_char.h \
-	config.c log.c main.c vhost.c util.c util_date.c \
+	config.c log.c main.c vhost.c util.c \
 	util_script.c util_md5.c util_cfgtree.c util_ebcdic.c \
 	rfc1413.c connection.c listen.c \
         mpm_common.c util_charset.c util_debug.c util_xml.c \
Index: server/protocol.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/protocol.c,v
retrieving revision 1.22
diff -u -r1.22 protocol.c
--- server/protocol.c	2001/05/22 01:31:11	1.22
+++ server/protocol.c	2001/06/05 06:35:45
@@ -86,7 +86,6 @@
 #include "http_vhost.h"
 #include "http_log.h"           /* For errors detected in basic auth common
                                  * support code... */
-#include "util_date.h"          /* For parseHTTPdate and BAD_DATE */
 #include "util_charset.h"
 #include "util_ebcdic.h"
 
Index: server/util_script.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/util_script.c,v
retrieving revision 1.57
diff -u -r1.57 util_script.c
--- server/util_script.c	2001/05/08 20:55:23	1.57
+++ server/util_script.c	2001/06/05 06:35:45
@@ -77,7 +77,7 @@
 #include "http_protocol.h"
 #include "http_request.h"	/* for sub_req_lookup_uri() */
 #include "util_script.h"
-#include "util_date.h"		/* For parseHTTPdate() */
+#include "apr_date.h"		/* For apr_date_parse_http() */
 #include "util_ebcdic.h"
 
 #ifdef OS2
@@ -546,7 +546,7 @@
 	 * pass it on blindly because of restrictions on future values.
 	 */
 	else if (!strcasecmp(w, "Last-Modified")) {
-	    ap_update_mtime(r, ap_parseHTTPdate(l));
+	    ap_update_mtime(r, apr_date_parse_http(l));
 	    ap_set_last_modified(r);
 	}
 	else if (!strcasecmp(w, "Set-Cookie")) {


Re: [PATCH] Remove ap_parseHTTPdate

Posted by Justin Erenkrantz <je...@ebuilt.com>.
On Tue, Jun 05, 2001 at 04:15:29PM -0400, Cliff Woolley wrote:
> On Tue, 5 Jun 2001, dean gaudet wrote:
> 
> > this would seem like an OK time to change the function name to something
> > more in line with other names in ap/apr... such as ap_parse_http_date.
> > (but include a comment indicating the old name somewhere so it's easy to
> > find for those of us who grok foreign programs by doing recursive greps :)
> 
> apr_date_http_parse should be in line with the current standard, I think.
> And yes, it should probably go in apu_compat.h or whatever.

Good point.  I'm going to do:

apr_date_parse_http
apr_date_parse_rfc
apr_date_checkmask

I'll commit into apr and then I'll repost my patch to new-httpd.
-- justin


Re: [PATCH] Remove ap_parseHTTPdate

Posted by Justin Erenkrantz <je...@ebuilt.com>.
On Tue, Jun 05, 2001 at 04:15:29PM -0400, Cliff Woolley wrote:
> On Tue, 5 Jun 2001, dean gaudet wrote:
> 
> > this would seem like an OK time to change the function name to something
> > more in line with other names in ap/apr... such as ap_parse_http_date.
> > (but include a comment indicating the old name somewhere so it's easy to
> > find for those of us who grok foreign programs by doing recursive greps :)
> 
> apr_date_http_parse should be in line with the current standard, I think.
> And yes, it should probably go in apu_compat.h or whatever.

Good point.  I'm going to do:

apr_date_parse_http
apr_date_parse_rfc
apr_date_checkmask

I'll commit into apr and then I'll repost my patch to new-httpd.
-- justin


Re: [PATCH] Remove ap_parseHTTPdate

Posted by Cliff Woolley <cl...@yahoo.com>.
On Tue, 5 Jun 2001, dean gaudet wrote:

> this would seem like an OK time to change the function name to something
> more in line with other names in ap/apr... such as ap_parse_http_date.
> (but include a comment indicating the old name somewhere so it's easy to
> find for those of us who grok foreign programs by doing recursive greps :)

apr_date_http_parse should be in line with the current standard, I think.
And yes, it should probably go in apu_compat.h or whatever.

--Cliff

--------------------------------------------------------------
   Cliff Woolley
   cliffwoolley@yahoo.com
   Charlottesville, VA



Re: [PATCH] Remove ap_parseHTTPdate

Posted by dean gaudet <dg...@arctic.org>.
this would seem like an OK time to change the function name to something
more in line with other names in ap/apr... such as ap_parse_http_date.
(but include a comment indicating the old name somewhere so it's easy to
find for those of us who grok foreign programs by doing recursive greps :)

-dean

On Mon, 4 Jun 2001, Justin Erenkrantz wrote:

> This is the httpd-2.0 companion patch for the date functions that have
> already been moved to apr-util.
>
> You'll also need to place the following files in the Attic:
> include/util_date.h
> server/util_date.c
> test/test_date.c
>
> The summary for those who might need to update modules:
>
> ap_parseHTTPdate -> apr_parseHTTPdate
> BAD_DATE -> APR_DATE_BAD
>
> Compiles and runs fine here.  Let me know if you run into any
> problems.  -- justin
>
> Index: modules/http/http_protocol.c
> ===================================================================
> RCS file: /home/cvspublic/httpd-2.0/modules/http/http_protocol.c,v
> retrieving revision 1.321
> diff -u -r1.321 http_protocol.c
> --- modules/http/http_protocol.c	2001/05/17 18:04:18	1.321
> +++ modules/http/http_protocol.c	2001/06/05 06:35:37
> @@ -86,7 +86,7 @@
>  #include "http_vhost.h"
>  #include "http_log.h"           /* For errors detected in basic auth common
>                                   * support code... */
> -#include "util_date.h"          /* For parseHTTPdate and BAD_DATE */
> +#include "apr_date.h"          /* For apr_parseHTTPdate and APR_DATE_BAD */
>  #include "util_charset.h"
>  #include "util_ebcdic.h"
>
> @@ -235,9 +235,9 @@
>           */
>          if_unmodified = apr_table_get(r->headers_in, "If-Unmodified-Since");
>          if (if_unmodified != NULL) {
> -            apr_time_t ius = ap_parseHTTPdate(if_unmodified);
> +            apr_time_t ius = apr_parseHTTPdate(if_unmodified);
>
> -            if ((ius != BAD_DATE) && (mtime > ius)) {
> +            if ((ius != APR_DATE_BAD) && (mtime > ius)) {
>                  return HTTP_PRECONDITION_FAILED;
>              }
>          }
> @@ -290,7 +290,7 @@
>               && ((if_modified_since =
>                    apr_table_get(r->headers_in,
>  				"If-Modified-Since")) != NULL)) {
> -        apr_time_t ims = ap_parseHTTPdate(if_modified_since);
> +        apr_time_t ims = apr_parseHTTPdate(if_modified_since);
>
>  	if ((ims >= mtime) && (ims <= r->request_time)) {
>              return HTTP_NOT_MODIFIED;
> Index: server/Makefile.in
> ===================================================================
> RCS file: /home/cvspublic/httpd-2.0/server/Makefile.in,v
> retrieving revision 1.45
> diff -u -r1.45 Makefile.in
> --- server/Makefile.in	2001/05/22 01:35:52	1.45
> +++ server/Makefile.in	2001/06/05 06:35:45
> @@ -9,7 +9,7 @@
>  LTLIBRARY_NAME    = libmain.la
>  LTLIBRARY_SOURCES = \
>      test_char.h \
> -	config.c log.c main.c vhost.c util.c util_date.c \
> +	config.c log.c main.c vhost.c util.c \
>  	util_script.c util_md5.c util_cfgtree.c util_ebcdic.c \
>  	rfc1413.c connection.c listen.c \
>          mpm_common.c util_charset.c util_debug.c util_xml.c \
> Index: server/protocol.c
> ===================================================================
> RCS file: /home/cvspublic/httpd-2.0/server/protocol.c,v
> retrieving revision 1.22
> diff -u -r1.22 protocol.c
> --- server/protocol.c	2001/05/22 01:31:11	1.22
> +++ server/protocol.c	2001/06/05 06:35:45
> @@ -86,7 +86,6 @@
>  #include "http_vhost.h"
>  #include "http_log.h"           /* For errors detected in basic auth common
>                                   * support code... */
> -#include "util_date.h"          /* For parseHTTPdate and BAD_DATE */
>  #include "util_charset.h"
>  #include "util_ebcdic.h"
>
> Index: server/util_script.c
> ===================================================================
> RCS file: /home/cvspublic/httpd-2.0/server/util_script.c,v
> retrieving revision 1.57
> diff -u -r1.57 util_script.c
> --- server/util_script.c	2001/05/08 20:55:23	1.57
> +++ server/util_script.c	2001/06/05 06:35:45
> @@ -77,7 +77,7 @@
>  #include "http_protocol.h"
>  #include "http_request.h"	/* for sub_req_lookup_uri() */
>  #include "util_script.h"
> -#include "util_date.h"		/* For parseHTTPdate() */
> +#include "apr_date.h"		/* For apr_parseHTTPdate() */
>  #include "util_ebcdic.h"
>
>  #ifdef OS2
> @@ -546,7 +546,7 @@
>  	 * pass it on blindly because of restrictions on future values.
>  	 */
>  	else if (!strcasecmp(w, "Last-Modified")) {
> -	    ap_update_mtime(r, ap_parseHTTPdate(l));
> +	    ap_update_mtime(r, apr_parseHTTPdate(l));
>  	    ap_set_last_modified(r);
>  	}
>  	else if (!strcasecmp(w, "Set-Cookie")) {
>
>