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

http: Allow unquoted tokens in Alt-Svc quic parameter #3063

Closed
Lekensteyn opened this issue Sep 24, 2019 · 8 comments · Fixed by #3118
Closed

http: Allow unquoted tokens in Alt-Svc quic parameter #3063

Lekensteyn opened this issue Sep 24, 2019 · 8 comments · Fixed by #3118
Labels

Comments

@Lekensteyn
Copy link
Contributor

According to https://tools.ietf.org/html/rfc7838#section-3, the Alt-Svc parameter value can be unquoted:

    parameter = token "=" ( token / quoted-string )

This means that this can be written:

alt-svc: h3=":443";quic=1

instead of only:

alt-svc: h3=":443";quic="1"

The current text in https://tools.ietf.org/html/draft-ietf-quic-http-23#section-3.2.1 forbids the unquoted variant which is an additional constraint on the RFC 7838 grammar. Should unquoted quic parameter values also be permitted?

Note that this does not change the situation when multiple versions are supported since an unquoted "token" type is not allowed to contain commas.

See also the discussion in #3059.

@DavidSchinazi
Copy link
Contributor

RFC 7838 allows unquoted strings, but there's nothing preventing new specifications of Alt-Svc parameters from being more restrictive. I'm not sure the added flexibility of allowing unquoted versions buys us much here, and it comes at an implementation cost.

@mikkelfj
Copy link
Contributor

If alt-svc can be specified in configuration files, it is likely to result in interop issues if unquoted is not permitted.

@tatsuhiro-t
Copy link
Contributor

I support allowing unquoted token for alt-svc quic parameter.
quic=1 and quic="1" are semantically the same, and there is no reason to disallow unquoted token.
Moreover, requiring quoted-string means that we cannot use generic alt-svc parser because such parser can parse quic=1 without an error. You need to write your own parser to detect that the DQUOTE is really there. If you think that detecting it is not necessary, then requiring quoted-string is not necessary in the first place.

@bagder
Copy link

bagder commented Sep 24, 2019

People and implementers will be surprised (and do wrong) if the rules and constraints of RFC7838 aren't kept.

@mnot mnot added the -http label Sep 25, 2019
@mikkelfj
Copy link
Contributor

mikkelfj commented Sep 25, 2019

To highlight my earlier point, on slack the following was posted

Specifically: I have an H1/H2 server running on ports 443 and 4433 which advertises
alt-svc: h3-23=":4433"; ma=3600

The issue appears to not be the unquoted ma=3600, but it does suggest we will see unquoted strings in the wild, and quic.rocks is said to also use unquoted ma=3600.

@RyanTheOptimist
Copy link
Contributor

RyanTheOptimist commented Sep 25, 2019 via email

@LPardue
Copy link
Member

LPardue commented Sep 25, 2019

As I said elsewhere, the current text in draft-23 stems from a Structured Headers issue related to wanting to advertise multiple versions of QUIC. httpwg/http-extensions#281

Alt-Svc isn't a structured one but if it were (e.g. if someone wanted to write a generic Structured Header parser) then there was a danger that the rules preventing dictionary key repetition would have prevented an endpoint sending multiple quic parameters e.g. Alt-svc: ":443"; quic=1; quic=1abadaba.

To mitigate the risk, the quic parameter was changed to a DQUOTED comma-separated list as part of #1093.

This issue addresses the correctness within the Alt-Svc spec but does it reopen the can related to Structured Headers?

@Lekensteyn
Copy link
Contributor Author

I think that the problem here is independent from whether structured headers should be applied or not.

  • Alt-Svc: h3=":443"; quic=1; quic=1abadaba - Structured header issue: duplicate keys.
  • Alt-Svc: h3=":443"; quic=1,1abadaba - Invalid grammar according to RFC 7838 since "token" does not include commas.
  • Alt-Svc: h3=":443"; quic="1,1abadaba" - valid grammar according to both RFC 7838 and the QUIC description.

However, if only a single version has to be advertised, then the quoting is not necessary:

  • Alt-Svc: h3=":443"; quic="1" - valid grammar according to both RFC 7838 and the QUIC description.
  • Alt-Svc: h3=":443"; quic=1 - valid grammar according to both RFC 7838, but QUIC currently forbids it.

In #3059 I proposed to fix the grammar (editorial issue). However, at the same time I could also make the grammar match RFC 7838 (the last bullet point above).

@DavidSchinazi I would mind not making the semantics more restrictive (e.g. restricting the values of the QUIC parameter to hexadecimal only), but restricting the parser grammar would impose extra restrictions on those who have to generate the header. It is conceivable that implementations will continue accepting the RFC 7838 grammar, and end up accepting quic=1 while others would reject it and accept quic="1" only. By making sure that the grammars align, I hope that this becomes a non-issue.

So far @mikkelfj, @tatsuhiro-t and @bagder seems to support this proposal and @DavidSchinazi is not sure. Can this be considered consensus? 😃

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

Successfully merging a pull request may close this issue.

8 participants