You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On our http server that uses the built-in go http server, we'd like to pass a custom header to the API consumer before the final HTTP response has been established. It is documented that the golang http server does not support sending custom 1xx status codes, however the golang http server itself sends a 100-Continue once the request reader is being read with the expectCustomReader.
So the proposal is as follows: respect what is being written to the response writer before the 100-Continue is being written into the response, then flush it together with the 100-Continue which is sent anyway.
I believe many users can benefit from this, would be happy to hear what you think (and I can also own this and PR it into the codebase).
Thanks a million.
The text was updated successfully, but these errors were encountered:
ianlancetaylor
changed the title
proposal: flush other headers with 100-continue in expectContinueReader
proposal: net/http: flush other headers with 100-continue in expectContinueReader
Aug 17, 2020
I don't know this code very well but I don't understand how that could work reliably. expectContinueReader is based on reading the request, so I don't see how the requester responder will be able to add any headers.
well, without having plotted out a detailed implementation plan it seems to me that the main thing here is that responsibility for writing the headers is leaked to the reader in the case of expectContinueReader, which is not ideal. The reader is invoking the write on the actual connection upon read:
So essentially, if we can proxy the write through the actual response object in a dedicated method we could respect the headers that were written into it in the meanwhile. The only thing is that infers that synchronization is needed in order to make sure that no new headers are being written while the previous ones are being flushed to the client. We could get around this in order to get better performance if synchronization is the deal-breaker here, but let's first discuss if this is a viable solution at all.
On our
http
server that uses the built-in gohttp
server, we'd like to pass a custom header to the API consumer before the final HTTP response has been established. It is documented that the golang http server does not support sending custom1xx
status codes, however the golang http server itself sends a100-Continue
once the request reader is being read with theexpectCustomReader
.So the proposal is as follows: respect what is being written to the response writer before the
100-Continue
is being written into the response, then flush it together with the100-Continue
which is sent anyway.I believe many users can benefit from this, would be happy to hear what you think (and I can also own this and PR it into the codebase).
Thanks a million.
The text was updated successfully, but these errors were encountered: