I’m experimenting with HTTP/2 (h2c) startup modes when talking to gRPC servers. According to RFC 7540 §3.2, an HTTP/2 connection over clear-text (h2c) can be established in two ways:
1. Upgrade from HTTP/1.1: Client starts with a normal HTTP/1.1 request including
Upgrade: h2c header, and if the server supports it, it replies with HTTP/1.1 101 Switching Protocols and then both sides switch to HTTP/2.
2. Prior-Knowledge: Client connects to the server and immediately sends the HTTP/2 connection preface without any HTTP/1.1 round-trip.
My question is, if a server supports the HTTP/1.1 to h2c Upgrade mechanism, is it required (by the spec or common practice) to also accept a “prior-knowledge” connection that starts directly with the HTTP/2 preface? In other words, can I rely on the fact that a server advertising support for Upgrade: h2c will also handle a client that sends the HTTP/2 preface first (like curl --http2-prior-knowledge), or do I need to test both startup modes?
For my use case, I only care about gRPC server implementations and the proxies commonly used in front of gRPC services (like Envoy or nginx).