Fix list pointer bug in proxy
This commit is contained in:
@ -23,7 +23,7 @@ typedef struct {
|
||||
char cc[3], host[256];
|
||||
char req_host[256], err_msg[256];
|
||||
char log_prefix[128];
|
||||
char _c_addr[ADDRSTRLEN + 1], _s_addr[ADDRSTRLEN + 1];
|
||||
char _c_addr[INET6_ADDRSTRLEN + 1], _s_addr[INET6_ADDRSTRLEN + 1];
|
||||
long cnx_s, cnx_e, req_s, res_ts, req_e;
|
||||
http_req req;
|
||||
http_res res;
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "../workers.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
static int proxy_handler_1(client_ctx_t *ctx);
|
||||
static int proxy_handler_2(client_ctx_t *ctx);
|
||||
|
@ -62,10 +62,8 @@ static void init_ctx(client_ctx_t *ctx) {
|
||||
memset(&ctx->req, 0, sizeof(ctx->req));
|
||||
memset(&ctx->res, 0, sizeof(ctx->res));
|
||||
|
||||
|
||||
ctx->res.status = http_get_status(501);
|
||||
http_init_hdr(&ctx->res.hdr);
|
||||
ctx->res.hdr.last_field_num = -1;
|
||||
sprintf(ctx->res.version, "1.1");
|
||||
|
||||
ctx->status.status = 0;
|
||||
|
@ -32,6 +32,8 @@ void tcp_acceptor_func(client_ctx_t *ctx) {
|
||||
static int tcp_acceptor(client_ctx_t *ctx) {
|
||||
struct sockaddr_in6 server_addr;
|
||||
|
||||
memset(ctx->_c_addr, 0, sizeof(ctx->_c_addr));
|
||||
memset(ctx->_s_addr, 0, sizeof(ctx->_s_addr));
|
||||
inet_ntop(ctx->socket._addr.ipv6.sin6_family, &ctx->socket._addr.ipv6.sin6_addr, ctx->_c_addr, sizeof(ctx->_c_addr));
|
||||
if (strstarts(ctx->_c_addr, "::ffff:")) {
|
||||
ctx->socket.addr = ctx->_c_addr + 7;
|
||||
|
Reference in New Issue
Block a user