Added support for completely disabling noexcept using MIJIN_TEST_NO_NOEXCEPT (for testing).

This commit is contained in:
2024-08-29 00:01:23 +02:00
parent a43f92fb58
commit 9ba097fc2f
41 changed files with 643 additions and 564 deletions

View File

@@ -10,6 +10,7 @@
#include "./socket.hpp"
#include "./url.hpp"
#include "../container/boxed_object.hpp"
#include "../internal/common.hpp"
#include "../io/stream.hpp"
namespace mijin
@@ -43,14 +44,14 @@ class HTTPStream
private:
Stream* base_;
public:
HTTPStream(Stream& base) noexcept : base_(&base)
HTTPStream(Stream& base) MIJIN_NOEXCEPT : base_(&base)
{
MIJIN_ASSERT(base_ != nullptr, "Invalid parameter for base.");
}
Task<StreamResult<HTTPResponse>> c_request(HTTPRequest request) noexcept;
Task<StreamResult<HTTPResponse>> c_request(HTTPRequest request) MIJIN_NOEXCEPT;
private:
Task<StreamError> c_writeRequest(const HTTPRequest& request) noexcept;
Task<StreamResult<HTTPResponse>> c_readResponse() noexcept;
Task<StreamError> c_writeRequest(const HTTPRequest& request) MIJIN_NOEXCEPT;
Task<StreamResult<HTTPResponse>> c_readResponse() MIJIN_NOEXCEPT;
};
class HTTPClient
@@ -63,12 +64,12 @@ private:
std::uint16_t lastPort_ = 0;
bool lastWasHttps_ = false;
public:
~HTTPClient() noexcept { disconnect(); }
Task<StreamResult<HTTPResponse>> c_request(ip_address_t address, std::uint16_t port, bool https, HTTPRequest request) noexcept;
Task<StreamResult<HTTPResponse>> c_request(const URL& url, HTTPRequest request = {}) noexcept;
void disconnect() noexcept;
~HTTPClient() MIJIN_NOEXCEPT { disconnect(); }
Task<StreamResult<HTTPResponse>> c_request(ip_address_t address, std::uint16_t port, bool https, HTTPRequest request) MIJIN_NOEXCEPT;
Task<StreamResult<HTTPResponse>> c_request(const URL& url, HTTPRequest request = {}) MIJIN_NOEXCEPT;
void disconnect() MIJIN_NOEXCEPT;
private:
StreamError createSocket(ip_address_t address, const std::string& hostname, std::uint16_t port, bool https) noexcept;
StreamError createSocket(ip_address_t address, const std::string& hostname, std::uint16_t port, bool https) MIJIN_NOEXCEPT;
};
}