2024-09-13 15:09:52 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
#ifndef __TW_HTTP_H__
|
|
|
|
#define __TW_HTTP_H__
|
|
|
|
|
2024-09-14 09:59:15 +00:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
2024-09-18 09:19:03 +00:00
|
|
|
#include "../config.h"
|
|
|
|
|
2024-09-13 15:09:52 +00:00
|
|
|
struct tw_http_request {
|
|
|
|
char* method;
|
|
|
|
char* path;
|
2024-09-14 09:59:15 +00:00
|
|
|
char* query;
|
2024-09-13 15:09:52 +00:00
|
|
|
char* version;
|
|
|
|
char** headers;
|
|
|
|
char* body;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct tw_http_response {
|
|
|
|
char** headers;
|
2024-09-14 09:59:15 +00:00
|
|
|
int status;
|
|
|
|
bool _processed; /* Internal parameter */
|
2024-09-13 15:09:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef SOURCE
|
2024-09-18 09:19:03 +00:00
|
|
|
#ifndef NO_SSL
|
2024-09-13 15:09:52 +00:00
|
|
|
#include <openssl/ssl.h>
|
2024-09-18 09:19:03 +00:00
|
|
|
#endif
|
2024-09-16 12:42:19 +00:00
|
|
|
void tw_free_request(struct tw_http_request* req);
|
2024-09-18 09:19:03 +00:00
|
|
|
#ifndef NO_SSL
|
2024-09-13 15:09:52 +00:00
|
|
|
int tw_http_parse(SSL* ssl, int sock, struct tw_http_request* req);
|
2024-09-18 09:19:03 +00:00
|
|
|
#else
|
|
|
|
int tw_http_parse(void* ssl, int sock, struct tw_http_request* req);
|
|
|
|
#endif
|
2024-09-13 15:09:52 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|