Made the request stuff work.

This commit is contained in:
2024-10-23 23:55:28 +02:00
parent 77d46d986c
commit 0d00dec8c7
7 changed files with 352 additions and 47 deletions

View File

@@ -10,11 +10,21 @@
#include "./socket.hpp"
#include "./url.hpp"
#include "../container/boxed_object.hpp"
#include "../container/typeless_buffer.hpp"
#include "../internal/common.hpp"
#include "../io/stream.hpp"
namespace mijin
{
namespace http_method
{
inline constexpr std::string GET = "GET";
inline constexpr std::string POST = "POST";
inline constexpr std::string HEAD = "HEAD";
inline constexpr std::string PUT = "PUT";
inline constexpr std::string DELETE = "DELETE";
}
struct HTTPVersion
{
unsigned major;
@@ -30,13 +40,20 @@ struct HTTPRequest
std::string body;
};
struct HTTPRequestOptions
{
std::string method = "GET";
std::multimap<std::string, std::string> headers;
TypelessBuffer body;
};
struct HTTPResponse
{
HTTPVersion version;
unsigned status;
std::string statusMessage;
std::multimap<std::string, std::string> headers;
std::string content;
TypelessBuffer body;
};
class HTTPStream