libwww-perl / libwww-perl/HTTP-Message
if_modified_since calls time2str and dies [rt.cpan.org #105924]
Open
Nobody has claimed this yet.
- Dominant language
- Perl
- Stars
- 32
- Forks
- 63
- Avg merge
- 5h 14m
- Merged PRs (30d)
- 1
Description
Migrated from rt.cpan.org#105924 (status was 'open')
Requestors:
- NHORNE@cpan.org
From nhorne@cpan.org on 2015-07-17 23:20:27:
The documentation at http://search.cpan.org/~ether/HTTP-Message-6.08/lib/HTTP/Headers.pm does not specify the format of the argument to HTTP::Headers::if_modified_since. Reading the spec at http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html I assumed H::H::if_modified_since takes a date field. But H::H::if_modified_since has this code which dies in time2str because it's already a string:
if (defined $time) {
$self->_header($header, HTTP::Date::time2str($time));
}
Here's my stack trace of the fault:
2015/07/17 14:43:27 TRACE> 0: bb-links.fcgi:103 main::__ANON__ - /home/hornenj/perlmods/share/perl/5.14.2/HTTP/Headers.pm:304 in function HTTP::Date::time2str
2015/07/17 14:43:27 TRACE> 0: bb-links.fcgi:103 main::__ANON__ - /home/hornenj/perlmods/share/perl/5.14.2/HTTP/Headers.pm:314 in function HTTP::Headers::_date_header
2015/07/17 14:43:27 TRACE> 0: bb-links.fcgi:103 main::__ANON__ - /home/hornenj/perlmods/share/perl/5.14.2/HTTP/Message.pm:644 in function HTTP::Headers::if_modified_since
2015/07/17 14:43:27 TRACE> 0: bb-links.fcgi:103 main::__ANON__ - bb-links.fcgi:2325 in function HTTP::Message::__ANON__
From ether@cpan.org on 2015-07-18 04:47:53:
Since it's dying in time2str, that would suggest it's expecting a value in
machine time (seconds since epoch), surely?
On Fri, Jul 17, 2015 at 4:20 PM, Nigel Horne via RT <
bug-HTTP-Message@rt.cpan.org> wrote:
> Fri Jul 17 19:20:27 2015: Request 105924 was acted upon.
> Transaction: Ticket created by NHORNE
> Queue: HTTP-Message
> Subject: if_modified_since calls time2str and dies
> Broken in: 6.08
> Severity: Important
> Owner: Nobody
> Requestors: NHORNE@cpan.org
> Status: new
> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=105924 >
>
>
> The documentation at
> http://search.cpan.org/~ether/HTTP-Message-6.08/lib/HTTP/Headers.pm does
> not specify the format of the argument to
> HTTP::Headers::if_modified_since. Reading the spec at
> http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html I assumed
> H::H::if_modified_since takes a date field. But H::H::if_modified_since
> has this code which dies in time2str because it's already a string:
>
> if (defined $time) {
> $self->_header($header, HTTP::Date::time2str($time));
> }
>
> Here's my stack trace of the fault:
>
> 2015/07/17 14:43:27 TRACE> 0: bb-links.fcgi:103 main::__ANON__ -
> /home/hornenj/perlmods/share/perl/5.14.2/HTTP/Headers.pm:304 in function
> HTTP::Date::time2str
> 2015/07/17 14:43:27 TRACE> 0: bb-links.fcgi:103 main::__ANON__ -
> /home/hornenj/perlmods/share/perl/5.14.2/HTTP/Headers.pm:314 in function
> HTTP::Headers::_date_header
> 2015/07/17 14:43:27 TRACE> 0: bb-links.fcgi:103 main::__ANON__ -
> /home/hornenj/perlmods/share/perl/5.14.2/HTTP/Message.pm:644 in function
> HTTP::Headers::if_modified_since
> 2015/07/17 14:43:27 TRACE> 0: bb-links.fcgi:103 main::__ANON__ -
> bb-links.fcgi:2325 in function HTTP::Message::__ANON__
>
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read HTTP/Message.pm around HTTP::Headers::if_modified_since and HTTP/Headers.pm around _date_header, using the reported stack trace as the entry point. Reproduce the failure with the argument form described in the issue, then establish the expected date format and add coverage showing that the method no longer dies.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- perl
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100