gnutls_server_name_get(3)
π gnutls_server_name_get(3) π
okay bestie, welcome to the gnutls manual, page gnutls_server_name_get(3). this one's a lil baddie that lets you peek at the server name a client sent you. let's get into it π«Ά
β¨ NAME β¨
gnutls_server_name_get β an API function, and honestly? a whole vibe.
πΈ SYNOPSIS πΈ
#include <gnutls/gnutls.h>
int gnutls_server_name_get(gnutls_session_t session, void * data, size_t
* data_length, unsigned int * type, unsigned int indx);
π ARGUMENTS π
gnutls_session_t sessionβ it's agnutls_session_ttype. that's the session, your main character.void * dataβ this is gonna hold the data. the goods. the tea. β¨size_t * data_lengthβ will hold the data length. heads up: it must hold the maximum size ofdatawhen you pass it in.unsigned int * typeβ will hold the server name indicator type.unsigned int indxβ the index of the server_name. like, which one you want.
π¦ DESCRIPTION π¦
so this function lets you get the name indication (if there even is one, no cap) that a client has sent. and that name indication can be any of the enumeration gnutls_server_name_type_t. slay.
if type is GNUTLS_NAME_DNS, then this function is meant to be used by servers that support virtual hosting, and the data you get back will be a null terminated IDNA ACE string. important lore: prior to GnuTLS 3.4.0 it was a UTF-8 string instead. so if you're on ancient GnuTLS, adjust accordingly, bestie.
if data doesn't have enough size to hold the server name, you get GNUTLS_E_SHORT_MEMORY_BUFFER back, and data_length will hold the required size. so like, it tells you how much room to give it next time. iconic of it, honestly. π
indx is how you retrieve more than one server name, in case the client sent several. the first server name has an index of 0, the second 1, and so on and so forth. and if no name with the given index exists, you get GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE returned. π
β RETURNS β
on success, GNUTLS_E_SUCCESS (0) is returned. if there's a UTF-8 decoding error, GNUTLS_E_IDNA_ERROR is returned. otherwise, you get a negative error code. that's it, that's the vibe check.
π REPORTING BUGS π
found a bug? don't be shy, report it to <bugs@gnutls.org>.
home page: https://www.gnutls.org
π COPYRIGHT π
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. 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, go visit:
https://www.gnutls.org/manual/
okay that's the whole page bestie, you ate it ππ this was gnutls version 3.8.13, page gnutls_server_name_get(3), and yeah the date lives in that footer too β consider yourself fully caught up. go forth and read those server names. β¨π§
π¦ where this page comes from
- alpine 3.22: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- alpine 3.23: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- alpine 3.24: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- arch rolling: gnutls 3.8.13-3 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 43: gnutls-devel 3.8.13-1.fc43 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 43: gnutls-devel 3.8.13-1.fc43 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 44: gnutls-devel 3.8.13-1.fc44 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 44: gnutls-devel 3.8.13-1.fc44 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- ubuntu stonking: gnutls-doc 3.8.13-1ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms