You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Malcolm J Harwood <mj...@liminalflux.net> on 2005/03/14 22:00:10 UTC

APR::Date

According to the docs, APR::Date::http parses the format:
	Sun, 06 Nov 1994 08:49:37 GMT
as per RFC 822.
However it does not seem to parse
	Sun, 06 Nov 1994 08:49:37 EST
correctly. It assumes it's GMT regardless of the timezone specified. If I'm 
reading RC822 correctly, this is an error.




-- 
We find comfort among those who agree with us--growth among those who don't.
- Frank A Clark

Re: APR::Date

Posted by Joe Schaefer <jo...@sunstarsys.com>.
Malcolm J Harwood <mj...@liminalflux.net> writes:

> On Wednesday 16 March 2005 11:12 pm, Joe Schaefer wrote:

[...]

>> The RFC is a guideline, not the final arbiter.  This link is exactly
>> what you are looking for:
>
>> http://apr.apache.org/docs/apr-util/group___a_p_r___util___date.html#ga1
>
> Except that link mirrors the current mod_perl documentation, and
> doesn't mention  RFC 2616 (and the GMT-only requirement) either. So
> if the mod_perl doc is incorrect (or at least incomplete) so is that.

Exactly, by having a reference to libaprutil in our docs,
you now know where to send your documentation patch so 
it'll be of maximum benefit.

-- 
Joe Schaefer


Re: APR::Date

Posted by Malcolm J Harwood <mj...@liminalflux.net>.
On Wednesday 16 March 2005 11:12 pm, Joe Schaefer wrote:

> > How about simply correcting the parse_http docs from:
> > 	The date string can be in one of the following formats:
> > to:
> > 	The date string can be in one of the following formats (as per RFC2616):
> >
> > That way anyone interested can look up the correct RFC if they want the
> > gory details.
> The RFC is a guideline, not the final arbiter.  This link is exactly
> what you are looking for:

> http://apr.apache.org/docs/apr-util/group___a_p_r___util___date.html#ga1

Except that link mirrors the current mod_perl documentation, and doesn't 
mention  RFC 2616 (and the GMT-only requirement) either. So if the mod_perl 
doc is incorrect (or at least incomplete) so is that.

Re: APR::Date

Posted by Joe Schaefer <jo...@sunstarsys.com>.
Malcolm J Harwood <mj...@liminalflux.net> writes:

[...]

> The current doc says:
> 	# parse RFC822-complient date string
>
> Which it doesn't (as RFC822 includes multiple timezones).

Which is *exactly* why I recommended the docs include a pointer to 
aprutil.  All modperl does it wrap the C function; it provides
no guarantees about the behavior itself (other than what's in 
the test suite), so it doesn't surprise me that there's an error
in the wrapper documentation.

[...]

> How about simply correcting the parse_http docs from:
> 	The date string can be in one of the following formats:
> to:
> 	The date string can be in one of the following formats (as per RFC2616):
>
> That way anyone interested can look up the correct RFC if they want the gory 
> details.

The RFC is a guideline, not the final arbiter.  This link is exactly
what you are looking for:

    http://apr.apache.org/docs/apr-util/group___a_p_r___util___date.html#ga1


-- 
Joe Schaefer


Re: APR::Date

Posted by Malcolm J Harwood <mj...@liminalflux.net>.
On Wednesday 16 March 2005 10:19 pm, Joe Schaefer wrote:

> > What should the manpage say? something like the following?
> >    The function assumes GMT, regardless of the used timezone,
> >    according to RFC 2616 Section 3.3 requires.
> No need to mention the RFC; how about this?

The current doc says:
	# parse RFC822-complient date string

Which it doesn't (as RFC822 includes multiple timezones). In fact none of the 
RFCs listed are 2616. Whilst parse_http does seem like it should follow 
RFC2616, is thare a reason parse_rfc should too?

>     APR::Date::parse_http is a perl wrapper for the
>     apr_date_parse_http() function provided by libaprutil.
>     Please check your libaprutil documentation for a complete
>     list of supported formats and restrictions (in particular,
>     this function assumes GMT, regardless of the used timezone).

How about simply correcting the parse_http docs from:
	The date string can be in one of the following formats:
to:
	The date string can be in one of the following formats (as per RFC2616):

That way anyone interested can look up the correct RFC if they want the gory 
details.

I'm not sure about parse_rfc as I'm not sure what it's actually supposed to be 
able to parse.




Re: APR::Date

Posted by Stas Bekman <st...@stason.org>.
Joe Schaefer wrote:
> Stas Bekman <st...@stason.org> writes:
> 
> 
> [...]
> 
> 
>>What should the manpage say? something like the following?
>>
>>   The function assumes GMT, regardless of the used timezone,
>>   according to RFC 2616 Section 3.3 requires.
> 
> 
> No need to mention the RFC; how about this?
> 
>     APR::Date::parse_http is a perl wrapper for the 
>     apr_date_parse_http() function provided by libaprutil.
>     Please check your libaprutil documentation for a complete 
>     list of supported formats and restrictions (in particular,
>     this function assumes GMT, regardless of the used timezone).

Grr, it's OK if you tell me about apr_date_parse_http(), it's the best to 
save the perl users the trouble of learning about the existence of the 
underlying C API. Especially since for the most part the C API is either 
very terse or most of the time lacking completely. And they need to figure 
out where to get that documentation. I'd rather document whatever is 
needed to help the perl users to get most of the information in the perl 
API manpages. And only in the more advanced cases point to the C API.


-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Re: APR::Date

Posted by Joe Schaefer <jo...@sunstarsys.com>.
Stas Bekman <st...@stason.org> writes:


[...]

> What should the manpage say? something like the following?
>
>    The function assumes GMT, regardless of the used timezone,
>    according to RFC 2616 Section 3.3 requires.

No need to mention the RFC; how about this?

    APR::Date::parse_http is a perl wrapper for the 
    apr_date_parse_http() function provided by libaprutil.
    Please check your libaprutil documentation for a complete 
    list of supported formats and restrictions (in particular,
    this function assumes GMT, regardless of the used timezone).

-- 
Joe Schaefer


Re: APR::Date

Posted by Stas Bekman <st...@stason.org>.
Joe Schaefer wrote:
> Stas Bekman <st...@stason.org> writes:
> 
> 
>>Malcolm J Harwood wrote:
>>
>>>According to the docs, APR::Date::http parses the format:
>>>	Sun, 06 Nov 1994 08:49:37 GMT
>>>as per RFC 822.
>>>However it does not seem to parse
>>>	Sun, 06 Nov 1994 08:49:37 EST
>>>correctly. It assumes it's GMT regardless of the timezone
>>>specified. If I'm reading RC822 correctly, this is an error.
>>
>>Looks like we don't test anything but GMT :(
>>
>>Malcolm, mind to add the non-GMT tests to t/lib/TestAPRlib/date.pm in
>>the source package, and we will work on fixing those? 
> 
> 
> IMO this doesn't need fixing; if anything this is a doc bug.
> The apr_date_parse_* functions assume GMT because that's the
> timezone 2616 Section 3.3 requires.

Thanks Joe.

What should the manpage say? something like the following?

   The function assumes GMT, regardless of the used timezone,
   according to RFC 2616 Section 3.3 requires.



-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Re: APR::Date

Posted by Joe Schaefer <jo...@sunstarsys.com>.
Stas Bekman <st...@stason.org> writes:

> Malcolm J Harwood wrote:
>> According to the docs, APR::Date::http parses the format:
>> 	Sun, 06 Nov 1994 08:49:37 GMT
>> as per RFC 822.
>> However it does not seem to parse
>> 	Sun, 06 Nov 1994 08:49:37 EST
>> correctly. It assumes it's GMT regardless of the timezone
>> specified. If I'm reading RC822 correctly, this is an error.
>
> Looks like we don't test anything but GMT :(
>
> Malcolm, mind to add the non-GMT tests to t/lib/TestAPRlib/date.pm in
> the source package, and we will work on fixing those? 

IMO this doesn't need fixing; if anything this is a doc bug.
The apr_date_parse_* functions assume GMT because that's the
timezone 2616 Section 3.3 requires.

-- 
Joe Schaefer


Re: APR::Date

Posted by Stas Bekman <st...@stason.org>.
Malcolm J Harwood wrote:
> According to the docs, APR::Date::http parses the format:
> 	Sun, 06 Nov 1994 08:49:37 GMT
> as per RFC 822.
> However it does not seem to parse
> 	Sun, 06 Nov 1994 08:49:37 EST
> correctly. It assumes it's GMT regardless of the timezone specified. If I'm 
> reading RC822 correctly, this is an error.

Looks like we don't test anything but GMT :(

Malcolm, mind to add the non-GMT tests to t/lib/TestAPRlib/date.pm in the
source package, and we will work on fixing those? Probably matching the 
same timestamp when decoded, but encoded in EST (and may be other TZ as well)

You can run this test w/o even starting the server, via:

t/TEST -v -no t/apr-ext/date.t

Thanks.

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com