otelhttp.NewHandler
body wrapper alters default behaviour of Expect: 100-continue
header handling
#6908
Labels
area: instrumentation
Related to an instrumentation package
bug
Something isn't working
instrumentation: otelhttp
Description
otelhttp.NewHandler
adds extra body wrapper on top ofr.Body
: https://github.com/open-telemetry/opentelemetry-go-contrib/blob/main/instrumentation/net/http/otelhttp/handler.go#L138-L144. This changes default behavior of handlingExpect: 100-continue
header by Go HTTP server.Here: https://github.com/golang/go/blob/go1.24.1/src/net/http/server.go#L1418-L1420 since
r.Body
is not theexpectContinueReader
(it is our custom wrapper) this means that we won't trigger close after reply so instead of that we will go here: https://github.com/golang/go/blob/go1.24.1/src/net/http/server.go#L1461-L1462 and we will wait for the body without sending100 Continue
response back (which means that client won't send us data until the specified timeout and thus whole operations takes seconds instead of milliseconds).Environment
otelhttp
version: v0.56.0Steps To Reproduce
Expected behavior
No extra delay when handling
Expect: 100-continue
headers during redirect (without reading ther.Body
).Further notes
In my opinion Go handling of this header is not ideal. Expecting specific type might not be a good idea... Not sure if we should instead file a ticket in Go to improve this...
... but in the meantime one of the thing that
otelhttp
library could do is something like:But not sure if this actually works properly and if it doesn't breaking something else instead :D
The text was updated successfully, but these errors were encountered: