cloudfoundry / gorouter

CF Router
Apache License 2.0
441 stars 224 forks source link

Enable full duplex mode for HTTP/1 requests #395

Closed mariash closed 7 months ago

mariash commented 7 months ago

Go 1.20+ added support for full duplex mode which allows HTTP server handlers to concurrently read from the request and write response. Enable full duplex mode for HTTP/1 requests (HTTP/2 already supports it and EnableFullDuplex fails for HTTP/2)

Add Unwrap to utils.ResponseWriter to satisfy http.ResponseController support (Go 1.20+) https://pkg.go.dev/net/http#NewResponseController

Bump negroni to v3 to get Unwrap on negroni.ResponseWriter as well. The release change PR is here

Stream processing, early validation to cancel large requests, 100 Continue scenarios.

Push an app that validates custom header in request and sends 400 response before reading the request body. Have a client that sends HTTP/1 request without closing its body, gets response and cancels request if 401. An example of such client is here

Request is canceled before the request body is written.

Gorouter is waiting for the full request body first before sending response back.