[PATCH ocserv 2/3] Use helper functions to send common HTTP headers/responses

Nikos Mavrogiannopoulos nmav at gnutls.org
Mon Jan 25 09:56:26 PST 2016


On Mon, 2016-01-25 at 08:04 -0800, Kevin Cernekee wrote:
> On Mon, Jan 25, 2016 at 12:53 AM, Nikos Mavrogiannopoulos
> <nmav at gnutls.org> wrote:
> > On Sun, Jan 24, 2016 at 10:11 PM, Kevin Cernekee <
> > cernekee at gmail.com> wrote:
> > > Factor out duplicated code in the AnyConnect compatibility 
> > > handlers.
> > 
> > Hi Kevin,
> >  On this particular patch send_string() uses strlen(), instead of
> > relying on the compile-time sizeof(). Is there any need for that?
> > Since the strings are fixed, I don't see an advantage from using
> > strlen().
> 
> It seemed less error-prone than relying on the caller to pass the
> length, especially if non-constant strings are used in the future.
> We're never passing strings containing '\0', and the overhead of
> calling strlen() once for each HTTP request is negligible.
> But I can change it if you prefer sizeof.

Even though negligible it is repeated on every connection for no
particular reason. I'd prefer to have sizeof() for static strings and
we can always extend later when we have other string types.

regards,
Nikos




More information about the openconnect-devel mailing list