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

Message->parse() is incompatible with header()

FGasper opened this issue · comments

perl -MData::Dumper -MHTTP::Response -e'my $hdr = HTTP::Response->parse("HTTP/1.0 200 OK\r\na-b_c: haha\r\n\r\n"); print Dumper $hdr; print $hdr->header("a-b_c");'

^^ The above will show that haha isn’t printed. The Dumper output shows that the header is stored internaly as a-b_c, but when we go to fetch that value we get nothing because fetch() is looking for a-b-c.

I don’t see any outstanding issues about this. Without knowing why Message->parse() disables the underscore translation I‘m not sure what the proper fix would be. Maybe make header() search for the original as well as the hyphen-replaced version?

@vanHoesel thoughts on this?