diff options
author | rofl0r <retnyg@gmx.net> | 2018-02-23 20:21:32 +0000 |
---|---|---|
committer | rofl0r <rofl0r@users.noreply.github.com> | 2018-02-25 15:13:45 +0000 |
commit | bf76aeeba1cf868ebe4d2f28976abb75c48031b0 (patch) | |
tree | 779316ce7d9bae67cbc54122d530c6f51d761289 /src/reqs.c | |
parent | 4d9891e59e7c7ee77137fcdb3d02798af96811ff (diff) |
implement HTTP basic auth for upstream proxies
loosely based on @valenbg1's code from PR #38
closes #38
closes #96
Diffstat (limited to 'src/reqs.c')
-rw-r--r-- | src/reqs.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -270,6 +270,17 @@ establish_http_connection (struct conn_s *connptr, struct request_s *request) "Connection: close\r\n", request->method, request->path, request->host, portbuff); + } else if (connptr->upstream_proxy && + connptr->upstream_proxy->type == HTTP_TYPE && + connptr->upstream_proxy->ua.authstr) { + return write_message (connptr->server_fd, + "%s %s HTTP/1.0\r\n" + "Host: %s%s\r\n" + "Connection: close\r\n" + "Proxy-Authorization: Basic %s\r\n", + request->method, request->path, + request->host, portbuff, + connptr->upstream_proxy->ua.authstr); } else { return write_message (connptr->server_fd, "%s %s HTTP/1.0\r\n" |