HTTP status code 102 (Processing) is defined by RFC 2518, section 10.1:
This status code SHOULD only be sent when the server has a reasonable expectation that the request will take significant time to complete. [...] The server MUST send a final response after the request has been completed.
As of now (Go 1.13.6), there is no way to actually send a 102 response because ResponseWriter.WriteHeader() can only be called once. Any successive calls are rejected (here).
Since the ResponseWriter interface cannot be extended without breaking backwards compatibility, a new interface should be added (and implemented by the existing ResponseWriter implementations) that exposes a function for sending an interim response with status 102.
WebDAV specific features might be better suited for x/net/webdav. I'm not positive we could make this change in net/http while maintaining API compatibility.
/cc @bradfitz @nigeltao
I don't think we'd need API changes. We could just permit WriteHeader(102) followed by a non-1xx status later
Hey,
Any update about this ? It would be a nice feature.
For my use case, it doesn't have any link with WebDAV. I have some very long requests, who can make hundreds of other requests to various requests, and adding this kind of functionality would enable my users to stay listening at the server. Currently, they are in timeout...
Also, for the net/http and not a WebDav-specific protocol, this improvement would permit developers to use HTTP 103 - Early Hints (https://tools.ietf.org/html/rfc8297, still experimental, but exists).
The change is pretty simple : if status is 1xx, we allow update, if not we reject as it is currently done. (show concerned line)
Change https://golang.org/cl/269997 mentions this issue: net/http: allow sending 1xx responses
Change https://golang.org/cl/270157 mentions this issue: http2: allow sending 1xx responses
Most helpful comment
I don't think we'd need API changes. We could just permit WriteHeader(102) followed by a non-1xx status later