Skip to content

Commit

Permalink
refactor evcon_is_local_browser
Browse files Browse the repository at this point in the history
  • Loading branch information
ghazel committed Sep 17, 2019
1 parent b81afde commit 5dc8f79
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions client.c
Original file line number Diff line number Diff line change
Expand Up @@ -686,9 +686,9 @@ bool addr_is_localhost(const sockaddr *sa, socklen_t salen)
return false;
}

bool evcon_is_local_browser(evhttp_connection *evcon)
bool bufferevent_is_local_browser(bufferevent *bev)
{
int fd = bufferevent_getfd(evhttp_connection_get_bufferevent(evcon));
int fd = bufferevent_getfd(bev);
sockaddr_storage ss;
socklen_t len = sizeof(ss);
getsockname(fd, (sockaddr *)&ss, &len);
Expand All @@ -699,6 +699,11 @@ bool evcon_is_local_browser(evhttp_connection *evcon)
return addr_is_localhost((sockaddr *)&ss, len);
}

bool evcon_is_local_browser(evhttp_connection *evcon)
{
return bufferevent_is_local_browser(evhttp_connection_get_bufferevent(evcon));
}

void copy_response_headers(evhttp_request *from, evhttp_request *to)
{
const char *response_header_whitelist[] = hashed_headers;
Expand Down Expand Up @@ -1653,16 +1658,6 @@ void direct_submit_request(proxy_request *p)
int r = evhttp_make_request(evcon, d->req, p->http_method, request_uri);
}

address parse_address(const char *addr)
{
address a;
char *port = strchr(addr, ':');
*port = '\0';
a.ip = inet_addr(addr);
a.port = htons(atoi(port+1));
return a;
}

void append_via(evhttp_request *from, evkeyvalq *to)
{
const char *via = NULL;
Expand Down

0 comments on commit 5dc8f79

Please sign in to comment.