[gnutls-devel] gnutls_priority_set() with 'empty' priority argument

Nikos Mavrogiannopoulos nmav at gnutls.org
Wed Dec 21 07:50:52 CET 2016


On Tue, Dec 20, 2016 at 3:07 PM, Tim Ruehsen <tim.ruehsen at gmx.de> wrote:
> Hi,
>
> Nikos, after your patch on the wget mailing list I checked wget2 code.
>
> In short:
> ##########
> static gnutls_priority_t
>         _priority_cache;
>
> if (priorities) /* priority string from somewhere */
>         gnutls_priority_init(&_priority_cache, priorities, NULL);
>
> /* ... later ... */
> gnutls_priority_set(session, _priority_cache);
> ##########
>
> So, by default we give an 'empty' gnutls_priority_t var to
> gnutls_priority_set().
>
> Q: is that correct resp. is that the same as
> gnutls_set_default_priority(session) ?

I don't think so. The behavior is most likely undefined. Do you check
the error code of gnutls_priority_check()?

> If not, should we call
>         gnutls_priority_init(&_priority_cache, "NORMAL", NULL);
> when no 'priorities' string is given ?

To simulate the set_default() you can call:
gnutls_priority_init(&_priority_cache, NULL, NULL);

I realized that this is not clearly documented.

regards,
Nikos



More information about the Gnutls-devel mailing list