libwww-perl / HTTP-Message

The HTTP-Message distribution contains classes useful for representing the messages passed in HTTP style communication.
https://metacpan.org/pod/HTTP::Message
Other
28 stars 60 forks source link

please add a function that does Header Field Normalisation #116

Open vanHoesel opened 6 years ago

vanHoesel commented 6 years ago

In order to make comparison of two Header Field values more convenient (and correct) it would be great to have a normalisation function in HTTP::Headers, like:

my $normalized_value = $h->normalized_header( 'accept_language');

Normalisation is mentioned in RFC 7234 §4.1 Calculating Secondary Keys with Vary. And could involve:

However, re-ordering and capitalisation can be Header Field dependent and should not break semantics This requires a lot of care, knowing how certain HTTP-Header Fields south to be treated.

NOTE: bare in mind that normalisation is only for display or comparison, I would strongly disagree to change the headers, even though it might semantically totally right.

vanHoesel commented 6 years ago

please close https://github.com/libwww-perl/HTTP-Message/issues/60

kjetilk commented 6 years ago

Great, thanks a lot for reformulating the issue! It would be really great to have in there!