Yet Another Intercepting Proxy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
853 B

#ifndef REQUEST_H
#define REQUEST_H
#include <stdlib.h>
#include <stdio.h>
3 years ago
#include <stdbool.h>
#include <string.h>
#include <netinet/in.h>
#include <math.h>
#include "util.h"
#include "requestresponse.h"
/*
* A struct reperesenting an http request
*/
typedef struct {
// Common versions are: 0.9, 1.0, 1.1, 2.0
float version;
char *method;
char *protocol;
char *host;
char *path;
int port;
HeaderList *headers;
char *queryString;
void *body;
} Request;
Request* newRequest();
void requestFirstLine( Request *req, char line[] );
Request* newRequestFromSocket(int socket);
Request* newRequestFromString(char *string);
3 years ago
/*
* requestToString
* @prarm req the request to convert
*/
char* requestToString( Request *req );
3 years ago
void requestAddHeader( Request *req, char header[] );
void freeRequest( Request *req );
#endif /* ifndef REQUEST_H */