NNG_HTTP_SERVER_SET_TLS(3http)
π NNG_HTTP_SERVER_SET_TLS(3http)
okay bestie, welcome to the nng_http_server_set_tls page β that's section 3http of the NNG Reference Manual, and yes it's exactly as niche as it sounds but we're gonna slay it together π«Ά
β¨ NAME β¨
nng_http_server_set_tls β sets the TLS configuration for your HTTP server. that's it, that's the whole vibe π₯
πΈ SYNOPSIS πΈ
#include <nng/nng.h>
#include <nng/supplemental/http/http.h>
int nng_http_server_set_tls(nng_http_server *s, nng_tls_config *cfg);
π DESCRIPTION π
so nng_http_server_set_tls() takes the TLS configuration of server s and sets it to cfg. literally just handing your server its lil security outfit π
this change overwrites any previous TLS configuration, no cap. so if you had one before? gone. replaced. moving on π
β οΈ important, bestie, don't skip this one: this also invalidates any previously obtained values from nng_http_server_get_tls(). like, those pointers you grabbed earlier? they're not it anymore. don't be using stale stuff, i'm begging π
if the server is already running (i.e. it's been started with nng_http_server_start()) then this will fail with NNG_EBUSY. once the party's started you can't redecorate, fr fr π
π‘ tip: generally,cfgmust have a configured private key, set withnng_tls_config_own_cert()or similar. no key, no entry, iykyk ποΈ
β RETURN VALUES β
this function returns 0 on success, and non-zero otherwise. classic. that's the whole return section, she's brief π
π¦ ERRORS π¦
NNG_EBUSYβ server instance is running. she's occupied, she's booked, try again never (until she stops) πNNG_ENOMEMβ insufficient free memory exists. your RAM said "not today" πNNG_ENOTSUPβ either HTTP or TLS not supported. this build just doesn't have the range, and that's not on you π
π SEE ALSO π
nng_http_server_get_tls(3http)nng_http_server_hold(3http)nng_http_server_start(3http)nng_tls_config_alloc(3tls)nng_strerror(3)nng(7)
and that's the page, bestie π that was the NNG Reference Manual, dated 2026-01-13 β go set some TLS, you're gonna do amazing, main character energy only π§π
π¦ where this page comes from
- alpine 3.24: nng-doc 1.11-r0 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms