Renamed rev_proxy -> proxy

This commit is contained in:
2022-12-13 19:53:15 +01:00
parent 74c97a512f
commit b422b37806
11 changed files with 169 additions and 169 deletions

View File

@ -170,7 +170,7 @@ int config_load(const char *filename) {
}
} else if (len > 9 && strncmp(ptr, "hostname", 8) == 0 && (ptr[8] == ' ' || ptr[8] == '\t')) {
source = ptr + 8;
target = hc->rev_proxy.hostname;
target = hc->proxy.hostname;
if (hc->type != 0 && hc->type != CONFIG_TYPE_REVERSE_PROXY) {
goto err;
} else {
@ -190,7 +190,7 @@ int config_load(const char *filename) {
goto err;
} else {
hc->type = CONFIG_TYPE_REVERSE_PROXY;
hc->rev_proxy.enc = 0;
hc->proxy.enc = 0;
}
continue;
} else if (strcmp(ptr, "https") == 0) {
@ -198,7 +198,7 @@ int config_load(const char *filename) {
goto err;
} else {
hc->type = CONFIG_TYPE_REVERSE_PROXY;
hc->rev_proxy.enc = 1;
hc->proxy.enc = 1;
}
continue;
} else {
@ -229,7 +229,7 @@ int config_load(const char *filename) {
goto err;
}
} else if (mode == 2) {
tmp_config->hosts[i - 1].rev_proxy.port = (unsigned short) strtoul(source, NULL, 10);
tmp_config->hosts[i - 1].proxy.port = (unsigned short) strtoul(source, NULL, 10);
}
}

View File

@ -34,7 +34,7 @@ typedef struct {
char hostname[256];
unsigned short port;
unsigned char enc:1;
} rev_proxy;
} proxy;
struct {
char webroot[256];
unsigned char dir_mode:2;

View File

@ -118,7 +118,7 @@ extern const int http_statuses_size;
extern const int http_status_messages_size;
extern const char http_default_document[];
extern const char http_rev_proxy_document[];
extern const char http_proxy_document[];
extern const char http_error_document[];
extern const char http_error_icon[];
extern const char http_warning_document[];

View File

@ -212,7 +212,7 @@ const char http_default_document[] =
"</body>\n"
"</html>\n";
const char http_rev_proxy_document[] =
const char http_proxy_document[] =
"\t\t<section class=\"error-ctx\">\n"
"\t\t\t<div class=\"box%1$s\">\n"
"\t\t\t\t<div class=\"content\">\n"

View File

@ -1,7 +1,7 @@
/**
* sesimos - secure, simple, modern web server
* @brief Reverse proxy
* @file src/lib/rev_proxy.c
* @file src/lib/proxy.c
* @author Lorenz Stechauner
* @date 2021-01-07
*/
@ -9,7 +9,7 @@
#include "../defs.h"
#include "../server.h"
#include "../logger.h"
#include "rev_proxy.h"
#include "proxy.h"
#include "utils.h"
#include "compress.h"
@ -21,16 +21,16 @@
#include <sys/time.h>
sock rev_proxy;
char *rev_proxy_host = NULL;
sock proxy;
char *proxy_host = NULL;
struct timeval server_timeout = {.tv_sec = SERVER_TIMEOUT, .tv_usec = 0};
int rev_proxy_preload(void) {
rev_proxy.ctx = SSL_CTX_new(TLS_client_method());
int proxy_preload(void) {
proxy.ctx = SSL_CTX_new(TLS_client_method());
return 0;
}
int rev_proxy_request_header(http_req *req, int enc, client_ctx_t *ctx) {
int proxy_request_header(http_req *req, int enc, client_ctx_t *ctx) {
char buf1[256], buf2[256];
int p_len;
@ -128,7 +128,7 @@ int rev_proxy_request_header(http_req *req, int enc, client_ctx_t *ctx) {
return 0;
}
int rev_proxy_response_header(http_req *req, http_res *res, host_config *conf) {
int proxy_response_header(http_req *req, http_res *res, host_config *conf) {
char buf1[256], buf2[256];
int p_len;
@ -152,7 +152,7 @@ int rev_proxy_response_header(http_req *req, http_res *res, host_config *conf) {
const char *location = http_get_header_field(&res->hdr, "Location");
if (location != NULL) {
char *hostnames[] = {conf->name, conf->rev_proxy.hostname};
char *hostnames[] = {conf->name, conf->proxy.hostname};
for (int i = 0; i < sizeof(hostnames) / sizeof(hostnames[0]); i++) {
char *hostname = hostnames[i];
@ -162,10 +162,10 @@ int rev_proxy_response_header(http_req *req, http_res *res, host_config *conf) {
p_len = snprintf(buf1, sizeof(buf1), "https://%s/", hostname);
if (strncmp(location, buf1, p_len) == 0) goto match;
p_len = snprintf(buf1, sizeof(buf1), "http://%s:%i/", hostname, conf->rev_proxy.port);
p_len = snprintf(buf1, sizeof(buf1), "http://%s:%i/", hostname, conf->proxy.port);
if (strncmp(location, buf1, p_len) == 0) goto match;
p_len = snprintf(buf1, sizeof(buf1), "https://%s:%i/", hostname, conf->rev_proxy.port);
p_len = snprintf(buf1, sizeof(buf1), "https://%s:%i/", hostname, conf->proxy.port);
if (strncmp(location, buf1, p_len) == 0) goto match;
}
@ -180,25 +180,25 @@ int rev_proxy_response_header(http_req *req, http_res *res, host_config *conf) {
return 0;
}
int rev_proxy_init(http_req *req, http_res *res, http_status_ctx *ctx, host_config *conf, sock *client, client_ctx_t *cctx, http_status *custom_status, char *err_msg) {
int proxy_init(http_req *req, http_res *res, http_status_ctx *ctx, host_config *conf, sock *client, client_ctx_t *cctx, http_status *custom_status, char *err_msg) {
char buffer[CHUNK_SIZE];
const char *connection, *upgrade, *ws_version;
long ret;
int tries = 0, retry = 0;
if (rev_proxy.socket != 0 && strcmp(rev_proxy_host, conf->name) == 0 && sock_check(&rev_proxy) == 0)
goto rev_proxy;
if (proxy.socket != 0 && strcmp(proxy_host, conf->name) == 0 && sock_check(&proxy) == 0)
goto proxy;
retry:
if (rev_proxy.socket != 0) {
if (proxy.socket != 0) {
info(BLUE_STR "Closing proxy connection");
sock_close(&rev_proxy);
sock_close(&proxy);
}
retry = 0;
tries++;
rev_proxy.socket = socket(AF_INET6, SOCK_STREAM, 0);
if (rev_proxy.socket < 0) {
proxy.socket = socket(AF_INET6, SOCK_STREAM, 0);
if (proxy.socket < 0) {
error("Unable to create socket");
res->status = http_get_status(500);
ctx->origin = INTERNAL;
@ -207,14 +207,14 @@ int rev_proxy_init(http_req *req, http_res *res, http_status_ctx *ctx, host_conf
server_timeout.tv_sec = SERVER_TIMEOUT_INIT;
server_timeout.tv_usec = 0;
if (setsockopt(rev_proxy.socket, SOL_SOCKET, SO_RCVTIMEO, &server_timeout, sizeof(server_timeout)) < 0)
goto rev_proxy_timeout_err;
if (setsockopt(rev_proxy.socket, SOL_SOCKET, SO_SNDTIMEO, &server_timeout, sizeof(server_timeout)) < 0)
goto rev_proxy_timeout_err;
if (setsockopt(proxy.socket, SOL_SOCKET, SO_RCVTIMEO, &server_timeout, sizeof(server_timeout)) < 0)
goto proxy_timeout_err;
if (setsockopt(proxy.socket, SOL_SOCKET, SO_SNDTIMEO, &server_timeout, sizeof(server_timeout)) < 0)
goto proxy_timeout_err;
struct hostent *host_ent = gethostbyname2(conf->rev_proxy.hostname, AF_INET6);
struct hostent *host_ent = gethostbyname2(conf->proxy.hostname, AF_INET6);
if (host_ent == NULL) {
host_ent = gethostbyname2(conf->rev_proxy.hostname, AF_INET);
host_ent = gethostbyname2(conf->proxy.hostname, AF_INET);
if (host_ent == NULL) {
res->status = http_get_status(503);
ctx->origin = SERVER_REQ;
@ -224,7 +224,7 @@ int rev_proxy_init(http_req *req, http_res *res, http_status_ctx *ctx, host_conf
}
}
struct sockaddr_in6 address = {.sin6_family = AF_INET6, .sin6_port = htons(conf->rev_proxy.port)};
struct sockaddr_in6 address = {.sin6_family = AF_INET6, .sin6_port = htons(conf->proxy.port)};
if (host_ent->h_addrtype == AF_INET6) {
memcpy(&address.sin6_addr, host_ent->h_addr_list[0], host_ent->h_length);
} else if (host_ent->h_addrtype == AF_INET) {
@ -235,8 +235,8 @@ int rev_proxy_init(http_req *req, http_res *res, http_status_ctx *ctx, host_conf
inet_ntop(address.sin6_family, (void *) &address.sin6_addr, buffer, sizeof(buffer));
info(BLUE_STR "Connecting to " BLD_STR "[%s]:%i" CLR_STR BLUE_STR "...", buffer, conf->rev_proxy.port);
if (connect(rev_proxy.socket, (struct sockaddr *) &address, sizeof(address)) < 0) {
info(BLUE_STR "Connecting to " BLD_STR "[%s]:%i" CLR_STR BLUE_STR "...", buffer, conf->proxy.port);
if (connect(proxy.socket, (struct sockaddr *) &address, sizeof(address)) < 0) {
if (errno == ETIMEDOUT || errno == EINPROGRESS) {
res->status = http_get_status(504);
ctx->origin = SERVER_REQ;
@ -247,17 +247,17 @@ int rev_proxy_init(http_req *req, http_res *res, http_status_ctx *ctx, host_conf
res->status = http_get_status(500);
ctx->origin = INTERNAL;
}
error("Unable to connect to [%s]:%i: %s", buffer, conf->rev_proxy.port, strerror(errno));
error("Unable to connect to [%s]:%i: %s", buffer, conf->proxy.port, strerror(errno));
sprintf(err_msg, "Unable to connect to server: %s.", strerror(errno));
goto proxy_err;
}
server_timeout.tv_sec = SERVER_TIMEOUT;
server_timeout.tv_usec = 0;
if (setsockopt(rev_proxy.socket, SOL_SOCKET, SO_RCVTIMEO, &server_timeout, sizeof(server_timeout)) < 0)
goto rev_proxy_timeout_err;
if (setsockopt(rev_proxy.socket, SOL_SOCKET, SO_SNDTIMEO, &server_timeout, sizeof(server_timeout)) < 0) {
rev_proxy_timeout_err:
if (setsockopt(proxy.socket, SOL_SOCKET, SO_RCVTIMEO, &server_timeout, sizeof(server_timeout)) < 0)
goto proxy_timeout_err;
if (setsockopt(proxy.socket, SOL_SOCKET, SO_SNDTIMEO, &server_timeout, sizeof(server_timeout)) < 0) {
proxy_timeout_err:
res->status = http_get_status(500);
ctx->origin = INTERNAL;
error("Unable to set timeout for reverse proxy socket");
@ -265,29 +265,29 @@ int rev_proxy_init(http_req *req, http_res *res, http_status_ctx *ctx, host_conf
goto proxy_err;
}
if (conf->rev_proxy.enc) {
rev_proxy.ssl = SSL_new(rev_proxy.ctx);
SSL_set_fd(rev_proxy.ssl, rev_proxy.socket);
SSL_set_connect_state(rev_proxy.ssl);
if (conf->proxy.enc) {
proxy.ssl = SSL_new(proxy.ctx);
SSL_set_fd(proxy.ssl, proxy.socket);
SSL_set_connect_state(proxy.ssl);
ret = SSL_do_handshake(rev_proxy.ssl);
rev_proxy._last_ret = ret;
rev_proxy._errno = errno;
rev_proxy._ssl_error = ERR_get_error();
rev_proxy.enc = 1;
ret = SSL_do_handshake(proxy.ssl);
proxy._last_ret = ret;
proxy._errno = errno;
proxy._ssl_error = ERR_get_error();
proxy.enc = 1;
if (ret < 0) {
res->status = http_get_status(502);
ctx->origin = SERVER_REQ;
error("Unable to perform handshake: %s", sock_strerror(&rev_proxy));
sprintf(err_msg, "Unable to perform handshake: %s.", sock_strerror(&rev_proxy));
error("Unable to perform handshake: %s", sock_strerror(&proxy));
sprintf(err_msg, "Unable to perform handshake: %s.", sock_strerror(&proxy));
goto proxy_err;
}
}
rev_proxy_host = conf->name;
info(BLUE_STR "Established new connection with " BLD_STR "[%s]:%i", buffer, conf->rev_proxy.port);
proxy_host = conf->name;
info(BLUE_STR "Established new connection with " BLD_STR "[%s]:%i", buffer, conf->proxy.port);
rev_proxy:
proxy:
connection = http_get_header_field(&req->hdr, "Connection");
if (connection != NULL && (strstr(connection, "upgrade") != NULL || strstr(connection, "Upgrade") != NULL)) {
upgrade = http_get_header_field(&req->hdr, "Upgrade");
@ -304,19 +304,19 @@ int rev_proxy_init(http_req *req, http_res *res, http_status_ctx *ctx, host_conf
http_add_header_field(&req->hdr, "Connection", "keep-alive");
}
ret = rev_proxy_request_header(req, (int) client->enc, cctx);
ret = proxy_request_header(req, (int) client->enc, cctx);
if (ret != 0) {
res->status = http_get_status(500);
ctx->origin = INTERNAL;
return -1;
}
ret = http_send_request(&rev_proxy, req);
ret = http_send_request(&proxy, req);
if (ret < 0) {
res->status = http_get_status(502);
ctx->origin = SERVER_REQ;
error("Unable to send request to server (1): %s", sock_strerror(&rev_proxy));
sprintf(err_msg, "Unable to send request to server: %s.", sock_strerror(&rev_proxy));
error("Unable to send request to server (1): %s", sock_strerror(&proxy));
sprintf(err_msg, "Unable to send request to server: %s.", sock_strerror(&proxy));
retry = tries < 4;
goto proxy_err;
}
@ -327,17 +327,17 @@ int rev_proxy_init(http_req *req, http_res *res, http_status_ctx *ctx, host_conf
ret = 0;
if (content_len > 0) {
ret = sock_splice(&rev_proxy, client, buffer, sizeof(buffer), content_len);
ret = sock_splice(&proxy, client, buffer, sizeof(buffer), content_len);
} else if (transfer_encoding != NULL && strstr(transfer_encoding, "chunked") != NULL) {
ret = sock_splice_chunked(&rev_proxy, client, buffer, sizeof(buffer));
ret = sock_splice_chunked(&proxy, client, buffer, sizeof(buffer));
}
if (ret < 0 || (content_len != 0 && ret != content_len)) {
if (ret == -1) {
res->status = http_get_status(502);
ctx->origin = SERVER_REQ;
error("Unable to send request to server (2): %s", sock_strerror(&rev_proxy));
sprintf(err_msg, "Unable to send request to server: %s.", sock_strerror(&rev_proxy));
error("Unable to send request to server (2): %s", sock_strerror(&proxy));
sprintf(err_msg, "Unable to send request to server: %s.", sock_strerror(&proxy));
retry = tries < 4;
goto proxy_err;
} else if (ret == -2) {
@ -353,9 +353,9 @@ int rev_proxy_init(http_req *req, http_res *res, http_status_ctx *ctx, host_conf
return -1;
}
ret = sock_recv(&rev_proxy, buffer, sizeof(buffer), MSG_PEEK);
ret = sock_recv(&proxy, buffer, sizeof(buffer), MSG_PEEK);
if (ret <= 0) {
int enc_err = sock_enc_error(&rev_proxy);
int enc_err = sock_enc_error(&proxy);
if (errno == EAGAIN || errno == EINPROGRESS || enc_err == SSL_ERROR_WANT_READ ||
enc_err == SSL_ERROR_WANT_WRITE)
{
@ -365,8 +365,8 @@ int rev_proxy_init(http_req *req, http_res *res, http_status_ctx *ctx, host_conf
res->status = http_get_status(502);
ctx->origin = SERVER_RES;
}
error("Unable to receive response from server: %s", sock_strerror(&rev_proxy));
sprintf(err_msg, "Unable to receive response from server: %s.", sock_strerror(&rev_proxy));
error("Unable to receive response from server: %s", sock_strerror(&proxy));
sprintf(err_msg, "Unable to receive response from server: %s.", sock_strerror(&proxy));
retry = tries < 4;
goto proxy_err;
}
@ -440,9 +440,9 @@ int rev_proxy_init(http_req *req, http_res *res, http_status_ctx *ctx, host_conf
}
ptr = pos0 + 2;
}
sock_recv(&rev_proxy, buffer, header_len, 0);
sock_recv(&proxy, buffer, header_len, 0);
ret = rev_proxy_response_header(req, res, conf);
ret = proxy_response_header(req, res, conf);
if (ret != 0) {
res->status = http_get_status(500);
ctx->origin = INTERNAL;
@ -456,42 +456,42 @@ int rev_proxy_init(http_req *req, http_res *res, http_status_ctx *ctx, host_conf
return -1;
}
int rev_proxy_send(sock *client, unsigned long len_to_send, int flags) {
int proxy_send(sock *client, unsigned long len_to_send, int flags) {
char buffer[CHUNK_SIZE], comp_out[CHUNK_SIZE], buf[256], *ptr;
long ret = 0, len, snd_len;
int finish_comp = 0;
compress_ctx comp_ctx;
if (flags & REV_PROXY_COMPRESS_BR) {
flags &= ~REV_PROXY_COMPRESS_GZ;
if (flags & PROXY_COMPRESS_BR) {
flags &= ~PROXY_COMPRESS_GZ;
if (compress_init(&comp_ctx, COMPRESS_BR) != 0) {
error("Unable to init brotli");
flags &= ~REV_PROXY_COMPRESS_BR;
flags &= ~PROXY_COMPRESS_BR;
}
} else if (flags & REV_PROXY_COMPRESS_GZ) {
flags &= ~REV_PROXY_COMPRESS_BR;
} else if (flags & PROXY_COMPRESS_GZ) {
flags &= ~PROXY_COMPRESS_BR;
if (compress_init(&comp_ctx, COMPRESS_GZ) != 0) {
error("Unable to init gzip");
flags &= ~REV_PROXY_COMPRESS_GZ;
flags &= ~PROXY_COMPRESS_GZ;
}
}
do {
snd_len = 0;
if (flags & REV_PROXY_CHUNKED) {
ret = sock_get_chunk_header(&rev_proxy);
if (flags & PROXY_CHUNKED) {
ret = sock_get_chunk_header(&proxy);
if (ret < 0) {
if (ret == -1) {
error("Unable to receive from server: Malformed chunk header");
} else {
error("Unable to receive from server: %s", sock_strerror(&rev_proxy));
error("Unable to receive from server: %s", sock_strerror(&proxy));
}
break;
}
len_to_send = ret;
ret = 1;
if (len_to_send == 0 && (flags & REV_PROXY_COMPRESS)) {
if (len_to_send == 0 && (flags & PROXY_COMPRESS)) {
finish_comp = 1;
len = 0;
ptr = NULL;
@ -502,9 +502,9 @@ int rev_proxy_send(sock *client, unsigned long len_to_send, int flags) {
}
while (snd_len < len_to_send) {
unsigned long avail_in, avail_out;
ret = sock_recv(&rev_proxy, buffer, CHUNK_SIZE < (len_to_send - snd_len) ? CHUNK_SIZE : len_to_send - snd_len, 0);
ret = sock_recv(&proxy, buffer, CHUNK_SIZE < (len_to_send - snd_len) ? CHUNK_SIZE : len_to_send - snd_len, 0);
if (ret <= 0) {
error("Unable to receive from server: %s", sock_strerror(&rev_proxy));
error("Unable to receive from server: %s", sock_strerror(&proxy));
break;
}
len = ret;
@ -514,7 +514,7 @@ int rev_proxy_send(sock *client, unsigned long len_to_send, int flags) {
char *next_in = ptr;
do {
long buf_len = len;
if (flags & REV_PROXY_COMPRESS) {
if (flags & PROXY_COMPRESS) {
avail_out = sizeof(comp_out);
compress_compress(&comp_ctx, next_in + len - avail_in, &avail_in, comp_out, &avail_out, finish_comp);
ptr = comp_out;
@ -525,31 +525,31 @@ int rev_proxy_send(sock *client, unsigned long len_to_send, int flags) {
len = sprintf(buf, "%lX\r\n", buf_len);
ret = 1;
if (flags & REV_PROXY_CHUNKED) ret = sock_send(client, buf, len, 0);
if (flags & PROXY_CHUNKED) ret = sock_send(client, buf, len, 0);
if (ret <= 0) goto err;
ret = sock_send(client, ptr, buf_len, 0);
if (ret <= 0) goto err;
if (!(flags & REV_PROXY_COMPRESS)) snd_len += ret;
if (!(flags & PROXY_COMPRESS)) snd_len += ret;
if (flags & REV_PROXY_CHUNKED) ret = sock_send(client, "\r\n", 2, 0);
if (flags & PROXY_CHUNKED) ret = sock_send(client, "\r\n", 2, 0);
if (ret <= 0) {
err:
error("Unable to send: %s", sock_strerror(client));
break;
}
}
} while ((flags & REV_PROXY_COMPRESS) && (avail_in != 0 || avail_out != sizeof(comp_out)));
} while ((flags & PROXY_COMPRESS) && (avail_in != 0 || avail_out != sizeof(comp_out)));
if (ret <= 0) break;
if (finish_comp) goto finish;
}
if (ret <= 0) break;
if (flags & REV_PROXY_CHUNKED) sock_recv(&rev_proxy, buffer, 2, 0);
} while ((flags & REV_PROXY_CHUNKED) && len_to_send > 0);
if (flags & PROXY_CHUNKED) sock_recv(&proxy, buffer, 2, 0);
} while ((flags & PROXY_CHUNKED) && len_to_send > 0);
if (ret <= 0) return -1;
if (flags & REV_PROXY_CHUNKED) {
if (flags & PROXY_CHUNKED) {
ret = sock_send(client, "0\r\n\r\n", 5, 0);
if (ret <= 0) {
error("Unable to send: %s", sock_strerror(client));
@ -560,8 +560,8 @@ int rev_proxy_send(sock *client, unsigned long len_to_send, int flags) {
return 0;
}
int rev_proxy_dump(char *buf, long len) {
sock_recv(&rev_proxy, buf, len, 0);
sock_close(&rev_proxy);
int proxy_dump(char *buf, long len) {
sock_recv(&proxy, buf, len, 0);
sock_close(&proxy);
return 0;
}

39
src/lib/proxy.h Normal file
View File

@ -0,0 +1,39 @@
/**
* sesimos - secure, simple, modern web server
* @brief Reverse proxy (header file)
* @file src/lib/proxy.h
* @author Lorenz Stechauner
* @date 2021-01-07
*/
#ifndef SESIMOS_PROXY_H
#define SESIMOS_PROXY_H
#define PROXY_CHUNKED 1
#define PROXY_COMPRESS_GZ 2
#define PROXY_COMPRESS_BR 4
#define PROXY_COMPRESS 6
#ifndef SERVER_NAME
# define SERVER_NAME "revproxy"
#endif
#include "http.h"
#include "config.h"
#include "../client.h"
extern sock proxy;
int proxy_preload(void);
int proxy_request_header(http_req *req, int enc, client_ctx_t *ctx);
int proxy_response_header(http_req *req, http_res *res, host_config *conf);
int proxy_init(http_req *req, http_res *res, http_status_ctx *ctx, host_config *conf, sock *client, client_ctx_t *cctx, http_status *custom_status, char *err_msg);
int proxy_send(sock *client, unsigned long len_to_send, int flags);
int proxy_dump(char *buf, long len);
#endif //SESIMOS_PROXY_H

View File

@ -1,39 +0,0 @@
/**
* sesimos - secure, simple, modern web server
* @brief Reverse proxy (header file)
* @file src/lib/rev_proxy.h
* @author Lorenz Stechauner
* @date 2021-01-07
*/
#ifndef SESIMOS_REV_PROXY_H
#define SESIMOS_REV_PROXY_H
#define REV_PROXY_CHUNKED 1
#define REV_PROXY_COMPRESS_GZ 2
#define REV_PROXY_COMPRESS_BR 4
#define REV_PROXY_COMPRESS 6
#ifndef SERVER_NAME
# define SERVER_NAME "revproxy"
#endif
#include "http.h"
#include "config.h"
#include "../client.h"
extern sock rev_proxy;
int rev_proxy_preload(void);
int rev_proxy_request_header(http_req *req, int enc, client_ctx_t *ctx);
int rev_proxy_response_header(http_req *req, http_res *res, host_config *conf);
int rev_proxy_init(http_req *req, http_res *res, http_status_ctx *ctx, host_config *conf, sock *client, client_ctx_t *cctx, http_status *custom_status, char *err_msg);
int rev_proxy_send(sock *client, unsigned long len_to_send, int flags);
int rev_proxy_dump(char *buf, long len);
#endif //SESIMOS_REV_PROXY_H