-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRequest.hpp
More file actions
82 lines (75 loc) · 2.52 KB
/
Request.hpp
File metadata and controls
82 lines (75 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Request.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jfazi <jfazi@student.42nice.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/18 16:27:52 by jfazi #+# #+# */
/* Updated: 2024/09/07 16:22:49 by jfazi ### ########.fr */
/* */
/* ************************************************************************** */
#pragma once
#include "webserv.h"
#include "Response.hpp"
#include "Parsconfig.hpp"
#include "CGI.hpp"
#include <vector>
#include <string>
class Request
{
private:
std::string httpVersion;
E_Method method;
std::string filePath;
std::string host;
std::string connection;
std::string accept;
std::string acceptEncoding;
std::string acceptLanguages;
Parsconfig config;
std::string request;
SOCKET sock;
public:
Request(const std::string &request, SOCKET sock, const Parsconfig &serv);
~Request();
void setMethod(const Parsconfig &serv);
void setFilePath();
void setHTTPVersion();
bool CheckMethod(const Parsconfig &serv, const std::string &method);
bool CheckMethodSpe(const Parsconfig &serv, const std::string &method);
std::string getPath() const;
void deleteFile();
void uploadFile();
void post();
class BadMethodException : public std::exception
{
public:
virtual const char *what() const throw();
};
class BadFilePathException : public std::exception
{
public:
virtual const char *what() const throw();
};
class BadHTTPVersionException : public std::exception
{
public:
virtual const char *what() const throw();
};
class BadSintaxException : public std::exception
{
public:
virtual const char *what() const throw();
};
class RequestEntityTooLargeException : public std::exception
{
public:
virtual const char *what() const throw();
};
class DefaultFileException : public std::exception
{
public:
virtual const char *what() const throw();
};
};