Re: [go-nuts] Is it needed to close a HTTP request body ?

2018-09-10 Thread Pierre Durand
OK ! thanks.

Le lundi 10 septembre 2018 16:39:28 UTC+2, Sam Whited a écrit :
>
>
>
> On Mon, Sep 10, 2018, at 09:27, Pierre Durand wrote: 
> > When I learned Go a few years ago, I was told to always defer/close the 
> > HTTP request body, otherwise it will cause a resource leak. 
> > 
> > But today I read this: https://golang.org/pkg/net/http/#Request.Body 
> > // The Server will close the request body. The ServeHTTP 
> > // Handler does not need to. 
> > 
> > Am I misunderstanding something ? 
>
> The rule is that HTTP *clients* must close the *response* body. Servers 
> handle closing the request body themselves. 
>
> —Sam 
>

-- 
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.


Re: [go-nuts] Is it needed to close a HTTP request body ?

2018-09-10 Thread Sam Whited



On Mon, Sep 10, 2018, at 09:27, Pierre Durand wrote:
> When I learned Go a few years ago, I was told to always defer/close the 
> HTTP request body, otherwise it will cause a resource leak.
> 
> But today I read this: https://golang.org/pkg/net/http/#Request.Body
> // The Server will close the request body. The ServeHTTP
> // Handler does not need to.
> 
> Am I misunderstanding something ?

The rule is that HTTP *clients* must close the *response* body. Servers handle 
closing the request body themselves.

—Sam

-- 
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.


[go-nuts] Is it needed to close a HTTP request body ?

2018-09-10 Thread Pierre Durand
When I learned Go a few years ago, I was told to always defer/close the 
HTTP request body, otherwise it will cause a resource leak.

But today I read this: https://golang.org/pkg/net/http/#Request.Body
// The Server will close the request body. The ServeHTTP
// Handler does not need to.

Am I misunderstanding something ?

Thanks.

-- 
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.