Merge branch 'hugo3'

+ script output verification works (field duplicate and status)
+ parsing_message_http :
  - the file is deleted
  - of the three functions it contained, only one still exist
  - 'parse_http_headers' is now in utils
+ changes in utils :
  - http headers parsing doesn't change key case itself
  - a new function change key case tolower case in map<str, str>
  - added split_trim() that perform a split and a trim at once
  - resolved pbm in trim
  - added print_special to print special char '\r' and '\n'
  - del_line became extract_line, because it returns the deleted line
  - added get line, that does the same without deleting
  - moved http_header in utils, and made it more consistent
+ in Client :
  - parse_request is now named parse_request_headers to work with parse body
  - private function _parse_request_headers is then now _parse_request_fields
    (because it doesn't take care of request first line, but only fields)
  - added a debug function 'print_client'
This commit is contained in:
hugogogo
2022-08-12 14:05:11 +02:00
19 changed files with 374 additions and 184 deletions

View File

@@ -11,7 +11,6 @@
# include <arpa/inet.h> // htonl, htons, ntohl, ntohs, inet_addr, inet_ntoa
# include "utils.hpp"
# include "ServerConfig.hpp"
# include "parsing_message_http.hpp"
struct Script
{
@@ -72,12 +71,14 @@ class Client
std::string get_rq_script_info() const;
std::string get_rq_headers(const std::string & key) const;
void parse_request(std::vector<ServerConfig> &servers);
void parse_request_headers(std::vector<ServerConfig> &servers);
void parse_request_body();
void clear();
void clear_request();
void clear_script();
bool fill_script_path(std::string script);
// DEBUG
void print_client(std::string message = "");
private:
int _fd;
@@ -87,7 +88,7 @@ class Client
struct Request _request;
void _parse_request_line();
void _parse_request_headers();
void _parse_request_fields();
void _parse_request_uri( std::string uri );
void _parse_port_hostname(std::string host);