gnutls_compres...ate_set_methods(3)

πŸ’– gnutls_compress_certificate_set_methods πŸ’–

okay bestie, so this one is an API function from the gnutls manual (yes, the same gnutls your whole TLS life depends on, no biggie), and it's literally about certificate compression β€” the glow-up your handshake deserves. let's get into it πŸŽ€


✨ SYNOPSIS ✨

#include <gnutls/gnutls.h>

int gnutls_compress_certificate_set_methods(gnutls_session_t session,
const gnutls_compression_method_t * methods, size_t methods_len);

like, that's the whole vibe. three args, one int back, iconic.


🌸 ARGUMENTS 🌸

  • gnutls_session_t session β€” bestie, this is just a gnutls_session_t type. your session. your main character. ✨
  • const gnutls_compression_method_t * methods β€” a whole list of supported compression methods, like a little roster of faves.
  • size_t methods_len β€” how many compression methods are chillin' in methods. count them. don't lie about the count. πŸ’…

πŸ¦‹ DESCRIPTION πŸ¦‹

So what does this function actually do? It sets the supported compression methods for certificate compression for the given session. That's the whole job. And that list gets used for two things:

  • a) requesting the compression of the peer's certificate
  • b) selecting the method to compress the local certificate before sending it over to the peer

And the order matters, bestie β€” the method that shows up earlier in the list gets preferred over the later ones. first come, first slay. πŸ‘‘

But lowkey, even if you set the list of supported compression methods, compression might just... not happen. Because if the peer doesn't support any of your chosen compression methods, it's not used. the peer has to match your energy, fr fr. 😭

Now here's the part where you have to pay attention, because the list of supported compression methods must meet these criteria:

  • Argument methods must be an array of valid compression methods of type gnutls_compression_method_t.
  • Argument methods_len must contain the number of compression methods stored in the methods array, and must be within range <1, 127>.

Those length constraints are defined by the MIN_COMPRESS_CERTIFICATE_METHODS and MAX_COMPRESS_CERTIFICATE_METHODS macros, which are located in the header file compress_certificate.h. so if you're out here guessing numbers, go read the header instead. πŸ™ˆ

And if either methods or methods_len is equal to 0, the current list of supported compression methods will be unset. poof. gone. un-set. πŸ’€

⭐ RETURNS ⭐

  • GNUTLS_E_SUCCESS on success πŸŽ‰
  • otherwise a negative error code (booo, but at least it's honest)

Since 3.7.4 β€” she's been around a minute, she's established. πŸ’œ


🌈 REPORTING BUGS 🌈

Found a bug? Don't be shy, tell the devs:

they want to know. literally.


Copyright Β© 2001-2023 Free Software Foundation, Inc., and others.

Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. (translation: share it, remix it, just keep the receipts. that's the rule. periodt.)


🧚 SEE ALSO 🧚

The full documentation for gnutls is maintained as a Texinfo manual. If the /usr/share/doc/gnutls/ directory does not contain the HTML form, visit

https://www.gnutls.org/manual/


and that's the whole page, bestie 🫢 β€” brought to you by gnutls 3.8.13, aka the version tag that lives at the very bottom of the original manpage, which we are now respectfully honoring with this little sign-off. mwah. πŸ’…βœ¨

πŸ“¦ where this page comes from