diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-03-18 16:00:36 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-03-18 16:00:36 +0000 |
commit | 6e95f83a94eac93a4cb5596430e2c03a24536a50 (patch) | |
tree | 658b7e426f8e5b2074cf78eeeb9411f6357b16d3 /src/libutil | |
parent | 02de13af4e812e81c882fa33683429c65a475099 (diff) | |
download | rspamd-6e95f83a94eac93a4cb5596430e2c03a24536a50.tar.gz rspamd-6e95f83a94eac93a4cb5596430e2c03a24536a50.zip |
[Project] Add support of HTTP proxy in requests
Issue: #572
Diffstat (limited to 'src/libutil')
-rw-r--r-- | src/libutil/http_connection.c | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/src/libutil/http_connection.c b/src/libutil/http_connection.c index 78ec2582f..ea664f20d 100644 --- a/src/libutil/http_connection.c +++ b/src/libutil/http_connection.c @@ -1862,6 +1862,7 @@ rspamd_http_message_write_header (const gchar* mime_type, gboolean encrypted, } if (encrypted) { + /* TODO: Add proxy support to HTTPCrypt */ rspamd_printf_fstring (buf, "%s %s HTTP/1.1\r\n" "Connection: %s\r\n" @@ -1875,16 +1876,32 @@ rspamd_http_message_write_header (const gchar* mime_type, gboolean encrypted, enclen); } else { - rspamd_printf_fstring (buf, - "%s %V HTTP/1.1\r\n" - "Connection: %s\r\n" - "Host: %s\r\n" - "Content-Length: %z\r\n", - http_method_str (msg->method), - msg->url, - conn_type, - host, - bodylen); + if (conn->priv->flags & RSPAMD_HTTP_CONN_FLAG_PROXY) { + rspamd_printf_fstring (buf, + "%s http://%s:%d/%V HTTP/1.1\r\n" + "Connection: %s\r\n" + "Host: %s\r\n" + "Content-Length: %z\r\n", + http_method_str (msg->method), + host, + msg->port, + msg->url, + conn_type, + host, + bodylen); + } + else { + rspamd_printf_fstring (buf, + "%s %V HTTP/1.1\r\n" + "Connection: %s\r\n" + "Host: %s\r\n" + "Content-Length: %z\r\n", + http_method_str (msg->method), + msg->url, + conn_type, + host, + bodylen); + } if (bodylen > 0) { if (mime_type != NULL) { |