diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-10-07 16:56:02 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-10-07 16:56:02 +0100 |
commit | f15e47c4d9f0b69c648398dd2724ce49e65a79ab (patch) | |
tree | 6f001e0585c1925971686c0274cb1ec8ee9e0c36 | |
parent | 05e5995e153e06943499b0b8bc09346cf3d302fe (diff) | |
download | rspamd-f15e47c4d9f0b69c648398dd2724ce49e65a79ab.tar.gz rspamd-f15e47c4d9f0b69c648398dd2724ce49e65a79ab.zip |
Fix encryption in HTTP.
-rw-r--r-- | src/libutil/http.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/libutil/http.c b/src/libutil/http.c index dee2d5724..eedc9c451 100644 --- a/src/libutil/http.c +++ b/src/libutil/http.c @@ -1443,15 +1443,14 @@ rspamd_http_connection_write_message (struct rspamd_http_connection *conn, if (encrypted) { /* Internal reply (encrypted) */ meth_len = rspamd_snprintf (repbuf, sizeof (repbuf), - "HTTP/1.1 %d %s\r\n" + "HTTP/1.1 %d %V\r\n" "Connection: close\r\n" "Server: %s\r\n" "Date: %s\r\n" "Content-Length: %z\r\n" "Content-Type: %s", /* NO \r\n at the end ! */ msg->code, - msg->status ? msg->status->str : - rspamd_http_code_to_str (msg->code), + msg->status, "rspamd/" RVERSION, datebuf, bodylen, @@ -1468,15 +1467,14 @@ rspamd_http_connection_write_message (struct rspamd_http_connection *conn, enclen); } else { - rspamd_printf_fstring (&buf, "HTTP/1.1 %d %s\r\n" + rspamd_printf_fstring (&buf, "HTTP/1.1 %d %V\r\n" "Connection: close\r\n" "Server: %s\r\n" "Date: %s\r\n" "Content-Length: %z\r\n" "Content-Type: %s\r\n", msg->code, - msg->status ? msg->status->str : - rspamd_http_code_to_str (msg->code), + msg->status, "rspamd/" RVERSION, datebuf, bodylen, @@ -1573,6 +1571,11 @@ rspamd_http_connection_write_message (struct rspamd_http_connection *conn, } } + /* Setup external request body */ + priv->out[0].iov_base = buf->str; + priv->out[0].iov_len = buf->len; + + /* Buf will be used eventually for encryption */ if (encrypted) { gint meth_offset, nonce_offset, mac_offset; @@ -1611,10 +1614,6 @@ rspamd_http_connection_write_message (struct rspamd_http_connection *conn, /* During previous writes, buf might be reallocated and changed */ priv->buf->data = buf; - /* Now set up all iov */ - priv->out[0].iov_base = buf->str; - priv->out[0].iov_len = buf->len; - if (encrypted) { /* Finish external HTTP request */ priv->out[1].iov_base = "\r\n"; |