I think this question is a protocol problem more than anything.

A quick bit of searching "http server abort upload" reveals what to do:

https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.14
https://groups.google.com/forum/#!topic/golang-nuts/agB-n6V7UsQ

There is also this informative SO post:
https://stackoverflow.com/questions/18367824/how-to-cancel-http-upload-from-data-events#18370751

So: Respond with "413 Request Entity Too Large" as soon as you detect it is
too big, and use w.Header().Set("Connection", "close") to tell the client
to close the connection. Not sure how to tell the server to close the
connection.

On HTTP1 you can at least Hijack the connection and Close it. On HTTP2 I
don't see an obvious way. https://tip.golang.org/pkg/net/http/#Hijacker

Note that this does result in a non-ideal UX unless you do the upload with
AJAX, but this looks like an issue with the browsers, according to the
above SO post.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to