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.
 
 

50 lines
1.2 KiB

#ifndef REQUESTRESPONSE
#define REQUESTRESPONSE
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
//This file contains definitions that are shared between requests and responses such as header
/*
* A struct reperesenting an http header
*/
typedef struct {
char *name;
// The spec doesn't specify a max size for headers, but nginx doesn't accept headers bigger than 4096 so that's probably ok for us
char *value;
} Header;
/*
* A linked list wrapper around the headers
*/
typedef struct HeaderList HeaderList;
struct HeaderList {
Header *header;
HeaderList *next;
};
//Creates a new header struct from a string like "Content-Length: 123"
Header* newHeader(char *str);
void freeHeader(Header *header);
//Adds a header to the end of a header list
void addHeader(HeaderList *headers, char *str);
void freeHeaderList(HeaderList *headers);
Header* getHeader(HeaderList *headers, char *name);
unsigned int countHeaders(HeaderList *headers);
unsigned int headerListCharLength(HeaderList *headers);
char* headersToString(HeaderList *headers);
#endif /* ifndef REQUESTRESPONSE
//THis file contains definitions that are shared between requests and responses such as header
*/