forked from rickydebojeet/http-load-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhttp_client.hh
61 lines (46 loc) · 1 KB
/
http_client.hh
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
#ifndef _HTTP_SERVER_HH_
#define _HTTP_SERVER_HH_
#include <iostream>
#include <sstream>
#include <string.h>
#include <netinet/in.h>
#include <netdb.h>
#include <signal.h>
#include <string>
#include <sys/time.h>
#include <pthread.h>
// Configuration
#define HOST "www.google.com"
#define URL "/"
#define PORT 443
#define SANITY_CHECK 0
#define OUTPUT 0
#define FAULT_EXIT 0
using namespace std;
float time_diff(struct timeval *, struct timeval *);
void *user_routine(void *args);
struct HTTP_Request
{
string HTTP_version;
string method;
string url;
// TODO : Add more fields if and when needed
string get_string(); // Return the string representation of the HTTP Request
HTTP_Request(string url); // Constructor
};
struct user_info
{
// User id
int user_id;
// socket info
int portno;
char *hostname;
float think_time;
// user metrics
int total_count;
float total_rtt;
//client port no
int cliport;
};
string send_request(string url);
#endif