Added support for completely disabling noexcept using MIJIN_TEST_NO_NOEXCEPT (for testing).
This commit is contained in:
@@ -35,7 +35,7 @@ namespace mijin
|
||||
namespace
|
||||
{
|
||||
inline constexpr std::size_t CONTENT_LENGTH_LIMIT = 100 << 20; // 100MiB
|
||||
bool parseHTTPVersion(std::string_view version, HTTPVersion& outVersion) noexcept
|
||||
bool parseHTTPVersion(std::string_view version, HTTPVersion& outVersion) MIJIN_NOEXCEPT
|
||||
{
|
||||
std::vector<std::string_view> parts = split(version, ".");
|
||||
if (parts.size() != 2)
|
||||
@@ -46,7 +46,7 @@ bool parseHTTPVersion(std::string_view version, HTTPVersion& outVersion) noexcep
|
||||
}
|
||||
}
|
||||
|
||||
Task<StreamResult<HTTPResponse>> HTTPStream::c_request(HTTPRequest request) noexcept
|
||||
Task<StreamResult<HTTPResponse>> HTTPStream::c_request(HTTPRequest request) MIJIN_NOEXCEPT
|
||||
{
|
||||
if (const StreamError error = co_await c_writeRequest(request); error != StreamError::SUCCESS)
|
||||
{
|
||||
@@ -55,7 +55,7 @@ Task<StreamResult<HTTPResponse>> HTTPStream::c_request(HTTPRequest request) noex
|
||||
co_return co_await c_readResponse();
|
||||
}
|
||||
|
||||
Task<StreamError> HTTPStream::c_writeRequest(const mijin::HTTPRequest& request) noexcept
|
||||
Task<StreamError> HTTPStream::c_writeRequest(const mijin::HTTPRequest& request) MIJIN_NOEXCEPT
|
||||
{
|
||||
std::map<std::string, std::string> moreHeaders;
|
||||
if (!request.body.empty())
|
||||
@@ -94,7 +94,7 @@ Task<StreamError> HTTPStream::c_writeRequest(const mijin::HTTPRequest& request)
|
||||
co_return StreamError::SUCCESS;
|
||||
}
|
||||
|
||||
Task<StreamResult<HTTPResponse>> HTTPStream::c_readResponse() noexcept
|
||||
Task<StreamResult<HTTPResponse>> HTTPStream::c_readResponse() MIJIN_NOEXCEPT
|
||||
{
|
||||
std::string line;
|
||||
MIJIN_HTTP_READLINE(line);
|
||||
@@ -162,7 +162,7 @@ Task<StreamResult<HTTPResponse>> HTTPStream::c_readResponse() noexcept
|
||||
}
|
||||
|
||||
Task<StreamResult<HTTPResponse>> HTTPClient::c_request(ip_address_t address, std::uint16_t port, bool https,
|
||||
HTTPRequest request) noexcept
|
||||
HTTPRequest request) MIJIN_NOEXCEPT
|
||||
{
|
||||
std::string hostname;
|
||||
if (auto it = request.headers.find("host"); it != request.headers.end())
|
||||
@@ -190,7 +190,7 @@ Task<StreamResult<HTTPResponse>> HTTPClient::c_request(ip_address_t address, std
|
||||
co_return response;
|
||||
}
|
||||
|
||||
Task<StreamResult<HTTPResponse>> HTTPClient::c_request(const URL& url, HTTPRequest request) noexcept
|
||||
Task<StreamResult<HTTPResponse>> HTTPClient::c_request(const URL& url, HTTPRequest request) MIJIN_NOEXCEPT
|
||||
{
|
||||
if (url.getHost().empty())
|
||||
{
|
||||
@@ -241,7 +241,7 @@ Task<StreamResult<HTTPResponse>> HTTPClient::c_request(const URL& url, HTTPReque
|
||||
co_return co_await c_request(*ipAddress, port, https, std::move(request));
|
||||
}
|
||||
|
||||
void HTTPClient::disconnect() noexcept
|
||||
void HTTPClient::disconnect() MIJIN_NOEXCEPT
|
||||
{
|
||||
if (socket_ == nullptr)
|
||||
{
|
||||
@@ -251,7 +251,7 @@ void HTTPClient::disconnect() noexcept
|
||||
socket_ = nullptr;
|
||||
}
|
||||
|
||||
StreamError HTTPClient::createSocket(ip_address_t address, const std::string& hostname, std::uint16_t port, bool https) noexcept
|
||||
StreamError HTTPClient::createSocket(ip_address_t address, const std::string& hostname, std::uint16_t port, bool https) MIJIN_NOEXCEPT
|
||||
{
|
||||
if (socket_ != nullptr && address == lastIP_ && port == lastPort_ && https == lastWasHttps_)
|
||||
{
|
||||
@@ -282,6 +282,7 @@ StreamError HTTPClient::createSocket(ip_address_t address, const std::string& ho
|
||||
sslStream_ = std::move(sslStream);
|
||||
stream_.construct(*sslStream_);
|
||||
#else
|
||||
(void) hostname;
|
||||
return StreamError::NOT_SUPPORTED;
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user