-
Notifications
You must be signed in to change notification settings - Fork 0
/
WebParser.hpp
43 lines (39 loc) · 951 Bytes
/
WebParser.hpp
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
#ifndef WEBPARSER_HPP
#define WEBPARSER_HPP
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <stdint.h>
#include <fstream>
#include <time.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
using namespace std;
typedef struct HTTPState
{
string doc_root;
string method;
string url;
string clientHTMLVersion;
string host;
string response;
string content;
string type;
string lastModified;
long long size;
bool respond;
bool close;
} HTTPState;
class WebParser {
public:
static void parse(string insstr, HTTPState* state);
private:
static vector<string> splitter(string str, char delimiter);
static string verifyURL(string url, HTTPState* state);
static int fileExistence(const char *fileName);
static long long fileSize(const char* file );
static string getFileCreationTime(const char* path);
};
#endif // CALCPARSER_HPP