mirror of
https://github.com/3lswear/webserv.git
synced 2025-10-28 21:07:59 +03:00
add error handling(header class)
This commit is contained in:
@@ -7,32 +7,43 @@ class Header
|
||||
{
|
||||
private:
|
||||
int _row;
|
||||
int _ret;
|
||||
int _fd;
|
||||
char *_buff;
|
||||
|
||||
|
||||
std::string _method;
|
||||
std::string _version;
|
||||
std::string _URI;
|
||||
std::string _query;
|
||||
std::string _fileToSend;
|
||||
std::map<std::string, std::string> _headerField;
|
||||
std::map<std::string, std::string> _errorCode;
|
||||
|
||||
|
||||
public:
|
||||
enum REQ
|
||||
{
|
||||
GET,
|
||||
POST,
|
||||
DELETE
|
||||
};
|
||||
|
||||
public:
|
||||
std::map<std::string, std::string> getRequest(void);
|
||||
std::map<std::string , std::string> getRequest(void);
|
||||
std::string getMethod(void);
|
||||
std::string getURI(void);
|
||||
std::string getReasonPhrase(std::string);
|
||||
std::string getReasonPhrase(int);
|
||||
std::string getErrorPage(int code);
|
||||
void setRawData(char *);
|
||||
void setFd(int);
|
||||
int getFd(void);
|
||||
|
||||
void initErrorCode(void);
|
||||
int checkURI(void);
|
||||
int isFile(std::string);
|
||||
int isDir(std::string);
|
||||
void OpenResponsFile(const char *path);
|
||||
|
||||
int parseStartLine(std::string);
|
||||
int parseHeaderfield(std::string);
|
||||
void printHeaderInfo(void);
|
||||
int parseRequest(void);
|
||||
|
||||
int sendRespons(int fd);
|
||||
int sendHeader(int fd);
|
||||
void clear(void);
|
||||
Header();
|
||||
Header(char *);
|
||||
|
||||
@@ -27,7 +27,10 @@
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <map>
|
||||
#include <fstream>
|
||||
#include "Socket.hpp"
|
||||
#include "Server.hpp"
|
||||
#include "Header.hpp"
|
||||
|
||||
Reference in New Issue
Block a user