diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2021-09-13 23:12:16 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-14 00:14:45 +0200 |
commit | d6cfa34667fe808975279c237d4ac9fe612631d8 (patch) | |
tree | 76a873fbbd1af254048bc4b1104c72cd589df34b /Userland/Libraries/LibWebSocket/Impl | |
parent | 1c9c43785d0f3b810e581a6d3267e52f566733b4 (diff) | |
download | serenity-d6cfa34667fe808975279c237d4ac9fe612631d8.zip |
AK: Make URL::m_port an Optional<u16>, Expose raw port getter
Our current way of signalling a missing port with m_port == 0 was
lacking, as 0 is a valid port number in URLs.
Diffstat (limited to 'Userland/Libraries/LibWebSocket/Impl')
-rw-r--r-- | Userland/Libraries/LibWebSocket/Impl/TCPWebSocketConnectionImpl.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWebSocket/Impl/TLSv12WebSocketConnectionImpl.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWebSocket/Impl/TCPWebSocketConnectionImpl.cpp b/Userland/Libraries/LibWebSocket/Impl/TCPWebSocketConnectionImpl.cpp index db25972710..709f28fc7f 100644 --- a/Userland/Libraries/LibWebSocket/Impl/TCPWebSocketConnectionImpl.cpp +++ b/Userland/Libraries/LibWebSocket/Impl/TCPWebSocketConnectionImpl.cpp @@ -34,7 +34,7 @@ void TCPWebSocketConnectionImpl::connect(ConnectionInfo const& connection) m_socket->on_connected = [this] { on_connected(); }; - bool success = m_socket->connect(connection.url().host(), connection.url().port()); + bool success = m_socket->connect(connection.url().host(), connection.url().port_or_default()); if (!success) { deferred_invoke([this] { on_connection_error(); diff --git a/Userland/Libraries/LibWebSocket/Impl/TLSv12WebSocketConnectionImpl.cpp b/Userland/Libraries/LibWebSocket/Impl/TLSv12WebSocketConnectionImpl.cpp index eb3595ac9e..370f77c4eb 100644 --- a/Userland/Libraries/LibWebSocket/Impl/TLSv12WebSocketConnectionImpl.cpp +++ b/Userland/Libraries/LibWebSocket/Impl/TLSv12WebSocketConnectionImpl.cpp @@ -42,7 +42,7 @@ void TLSv12WebSocketConnectionImpl::connect(ConnectionInfo const& connection) m_socket->on_tls_certificate_request = [](auto&) { // FIXME : Once we handle TLS certificate requests, handle it here as well. }; - bool success = m_socket->connect(connection.url().host(), connection.url().port()); + bool success = m_socket->connect(connection.url().host(), connection.url().port_or_default()); if (!success) { deferred_invoke([this] { on_connection_error(); |