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

please add a function that does Header Field Normalisation

vanHoesel opened this issue · comments

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:

  • adding/removing whitespace
  • combining fields, for multi value fields
  • reordering fields
  • capitalisation

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.

please close #60

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