added multipart upload file,
it works, but need some adjustements, refactoring and testing
This commit is contained in:
@@ -18,6 +18,12 @@ struct Script
|
||||
std::string info;
|
||||
};
|
||||
|
||||
struct MultipartBody
|
||||
{
|
||||
std::map<std::string, std::string> headers;
|
||||
std::string body;
|
||||
};
|
||||
|
||||
struct Request
|
||||
{
|
||||
http_method method;
|
||||
@@ -27,6 +33,7 @@ struct Request
|
||||
std::string version;
|
||||
std::map<std::string, std::string> headers;
|
||||
std::string body;
|
||||
std::vector<MultipartBody> multi_bodys;
|
||||
std::string port;
|
||||
std::string hostname;
|
||||
struct Script script;
|
||||
@@ -71,6 +78,9 @@ class Client
|
||||
std::string get_rq_script_info() const;
|
||||
std::string get_rq_headers(const std::string & key) const;
|
||||
|
||||
const std::vector<MultipartBody> &get_rq_multi_bodys() const;
|
||||
const std::string get_rq_multi_bodys_headers(const std::string & key, std::vector<MultipartBody>::const_iterator body_it) const;
|
||||
|
||||
void parse_request_headers(std::vector<ServerConfig> &servers);
|
||||
void parse_request_body();
|
||||
void clear();
|
||||
@@ -91,7 +101,8 @@ class Client
|
||||
void _parse_request_fields();
|
||||
void _parse_request_target( std::string target );
|
||||
void _parse_port_hostname(std::string host);
|
||||
|
||||
void _parse_chunked_body(size_t pos);
|
||||
void _parse_multipart_body(size_t pos);
|
||||
void _check_request_errors();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user