Re: [dev] suckless dns over http client

From: harry666t <harry666t_AT_gmail.com>
Date: Tue, 3 Apr 2018 22:22:51 +0200

> There is a small bug on line 34: if the statuscode isn't 200 then the
> response body is never closed.

Thanks Martin. Fixed.

> Probably not a huge deal since this is a command line client, but in
> long-running servers this will cause file descriptor leaks.

It is a huge deal. If I can't get a small program right, who would
ever trust me to write a big one correctly?

<3!K.

On 3 April 2018 at 22:17, Martin Tournoij <martin_AT_arp242.net> wrote:
> On Tue, Apr 3, 2018, at 21:12, harry666t wrote:
>> My take - if you don't mind Go...
>> https://github.com/rollcat/gdoh
>> No forking, no dependencies outside of stdlib, async
>> queries/responses, allows using multiple providers, 78 loc.
>
> There is a small bug on line 34: if the statuscode isn't 200 then the
> response body is never closed. You should move the "defer
> r.Body.Close()" to above the "if r.StatusCode != 200 {" check.
>
> Probably not a huge deal since this is a command line client, but in
> long-running servers this will cause file descriptor leaks.
>
Received on Tue Apr 03 2018 - 22:22:51 CEST

This archive was generated by hypermail 2.3.0 : Tue Apr 03 2018 - 22:25:04 CEST