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.
32 lines
1.1 KiB
32 lines
1.1 KiB
5 years ago
|
#ifndef SFRT_HTTP_REQUEST_H
|
||
|
#define SFRT_HTTP_REQUEST_H
|
||
|
|
||
|
#include <types.h>
|
||
|
|
||
|
/* all in-memory ptrs.. don't mess around with that! */
|
||
|
struct http_header {
|
||
|
char *key;
|
||
|
char *value;
|
||
|
};
|
||
|
|
||
|
struct http_request {
|
||
|
struct http_header headers[HTTP_HEADERS_MAX];
|
||
|
int header_count;
|
||
|
char * body;
|
||
|
int body_length;
|
||
5 years ago
|
int body_read_length; // How far we've read
|
||
5 years ago
|
// additional for http-parser
|
||
5 years ago
|
int last_was_value; // http-parser flag used to help the http-parser callbacks differentiate between header
|
||
|
// fields and values to know when to allocate a new header
|
||
5 years ago
|
int header_end; // boolean flag set when header processing is complete
|
||
|
int message_begin; // boolean flag set when body processing begins
|
||
|
int message_end; // boolean flag set when body processing is complete
|
||
|
};
|
||
|
|
||
|
/***************************************************
|
||
|
* General HTTP Request Functions *
|
||
|
**************************************************/
|
||
|
int http_request__get_body(struct http_request *http_request, char **body);
|
||
|
|
||
|
#endif /* SFRT_HTTP_HEADER_H */
|