[#boost-urls-authority_view-encoded_host_and_port] = xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/authority_view.adoc[authority_view]::encoded_host_and_port :relfileprefix: ../../../ :mrdocs: Return the host and port == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L1321[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr xref:boost/urls/pct_string_view.adoc[pct_string_view] encoded_host_and_port() const noexcept; ---- == Description If an authority is present, this function returns the host and optional port as a string, which may be empty. Otherwise it returns an empty string. The returned string may contain percent escapes. == Example [,cpp] ---- assert( url_view( "http://www.example.com:8080/index.htm" ).encoded_host_and_port() == "www.example.com:8080" ); ---- == Complexity Constant. == Exception Safety Throws nothing. == BNF [,cpp] ---- authority = [ userinfo "@" ] host [ ":" port ] ---- == Specification * https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)] * https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3[3.2.3. Port (rfc3986)] == Return Value The host and port == See Also xref:boost/urls/authority_view/has_port.adoc[`has_port`], xref:boost/urls/authority_view/port.adoc[`port`], xref:boost/urls/authority_view/port_number.adoc[`port_number`]. [.small]#Created with https://www.mrdocs.com[MrDocs]#