NetServices: Add skeleton BHttpSession class and its documentation

Change-Id: Ia8a35588422908f6fe9b839ce239fb478baf298b
This commit is contained in:
Niels Sascha Reedijk 2021-09-13 07:37:49 +01:00
parent f54a5a68d7
commit ec7d71e612
12 changed files with 1199 additions and 0 deletions

View File

@ -852,6 +852,7 @@ INPUT = . \
../../headers/os/media \
../../headers/os/midi2 \
../../headers/os/net \
../../headers/private/netservices2 \
../../headers/os/storage \
../../headers/os/support \
../../headers/os/translation \

View File

@ -0,0 +1,374 @@
/*
* Copyright 2021 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Niels Sascha Reedijk, niels.reedijk@gmail.com
*
* Corresponds to:
* headers/os/support/ErrorsExt.h hrev?????
*/
#if __cplusplus >= 201703L
/*!
\file ErrorsExt.h
\ingroup netservices
\brief Defines advanced error types and error functions for the Network Services API.
\since Haiku R1
*/
namespace BPrivate {
namespace Network {
/*!
\class BError
\ingroup netservices
\brief Abstract base class for advanced error objects.
This class defines the minimum interface for advanced error objects in
modern parts of the Haiku API.
The minimum definition of an error is that it contains an \em origin and
a \em message. The origin should contain a string that helps a developer
identify the origin of the error. Common practise is to pass the
\c __PRETTY_FUNCTION__ from the place where the error is constructed, but
subclasses can have their own definitions for the origin.
The message is a freeform message that describes the exact error condition.
While it is not meant as a user-facing message, when creating custom error
objects, take into account that a user may be confronted with a message in
situations where an application presents it to a user as a final resort.
\note The advanced error objects are not used in the existing legacy Haiku
Kits. They are being tested for use in the modern parts of the API and are
therefore included in the network services kit.
\since Haiku R1
*/
/*!
\fn BError::BError(const char* error)
\brief Constructor that sets the \a origin.
\since Haiku R1
*/
/*!
\fn BError::BError(BString origin)
\brief Constructor that sets the \a origin.
\since Haiku R1
*/
/*!
\fn virtual BError::~BError() noexcept
\brief Standard destructor.
\since Haiku R1
*/
/*!
\fn BError::BError(const BError& other)
\brief Copy constructor.
\since Haiku R1
*/
/*!
\fn BError::BError(BError&& other) noexcept
\brief Move constructor.
\since Haiku R1
*/
/*!
\fn BError& BError::operator=(const BError& other)
\brief Copy assignment operator.
\since Haiku R1
*/
/*!
\fn BError& BError::operator=(BError&& other) noexcept
\brief Move assignment operator.
\since Haiku R1
*/
/*!
\fn virtual const char* BError::Message() const noexcept = 0
\brief Access the string representation of the message.
Implementations should return a meaningful description of the error that
occured. The primary target audience of these messages are developers, who
(hopefully) see them during development, testing or in bug reports.
However, if it makes sense to have the error messages be instructive to
users too, then do not hesitate to do so.
Implementations of this function should never return \c NULL.
\since Haiku R1
*/
/*!
\fn virtual const char* BError::Origin() const noexcept
\brief Access the string representation of the origin of the error.
The default implementation returns a pointer to the string that was set as
the origin when this object was constructed.
Implementations of this function should never return \c NULL.
\since Haiku R1
*/
/*!
\fn virtual BString BError::DebugMessage() const
\brief Retrieve a debug message that contains all info in this error.
\code
[Origin] Message of error
\endcode
\exception std::bad_alloc In the future this method may throw this
exception when the memory for the debug message cannot be allocated.
\return A \ref BString object that contains the debug message.
\since Haiku R1
*/
/*!
\fn void BError::WriteToStream(std::ostream& stream) const
\brief Write the error description to an output stream.
The default implementation will write the output of the \ref DebugMessage()
method, and append a newline.
\exception std::ios_base::failure Any error that is forwarded when writing
to the \a stream.
\since Haiku R1
*/
/*!
\fn size_t BError::WriteToOutput(BDataIO* output) const
\brief Write the error description to an output.
The default implementation will use the output from \ref DebugMessage()
and write it to the \a output, including a newline and the NUL that
terminates the string.
\exception BSystemError For any error that occurs when calling
\ref BDataIO::Write()
\returns The number of bytes that was written to \a output.
\since Haiku R1
*/
/*!
\class BRuntimeError
\ingroup netservices
\brief Advanced error object for runtime errors.
A \ref BRuntimeError is a concrete advanced error object that is used for
errors that happen during a program's execution and that by their nature
are outside of the scope of the control of the program.
Objects of this class store strings to the \em origin and the error
\em message. This class can be used as an error class or as a base to
create more specialized error types.
\since Haiku R1
*/
/*!
\fn BRuntimeError::BRuntimeError(const char* origin, const char* message)
\brief Constructor for a new error object.
\param origin A string representing where this error occured. It is advised
to initialize it to \c __PRETTY_FUNCTION__ by default.
\param message A string explaining the contents for the error. While it is
generally geared towards the developer, it may be useful to make the
error understandable by a user, as they may sometimes see it.
\since Haiku R1
*/
/*!
\fn BRuntimeError::BRuntimeError(const char* origin, BString message)
\copydoc BRuntimeError::BRuntimeError(const char* origin, const char* message)
*/
/*!
\fn BRuntimeError::BRuntimeError(BString origin, BString message)
\copydoc BRuntimeError::BRuntimeError(const char* origin, const char* message)
*/
/*!
\fn BRuntimeError::BRuntimeError(const BRuntimeError& other)
\brief Copy constructor.
\since Haiku R1
*/
/*!
\fn BRuntimeError::BRuntimeError(BRuntimeError&& other) noexcept
\brief Move constructor.
\since Haiku R1
*/
/*!
\fn BRuntimeError& BRuntimeError::operator=(const BRuntimeError& other)
\brief Copy assignment operator.
\since Haiku R1
*/
/*!
\fn BRuntimeError& BRuntimeError::operator=(BRuntimeError&& other) noexcept
\brief Move assignment operator.
\since Haiku R1
*/
/*!
\fn virtual const char* BRuntimeError::Message() const B_CXX_NOEXCEPT B_CXX_OVERRIDE
\brief Get a pointer to the message describing the runtime error.
*/
/*!
\class BSystemError
\ingroup netservices
\brief Advanced error object that wrap low-level system errors.
A \ref BSystemError is a concrete advanced error object that is used to
wrap tradition errors that are usually returned as a \c status_t. This type
takes the system error, and adds an \em origin specifier.
\since Haiku R1
*/
/*!
\fn BSystemError::BSystemError(const char* origin, status_t error)
\brief Create an object for \a error code with a specified \a origin.
\param origin A string representing where this error occured. As this
object usually wraps around a lower level API call, this should
usually be the call that the error code originated from.
\param error The error code.
\since Haiku R1
*/
/*!
\fn BSystemError::BSystemError(BString origin, status_t error)
\copydoc BSystemError::BSystemError(const char* origin, status_t error)
*/
/*!
\fn BSystemError::BSystemError(const BSystemError& other)
\brief Copy constructor.
\since Haiku R1
*/
/*!
\fn BSystemError::BSystemError(BSystemError&& other) noexcept
\brief Move constructor.
\since Haiku R1
*/
/*!
\fn BSystemError& BSystemError::operator=(const BSystemError& other)
\brief Copy assignment.
\since Haiku R1
*/
/*!
\fn BSystemError& BSystemError::operator=(BSystemError&& other) noexcept
\brief Move assignment operator.
\since Haiku R1
*/
/*!
\fn virtual const char* BSystemError::Message() const B_CXX_NOEXCEPT B_CXX_OVERRIDE
\brief Access the string representation of the message.
This returns the value of \c strerror() for the error code.
\since Haiku R1
*/
/*!
\fn virtual BString BSystemError::DebugMessage() const B_CXX_OVERRIDE
\brief Retrieve a debug message that contains all info in this error.
\code
[Origin] Message of error (error code)
\endcode
\exception std::bad_alloc In the future this method may throw this
exception when the memory for the debug message cannot be allocated.
\return A \ref BString object that contains the debug message.
\since Haiku R1
*/
/*!
\fn status_t BSystemError::Error() B_CXX_NOEXCEPT
\brief Get the error code for this error.
\since Haiku R1
*/
} // namespace Network
} // namespace BPrivate
#endif

View File

@ -0,0 +1,159 @@
/*
* Copyright 2021 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Niels Sascha Reedijk, niels.reedijk@gmail.com
*
* Corresponds to:
* headers/private/netservices2/HttpSession.h hrev?????
* src/kits/network/libnetservices2/HttpSession.cpp hrev?????
*/
#if __cplusplus >= 201703L
namespace BPrivate {
namespace Network {
/*!
\class BHttpSession
\ingroup netservices
\brief Schedule, execute and manage HTTP requests
All requests start from a `BHttpSession`. This class has the following jobs:
- Store data used between various HTTP calls
- Proxies
- Cookies
- Additional SSL certificates
- Authentication Data
- Manage the scheduling and execution of HTTP requests.
Objects of the `BHttpSession` class can be shared between different parts
of the application. They should be copied, rather than shared using
pointers. This is because they have an inner state that is shared between
the various objects.
\code
// Creating and sharing a session
auto session = BHttpSession();
// A copy is passed to window1 and window2, which share the same session data
auto window1 = new WindowWithSession(session);
auto window2 = new WindowWithSession(session);
// Add a cookie to the session, this cookie will be used in window1 and window2
BNetworkCookie cookie("key", "value", BUrl("https://example.com/"));
session.AddCookie(std::move(cookie));
// The session data persists, even if the original session goes out of scope
\endcode
There are specific scenarios for having more than one session, most notably
if an application provides services over HTTP whereby a user is identified
by cookies, and the application wants to support more than one user
account. But in most cases, there will be one instance of the BHttpSession
that is shared between various segments of the application.
\since Haiku R1
*/
/*!
\fn BHttpSession::BHttpSession()
\brief Construct a new object.
Each newly constructed object will have their own queue for HTTP requests,
as well as their own cookies and certificate store.
\exception std::bad_alloc Unable to allocate resources for the object.
\since Haiku R1
*/
/*!
\fn BHttpSession::BHttpSession(const BHttpSession&) noexcept
\brief Create a new BHttpSession object that shares a state with another.
The internal HTTP queue and context can be shared among multiple objects.
You can use the copy constructor to create a new object.
\since Haiku R1
*/
/*!
\fn BHttpSession::BHttpSession(BHttpSession&&) noexcept
\brief Move is disabled.
BHttpSession objects cannot be moved. Because it has a shared internal
state, making copies is cheap and it is the only supported method of
creating multiple scoped objects with a shared lifetime.
\since Haiku R1
*/
/*!
\fn BHttpSession::~BHttpSession() noexcept
\brief Destructor
The destructor releases the shared internal state of the session object.
If there are no more sessions using the shared state, the state is
cleaned up.
\since Haiku R1
*/
/*!
\fn BHttpSession& BHttpSession::operator=(const BHttpSession&) noexcept
\brief Copy and use the shared state from another session.
The internal HTTP queue and context can be shared among multiple objects.
You can use the copy constructor to create a new copy.
This copy assignment operator should be used in very specific instances
only, where there is a particular reason to replace an existing session
internal session with another. It should not be used in the following case:
\code
// Bad example
BHttpSession session1 = BHttpSession();
// Creates a new session, including an entirely new (expensive) state
BHttpSession session2 = BHttpSession();
// Creates another new session, including internal state
session2 = session1;
// At this stage, the internal state of session2 would
// have to be cleaned up just after it was created.
// Instead do this
BHttpSession session1 = BHttpSession();
BHttpSession session2(session1);
// Now session2 directly shares the state with session 1
\endcode
\since Haiku R1
*/
/*!
\fn BHttpSession& BHttpSession::operator=(BHttpSession&&) noexcept
\brief Move is disabled.
BHttpSession objects cannot be moved. Because it has a shared internal
state, making copies is cheap and it is the only supported method of
creating multiple scoped objects with a shared lifetime.
\since Haiku R1
*/
} // namespace Network
} // namespace BPrivate
#endif

View File

@ -0,0 +1,128 @@
/*
* Copyright 2021 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Niels Sascha Reedijk, niels.reedijk@gmail.com
*
* Corresponds to:
* headers/private/netservices2/NetServicesDefs.h hrev?????
*/
#if __cplusplus >= 201703L
namespace BPrivate {
namespace Network {
/*!
\class BUnsupportedProtocol
\ingroup netservices
\brief Error that indicates that the protocol is not supported.
\since Haiku R1
*/
/*!
\fn BUnsupportedProtocol::BUnsupportedProtocol(const char* origin,
BUrl url, BStringList supportedProtocols)
\brief Create a new error unsupported protocol error.
\param origin A string representing where this error occured. It is advised
to initialize it to \c __PRETTY_FUNCTION__ by default.
\param url The URL object with the unsupported protocol.
\param supportedProtocols A list with the supported protocols.
\since Haiku R1
*/
/*!
\fn BUnsupportedProtocol::BUnsupportedProtocol(BString origin, BUrl url,
BStringList supportedProtocols)
\copydoc BUnsupportedProtocol(const char*, BUrl, BStringList)
\since Haiku R1
*/
/*!
\fn virtual const char* BUnsupportedProtocol::Message() const noexcept override
\brief Access the string representation of the message.
\since Haiku R1
*/
/*!
\fn const BUrl& BUnsupportedProtocol::Url() const
\brief The URL that caused the issue.
\since Haiku R1
*/
/*!
\fn const BStringList& BUnsupportedProtocol::SupportedProtocols() const
\brief A list of protocols that are supported.
\since Haiku R1
*/
/*!
\class BInvalidUrl
\ingroup netservices
\brief Error that indicates that the URL is not valid.
This error is raised as an exception when the caller tries to pass a
\ref BUrl object that does not contain a valid URL.
\see \ref BUrl::IsValid()
\since Haiku R1
*/
/*!
\fn BInvalidUrl::BInvalidUrl(const char* origin, BUrl url)
\brief Create a new error invalid URL error.
\param origin A string representing where this error occured. It is advised
to initialize it to \c __PRETTY_FUNCTION__ by default.
\param url The URL object that did not contain a valid URL.
\since Haiku R1
*/
/*!
\fn BInvalidUrl::BInvalidUrl(BString origin, BUrl url)
\copydoc BInvalidUrl::BInvalidUrl(const char* origin, BUrl url)
*/
/*!
\fn virtual const char* BInvalidUrl::Message() const noexcept override
\brief Access the string representation of the message.
\since Haiku R1
*/
/*!
\fn const BUrl& BInvalidUrl::Url() const
\brief The URL that caused the issue.
\since Haiku R1
*/
} // namespace Network
} // namespace BPrivate
#endif

View File

@ -0,0 +1,95 @@
/*
* Copyright 2021 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _ERRORS_EXT_H
#define _ERRORS_EXT_H
#include <iosfwd>
#include <String.h>
#include <SupportDefs.h>
class BDataIO;
namespace BPrivate {
namespace Network {
class BError {
public:
BError(const char* origin);
BError(BString origin);
virtual ~BError() noexcept;
BError(const BError& error);
BError(BError&& error) noexcept;
BError& operator=(const BError& error);
BError& operator=(BError&& error) noexcept;
virtual const char* Message() const noexcept = 0;
virtual const char* Origin() const noexcept;
virtual BString DebugMessage() const;
void WriteToStream(std::ostream& stream) const;
size_t WriteToOutput(BDataIO* output) const;
private:
virtual void _ReservedError1();
virtual void _ReservedError2();
virtual void _ReservedError3();
virtual void _ReservedError4();
private:
BString fOrigin;
};
class BRuntimeError : public BError {
public:
BRuntimeError(const char* origin, const char* message);
BRuntimeError(const char* origin, BString message);
BRuntimeError(BString origin, BString message);
BRuntimeError(const BRuntimeError& other);
BRuntimeError(BRuntimeError&& other) noexcept;
BRuntimeError& operator=(const BRuntimeError& other);
BRuntimeError& operator=(BRuntimeError&& other) noexcept;
virtual const char* Message() const noexcept override;
private:
BString fMessage;
};
class BSystemError : public BError
{
public:
BSystemError(const char* origin, status_t error);
BSystemError(BString origin, status_t error);
BSystemError(const BSystemError& other);
BSystemError& operator=(const BSystemError& other);
#if __cplusplus >= 201103L
BSystemError(BSystemError&& other) noexcept;
BSystemError& operator=(BSystemError&& other) noexcept;
#endif
virtual const char* Message() const noexcept override;
virtual BString DebugMessage() const override;
status_t Error() noexcept;
private:
status_t fErrorCode;
};
} // namespace Network
} // Namespace BPrivate
#endif // _ERRORS_EXT_H

View File

@ -0,0 +1,40 @@
/*
* Copyright 2021 Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _B_HTTP_SESSION_H_
#define _B_HTTP_SESSION_H_
#include <memory>
class BUrl;
namespace BPrivate {
namespace Network {
class BHttpSession {
public:
// Constructors & Destructor
BHttpSession();
BHttpSession(const BHttpSession&) noexcept;
BHttpSession(BHttpSession&&) noexcept = delete;
~BHttpSession() noexcept;
// Assignment operators
BHttpSession& operator=(const BHttpSession&) noexcept;
BHttpSession& operator=(BHttpSession&&) noexcept = delete;
private:
struct Impl;
std::shared_ptr<Impl> fImpl;
};
}
}
#endif // _B_HTTP_REQUEST_H_

View File

@ -0,0 +1,57 @@
/*
* Copyright 2021 Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _NETSERVICES_DEFS_H_
#define _NETSERVICES_DEFS_H_
#include <ErrorsExt.h>
#include <StringList.h>
#include <Url.h>
namespace BPrivate {
namespace Network {
// Standard exceptions
class BUnsupportedProtocol : public BError {
public:
BUnsupportedProtocol(const char* origin, BUrl url,
BStringList supportedProtocols);
BUnsupportedProtocol(BString origin, BUrl url,
BStringList supportedProtocols);
virtual const char* Message() const noexcept override;
const BUrl& Url() const;
const BStringList& SupportedProtocols() const;
private:
BUrl fUrl;
BStringList fSupportedProtocols;
};
class BInvalidUrl : public BError {
public:
BInvalidUrl(const char* origin, BUrl url);
BInvalidUrl(BString origin, BUrl url);
virtual const char* Message() const noexcept override;
const BUrl& Url() const;
private:
BUrl fUrl;
};
}
}
#endif

View File

@ -2,3 +2,4 @@ SubDir HAIKU_TOP src kits network ;
SubInclude HAIKU_TOP src kits network libnetapi ;
SubInclude HAIKU_TOP src kits network libnetservices ;
SubInclude HAIKU_TOP src kits network libnetservices2 ;

View File

@ -0,0 +1,196 @@
/*
* Copyright 2021 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Niels Sascha Reedijk, niels.reedijk@gmail.com
*/
#include <ErrorsExt.h>
#include <iostream>
#include <sstream>
#include <DataIO.h>
using namespace BPrivate::Network;
BError::BError(const char* origin)
: fOrigin(BString(origin))
{
}
BError::BError(BString origin)
: fOrigin(std::move(origin))
{
}
BError::~BError() noexcept = default;
BError::BError(const BError& error) = default;
BError::BError(BError&& error) noexcept = default;
BError&
BError::operator=(const BError& error) = default;
BError&
BError::operator=(BError&& error) noexcept = default;
const char*
BError::Origin() const noexcept
{
return fOrigin.String();
}
BString
BError::DebugMessage() const
{
BString debugMessage;
debugMessage << "[" << Origin() << "] " << Message();
return debugMessage;
}
void
BError::WriteToStream(std::ostream& stream) const
{
stream << DebugMessage().String() << std::endl;
}
size_t
BError::WriteToOutput(BDataIO* output) const
{
std::stringstream stream;
WriteToStream(stream);
ssize_t result
= output->Write(stream.str().c_str(), stream.str().length() + 1);
if (result < 0)
throw BSystemError("BDataIO::Write()", result);
return static_cast<size_t>(result);
}
void BError::_ReservedError1() {}
void BError::_ReservedError2() {}
void BError::_ReservedError3() {}
void BError::_ReservedError4() {}
/* BRuntimeError */
BRuntimeError::BRuntimeError(const char* origin, const char* message)
:
BError(origin),
fMessage(BString(message))
{
}
BRuntimeError::BRuntimeError(const char* origin, BString message)
:
BError(origin),
fMessage(std::move(message))
{
}
BRuntimeError::BRuntimeError(BString origin, BString message)
:
BError(std::move(origin)),
fMessage(std::move(message))
{
}
BRuntimeError::BRuntimeError(const BRuntimeError& other) = default;
BRuntimeError::BRuntimeError(BRuntimeError&& other) noexcept = default;
BRuntimeError&
BRuntimeError::operator=(const BRuntimeError& other) = default;
BRuntimeError&
BRuntimeError::operator=(BRuntimeError&& other) noexcept = default;
const char*
BRuntimeError::Message() const noexcept
{
return fMessage.String();
}
/* BSystemError */
BSystemError::BSystemError(const char* origin, status_t error)
:
BError(origin),
fErrorCode(error)
{
}
BSystemError::BSystemError(BString origin, status_t error)
:
BError(std::move(origin)),
fErrorCode(error)
{
}
BSystemError::BSystemError(const BSystemError& other) = default;
BSystemError::BSystemError(BSystemError&& other) noexcept = default;
BSystemError&
BSystemError::operator=(const BSystemError& other) = default;
BSystemError&
BSystemError::operator=(BSystemError&& other) noexcept = default;
const char*
BSystemError::Message() const noexcept
{
return strerror(fErrorCode);
}
BString
BSystemError::DebugMessage() const
{
BString debugMessage;
debugMessage << "[" << Origin() << "] " << Message() << " (" << fErrorCode
<< ")";
return debugMessage;
}
status_t
BSystemError::Error() noexcept
{
return fErrorCode;
}

View File

@ -0,0 +1,37 @@
/*
* Copyright 2021 Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Niels Sascha Reedijk, niels.reedijk@gmail.com
*/
#include <HttpSession.h>
using namespace BPrivate::Network;
class BHttpSession::Impl {
};
BHttpSession::BHttpSession()
{
fImpl = std::make_shared<BHttpSession::Impl>();
}
BHttpSession::~BHttpSession()
{
}
BHttpSession::BHttpSession(const BHttpSession&) noexcept = default;
BHttpSession&
BHttpSession::operator=(const BHttpSession&) noexcept = default;

View File

@ -0,0 +1,25 @@
SubDir HAIKU_TOP src kits network libnetservices2 ;
UsePrivateHeaders netservices2 ;
local architectureObject ;
for architectureObject in [ MultiArchSubDirSetup ] {
on $(architectureObject) {
local architecture = $(TARGET_PACKAGING_ARCH) ;
# Only build on modern GCC
if $(TARGET_CC_IS_LEGACY_GCC_$(architecture)) = 1 {
continue ;
}
StaticLibrary [ MultiArchDefaultGristFiles libnetservices2.a ] :
ErrorsExt.cpp
HttpSession.cpp
NetServicesMisc.cpp
;
LinkAgainst [ MultiArchDefaultGristFiles libnetservices.a ] :
<$(architecture)>libshared.a ;
}
}

View File

@ -0,0 +1,86 @@
/*
* Copyright 2021 Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Niels Sascha Reedijk, niels.reedijk@gmail.com
*/
#include <NetServicesDefs.h>
using namespace BPrivate::Network;
BUnsupportedProtocol::BUnsupportedProtocol(const char* origin,
BUrl url, BStringList supportedProtocols)
:
BError(origin),
fUrl(std::move(url)),
fSupportedProtocols(std::move(supportedProtocols))
{
}
BUnsupportedProtocol::BUnsupportedProtocol(BString origin,
BUrl url, BStringList supportedProtocols)
:
BError(std::move(origin)),
fUrl(std::move(url)),
fSupportedProtocols(std::move(supportedProtocols))
{
}
const char*
BUnsupportedProtocol::Message() const noexcept
{
return "Unsupported Protocol";
}
const BUrl&
BUnsupportedProtocol::Url() const
{
return fUrl;
}
const BStringList&
BUnsupportedProtocol::SupportedProtocols() const
{
return fSupportedProtocols;
}
BInvalidUrl::BInvalidUrl(const char* origin, BUrl url)
:
BError(origin),
fUrl(std::move(url))
{
}
BInvalidUrl::BInvalidUrl(BString origin, BUrl url)
:
BError(std::move(origin)),
fUrl(std::move(origin))
{
}
const char*
BInvalidUrl::Message() const noexcept
{
return "Invalid URL";
}
const BUrl&
BInvalidUrl::Url() const
{
return fUrl;
}