Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request for Header Field normalisation #60

Closed
oalders opened this issue Mar 31, 2017 · 6 comments
Closed

Request for Header Field normalisation #60

oalders opened this issue Mar 31, 2017 · 6 comments

Comments

@oalders
Copy link
Member

oalders commented Mar 31, 2017

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

Requestors:

From [email protected] on 2015-06-26 22:49:46:

Hi all,

I just wrote YA caching UA (with Moo and CHI), and I found something I wasn't able to commit time to. So, just in case anybody else is inspired, I submit this as a wishlist item. :-)

Section 4.1 in RFC 7234 see http://tools.ietf.org/html/rfc7234#section-4.1 requires normalization of the Vary header values. I figured this normalization is better done in HTTP-Message than in the caching UA.

Cheers,

Kjetil
@vanHoesel
Copy link
Member

@kjetilk, As far as I understand what is written in RFC 7234 §4.1 Calculating Secondary Keys with Vary, it does not say anything about the normalisation of the VARY response header itself. That can be just a list of nominated header-field names, in any order or capitalisation.

The RFC does explain what can be done with the presented request-header fields and/or associated request-header fields to see if it is a match or not:

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

Normalisation of the VARY header 'ansich' is not the issue you have to deal with. But what you typically want is the normalisation of each and every header-field mentioned.

You may be looking for something like $h->normalized_header( $field ) in HTTP::Headers, but it ain't there (yet)

I think, because of misinterpretation of the RFC, this specific issue may be closed, and maybe a new one could be opened 'HTTP::Headers normilized headers request'

@kjetilk
Copy link

kjetilk commented Jul 12, 2018

Yes, indeed, a $h->normalized_header( $field ) in HTTP::Headers is what I'm looking for. I thought that was clear when I wrote "Vary header values", sorry it wasn't clear enough.

Wouldn't it be better to just change the title of the issue than taking the extra effort to open a new issue?

@vanHoesel
Copy link
Member

Sounds like a plan, but than I think we should ask @oalders to update the title. As that does not reflect the request you really have:

What about:


Title: Request for Header Field normalisation

Reasoning:

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


Well, I think I just wrote out a new issue ?

@kjetilk
Copy link

kjetilk commented Jul 12, 2018

Hehe, right, indeed, that is a well formulated new issue :-) Feel free to post it like that.

@genio genio changed the title Support Vary header normalization [rt.cpan.org #105516] Request for Header Field normalisation Jul 12, 2018
@vanHoesel
Copy link
Member

vanHoesel commented Jul 12, 2018

@genio , thank You for renaming, you might want to rename it back, rather than rewriting history - unless you really really really want the discussion be part of the introduction. As @kjetilk said, posting a new one, see #116

@oalders
Copy link
Member Author

oalders commented Jul 12, 2018

Thanks everyone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants