libwww-perl / HTTP-Message

The HTTP-Message distribution contains classes useful for representing the messages passed in HTTP style communication.

Home Page:https://metacpan.org/pod/HTTP::Message

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BUG: linefeeds in HTTP::Response->parse [rt.cpan.org #54266]

oalders opened this issue · comments

Migrated from rt.cpan.org#54266 (status was 'new')

Requestors:

Attachments:

From http://andy.jenkinson.myopenid.com/ on 2010-02-03 16:45:57
:

Hi there,

I've just discovered a problem in the handling of newlines in the HTTP::Response "parse" 
method. Basically, the HTTP specification defines the use of CRLF to indicate a newline 
whereas this method expects only LF. The bug does not appear to affect the equivalent 
method in HTTP::Message, which processes CRLF correctly.

The issue manifests as $response->status_line having a CR on the end. It affects situations 
where the method is used to parse "real" HTTP spec compliant web server responses (which 
typically use CRLF). It does not occur when parsing the default output from the 
HTTP::Response->as_string method, which uses LF instead of CRLF.

I've attached a patch and test.

Cheers,
Andy

This has been applied, as can be seen by looking at the patch in RT, and then this line in HTTP::Response.

So can be closed.

Thanks for the research, @neilb!