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

Kevin Cernekee cernekee at gmail.com
Mon Jan 25 08:04:11 PST 2016


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.



More information about the openconnect-devel mailing list