:relfileprefix: ../../../
[#boost-urls-url_view_base-has_authority]

= xref:boost.adoc[pass:[boost]]::xref:boost/urls.adoc[pass:[urls]]::xref:boost/urls/url_view_base.adoc[pass:[url_view_base]]::has_authority


Return true if an authority is present


== Synopsis

Declared in header `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L480[boost/url/url_view_base.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
bool
has_authority() const noexcept;
----

== Description


This function returns true if the url
contains an authority. The presence of
an authority is denoted by a double
slash ("&sol;&sol;") at the beginning or after
the scheme.

=== Example
[,cpp]
----
assert( url_view( "http://www.example.com/index.htm" ).has_authority() );
----

=== Complexity

Constant.

=== Exception Safety

Throws nothing.

=== BNF
[,cpp]
----
authority       = [ userinfo "@" ] host [ ":" port ]

URI             = scheme ":" hier-part [ "?" query ] [ "#" fragment ]

absolute-URI    = scheme ":" hier-part [ "?" query ]

URI-reference   = URI / relative-ref

relative-ref    = relative-part [ "?" query ] [ "#" fragment ]

hier-part       = "//" authority path-abempty
                ; (more...)

relative-part   = "//" authority path-abempty
                ; (more...)

----

=== Specification

* link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2[3.2. Authority (rfc3986)]








== See Also


xref:boost/urls/url_view_base/authority.adoc[authority]
,
xref:boost/urls/url_view_base/encoded_authority.adoc[encoded_authority]
.



