WebAssembly / wasi-http

142 stars 24 forks source link

Expose protocol version #27

Open lann opened 1 year ago

lann commented 1 year ago

e.g.:

variant version {
  HTTP11,
  HTTP20,
  HTTP30,
  other(string),
}

incoming-request-version: func(request: incoming-request) -> version

It would be nice to make the labels e.g. HTTP-1-1, but this isn't currently allowed; see https://github.com/WebAssembly/component-model/issues/134

lukewagner commented 1 year ago

Yeah, I can see how that would be useful.

One general concern is that we want components to be version-agnostic so that the HTTP version can be upgraded over time by the host without breaking existing code. IIUC, for this reason, the HTTP version isn't included in the HTTP semantics which, thus far, we've been mirroring with HTTP interface. On the other hand, it does seem like there are plenty of benign use cases where you might want to, e.g., log the version. One idea is that requests could have an optional child resource (hanging off the request resource), say called connection-info, that had various wire format details including HTTP version but also, say, client IP address (which I've seen use cases for and is also not part of HTTP semantics).