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,
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,
}
}
+ /* 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;
/* 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";