A
A
aafomenko2020-06-05 13:10:50
go
aafomenko, 2020-06-05 13:10:50

How to fix disconnection (NOT disconnection) of a client over HTTP?

hello everyone, the client is downloading a large file and it's impossible to determine that the connection with the client is broken, not that the client disconnected itself.

s := &http.Server{
          Addr:           ":81",
          Handler: router,
          ConnState:      ConnStateListener,
      }

ConnState - not as it is not displayed that the client was terminated only when he himself closed the connection.

Tried inside Handle:
notify := w.(http.CloseNotifier).CloseNotify()
also only fixes normal shutdown.

Through Request.Context also ....

Direct in the right direction where to dig to fix this disconnect ....

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
falconandy, 2020-06-05
@falconandy

See https://stackoverflow.com/questions/36781707/what-... (answer marked as best). The point is to set explicit read/write timeouts at the tcp connection level.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question