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

Implementations special case reserved codepoints #30

Open
martinthomson opened this issue Jul 26, 2024 · 1 comment
Open

Implementations special case reserved codepoints #30

martinthomson opened this issue Jul 26, 2024 · 1 comment

Comments

@martinthomson
Copy link

In "Don't Special-Case Grease Values" (#27), we have a request that implementers (not protocol designers) not do something.

I have seen -- numerous times -- that people are inclined to special case reserved grease values on receipt. This is a somewhat understandable thing, but it isn't always the obvious thing to do.

An example: A server that supports HTTP/3 with webtransport has to distinguish between bidirectional streams that are webtransport and ordinary requests. This is done by looking at the type of the first frame on the stream. The logic is supposed to be something like:

if frame_type == WEBTRANSPORT:
  it_is_webtransport()
else:
  it_is_http3()

But there is an interesting wrinkle that makes this rough. There is only one HTTP/3 frame type that is described as fitting in this place (HEADERS). That means that you tend to get:

if frame_type == HEADERS:
  it_is_http3()
else if frame_type == WEBTRANSPORT:
  it_is_webtransport()
else:
  error()

The result being that the implementation chokes on extensions or grease. To handle grease, I've seen people do this:

if frame_type == HEADERS:
  it_is_http3()
else if frame_type == WEBTRANSPORT:
  it_is_webtransport()
else if is_grease(frame_type):
  it_is_http3_but_ignore_this_frame()
else:
  bad_error()

That's not the first time I've seen this happen, but it's a nice case study.

@martinthomson
Copy link
Author

To continue, the right answer here is to move some of this logic into the HTTP/3 handling code, so expanding the first (and correct) example...

if frame_type == WEBTRANSPORT:
  it_is_webtransport()
else:
  if frame_type == HEADERS:
    handle_headers()
  else if supported_frame_type(frame_type):
    error()
  else:
    ignore_this_frame()

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

1 participant