Santiago, you can use context to cancel the request after the certain time
you like.

        ctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond)
        defer cancel()  // releases


On Mon, Sep 30, 2019, 8:54 PM Santiago Corredoira <scorredo...@gmail.com>
wrote:

> Using the http package, timeouts are defined per server. Is there any way
> of changing it for a specific handler? Imagine a long download from a loged
> user or a websocket but also be protected against clients that don't close
> connections and fload the server.
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/1622fd96-3758-4066-9428-220b5887ddd5%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/1622fd96-3758-4066-9428-220b5887ddd5%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAJpEBv_fahuSEXhwq0jd%3D%2BeD_1P-r3iv6JGcjTDrH3ATqZBwVw%40mail.gmail.com.

Reply via email to