[#boost-urls-url-remove_port]
= xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/url.adoc[url]::remove&lowbar;port
:relfileprefix: ../../../
:mrdocs:

Remove the port

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:boost/urls/url.adoc[url]&
remove&lowbar;port() noexcept;
----

== Description

If a port exists, it is removed&period; The rest of the authority is unchanged&period;

== Example
[,cpp]
----
assert( url( "http://www.example.com:80" ).remove_port().authority().buffer() == "www.example.com" );
----
== Postconditions
[,cpp]
----
this->has_port() == false && this->port_number() == 0 && this->port() == ""
----
== Complexity
Linear in `this&hyphen;&gt;size()`&period;

== Exception Safety
Throws nothing&period;

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

port          = *DIGIT
----
== Specification
* https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3[]

== Return Value

`&ast;this`

== See Also

xref:boost/urls/url/set_port.adoc[`set&lowbar;port`]&period;


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