Wip chunked decoding
+ Need to test normal body parsing + path_is_valid() renamed eval_file_type() + replaced atoi with strtol/strtoul
This commit is contained in:
@@ -5,19 +5,32 @@
|
||||
# include <vector>
|
||||
# include <string>
|
||||
# include <sstream>
|
||||
# include <cstdlib> // atoi
|
||||
# include <cstdlib> // strtol, strtoul
|
||||
# include <climits> // LONG_MAX
|
||||
# include <cerrno> // errno
|
||||
# include <sys/stat.h> // stat()
|
||||
# include <cctype> // tolower
|
||||
# include <algorithm> // transform
|
||||
# include <cstdio> // perror
|
||||
|
||||
# define CR "\r"
|
||||
# define LF "\n"
|
||||
# define CRLF CR LF
|
||||
# define CRLF_SIZE 2
|
||||
# define NPOS std::string::npos
|
||||
|
||||
# define IS_FILE 2
|
||||
# define IS_DIR 1
|
||||
# define IS_OTHER 0
|
||||
/* Equivalent for end of http header size :
|
||||
** std::string(CRLF CRLF).size();
|
||||
** sizeof(CRLF CRLF) - 1;
|
||||
** CRLF_SIZE*2
|
||||
*/
|
||||
|
||||
enum file_type
|
||||
{
|
||||
IS_OTHER,
|
||||
IS_FILE,
|
||||
IS_DIR
|
||||
};
|
||||
|
||||
enum http_method
|
||||
{
|
||||
@@ -46,7 +59,7 @@ std::string itos(int n);
|
||||
std::string trim(std::string str, char c);
|
||||
http_method str_to_http_method(std::string &str);
|
||||
std::string http_methods_to_str(unsigned int methods);
|
||||
int path_is_valid(std::string path);
|
||||
file_type eval_file_type(const std::string &path);
|
||||
void replace_all_substr(std::string &str, const std::string &ori_substr, const std::string &new_substr);
|
||||
std::string str_tolower(std::string str);
|
||||
void del_line_in_str(std::string * str, size_t pos, std::string delim);
|
||||
|
||||
Reference in New Issue
Block a user