HTTP session hooks · NVIDIA/OpenShell#4359 1 / 6
Reviewer walkthrough · supervisor middleware

HTTP session hooks: streaming request and response middleware

The PR replaces the v1 HTTP middleware hooks with two bidirectional streaming RPCs, so middleware can inspect and rewrite bodies of any size, set headers from what it read in the body, and process response streams without lockstep.

  • Streaming APIHttpSessionMiddleware.EvaluateRequest and EvaluateResponse, one stream per HTTP message and stage. A preflight picks continue, deny, or inspect (BUFFERED or STREAM).
  • Opt in by capabilitySame HTTP_REQUEST / HTTP_RESPONSE bindings. A service that requires openshell.supervisor-middleware.http-session gets the new RPCs. No new HTTP operations or versioned enums.
  • Always fail-closedon_error: fail_open is rejected for session hook services.
  • Uninspectable traffic unchangedtls: skip, h2c, and raw TCP connections never reach middleware. As on main, a selected fail_closed entry refuses them.
  • No ports in selectorsSelector patterns that contain : are rejected, except IPv6 literals. A host:port pattern never matched anything.
  • v1 deprecatedEvaluateHttpRequest and HttpResponsePreReturn keep working and are removed in 0.2.0.
github.com/NVIDIA/OpenShell/pull/4359

In this deck

  1. Why a new API
  2. Before and after
  3. Shape of the new API
  4. How a service selects the hook version
  5. Migrating a v1 service
  6. Next iterations
  7. Preflight and body eligibility rules
  8. Chain ordering and when the head commits
  9. STREAM stalls and deadlines
  10. Failure semantics per phase
  11. Code map for the diff