[#boost-urls-url_view_base-has_authority]
= xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/url_view_base.adoc[url&lowbar;view&lowbar;base]::has&lowbar;authority
:relfileprefix: ../../../
:mrdocs:

Return true if an authority is present

== Synopsis

Declared in `&lt;https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#Lundefined[boost&sol;url&sol;url&lowbar;view&lowbar;base&period;hpp]&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
bool
has&lowbar;authority() const noexcept;
----

== Description

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

== Example

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

Constant&period;

== Exception Safety

Throws nothing&period;

== 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

* https://datatracker.ietf.org/doc/html/rfc3986#section-3.2[3&period;2&period; Authority (rfc3986)]

== Return Value

`true` if the url contains an authority&period;

== See Also

xref:boost/urls/url_view_base/authority.adoc[`authority`], xref:boost/urls/url_view_base/encoded_authority.adoc[`encoded&lowbar;authority`]&period;


[.small]#Created with https://www.mrdocs.com[MrDocs]#
