+</code></pre></div><h2 id=description>DESCRIPTION<a class=headerlink href=#description title="Permanent link">¶</a></h2><p>SSL_SESSION_get0_hostname() retrieves the Server Name Indication (SNI) value that was sent by the client when the session was created if the server acknowledged the client's SNI extension by including an empty SNI extension in response. Otherwise NULL is returned.</p><p>The value returned is a pointer to memory maintained within <strong>s</strong> and should not be free'd.</p><p>SSL_SESSION_set1_hostname() sets the SNI value for the hostname to a copy of the string provided in hostname.</p><p>SSL_SESSION_get0_alpn_selected() retrieves the selected ALPN protocol for this session and its associated length in bytes. The returned value of <strong>*alpn</strong> is a pointer to memory maintained within <strong>s</strong> and should not be free'd.</p><p>SSL_SESSION_set1_alpn_selected() sets the ALPN protocol for this session to the value in <strong>alpn</strong> which should be of length <strong>len</strong> bytes. A copy of the input value is made, and the caller retains ownership of the memory pointed to by <strong>alpn</strong>.</p><h2 id=return-values>RETURN VALUES<a class=headerlink href=#return-values title="Permanent link">¶</a></h2><p>SSL_SESSION_get0_hostname() returns the SNI string if available, or NULL if not.</p><p>SSL_SESSION_set1_hostname() returns 1 on success or 0 on error.</p><p>SSL_SESSION_set1_alpn_selected() returns 1 on success or 0 on error.</p><h2 id=see-also>SEE ALSO<a class=headerlink href=#see-also title="Permanent link">¶</a></h2><p><a href=../../man7/ossl-guide-libssl-introduction/ >ssl(7)</a>, <a href=../d2i_SSL_SESSION/ >d2i_SSL_SESSION(3)</a>, <a href=../SSL_SESSION_get_time/ >SSL_SESSION_get_time(3)</a>, <a href=../SSL_SESSION_free/ >SSL_SESSION_free(3)</a></p><h2 id=history>HISTORY<a class=headerlink href=#history title="Permanent link">¶</a></h2><p>The SSL_SESSION_set1_hostname(), SSL_SESSION_get0_alpn_selected() and SSL_SESSION_set1_alpn_selected() functions were added in OpenSSL 1.1.1.</p><h2 id=copyright>COPYRIGHT<a class=headerlink href=#copyright title="Permanent link">¶</a></h2><p>Copyright 2016-2025 The OpenSSL Project Authors. All Rights Reserved.</p><p>Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <a href=https://www.openssl.org/source/license.html>https://www.openssl.org/source/license.html</a>.</p></article></div><script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script></div></main><footer class=md-footer><div class="md-footer-meta md-typeset"><div class="md-footer-meta__inner md-grid"><div class=md-copyright> Made with <a href=https://squidfunk.github.io/mkdocs-material/ target=_blank rel=noopener> Material for MkDocs </a></div></div></div></footer></div><div class=md-dialog data-md-component=dialog><div class="md-dialog__inner md-typeset"></div></div><script id=__config type=application/json>{"base": "../..", "features": ["navigation.indexes", "navigation.instant", "navigation.path", "navigation.prune", "navigation.tabs", "navigation.tabs.sticky", "navigation.tracking", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.b8dbb3d2.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": {"default": "master", "provider": "mike"}}</script><script src=../../assets/javascripts/bundle.ad660dcc.min.js></script></body></html>
0 commit comments