2017-07-12 12:29:56 +08:00
|
|
|
#ifndef HTTP_H
|
|
|
|
#define HTTP_H
|
|
|
|
|
|
|
|
#include "main.h"
|
|
|
|
|
|
|
|
typedef struct tcp_connection {
|
|
|
|
char *ready_data, *incomplete_data;
|
|
|
|
int fd, ready_data_len, incomplete_data_len, sent_len;
|
2018-12-07 09:29:41 +08:00
|
|
|
unsigned int last_event_time;
|
2017-07-12 12:29:56 +08:00
|
|
|
uint16_t destPort;
|
|
|
|
unsigned reread_data :1;
|
2018-10-14 11:58:56 +08:00
|
|
|
unsigned request_type :1;
|
2018-12-07 09:29:41 +08:00
|
|
|
unsigned keep_alive :1;
|
2018-10-14 11:58:56 +08:00
|
|
|
unsigned is_ssl :1;
|
2017-07-12 12:29:56 +08:00
|
|
|
} conn_t;
|
|
|
|
|
|
|
|
extern void create_listen(char *ip, int port);
|
|
|
|
extern void *accept_loop(void *ptr);
|
|
|
|
extern void close_connection(conn_t *conn);
|
|
|
|
extern int8_t connectionToServer(char *ip, conn_t *server);
|
|
|
|
extern void tcp_in(conn_t *ct);
|
|
|
|
extern void tcp_out(conn_t *ct);
|
|
|
|
|
|
|
|
extern conn_t cts[MAX_CONNECTION];
|
|
|
|
extern char *local_header, *proxy_header, *ssl_proxy;
|
|
|
|
extern int lisFd, local_header_len, proxy_header_len;
|
2018-12-07 09:29:41 +08:00
|
|
|
extern uint8_t strict_spilce;
|
2017-07-12 12:29:56 +08:00
|
|
|
|
|
|
|
#endif
|