summaryrefslogtreecommitdiffstats
path: root/src/http.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-01-20 15:44:51 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-01-20 15:44:51 +0000
commit4b21810277a55f7c247f6bead1fadf87a2ad5e45 (patch)
tree3881e3c79bc4d07bf9747961feb39a142e391dfa /src/http.c
parent43a44c7faf94133305a7afd627b3d009a60aa371 (diff)
downloadrspamd-4b21810277a55f7c247f6bead1fadf87a2ad5e45.tar.gz
rspamd-4b21810277a55f7c247f6bead1fadf87a2ad5e45.zip
New rspamc client.
Diffstat (limited to 'src/http.c')
-rw-r--r--src/http.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/http.c b/src/http.c
index be1a389e0..56f961afa 100644
--- a/src/http.c
+++ b/src/http.c
@@ -706,6 +706,19 @@ rspamd_http_connection_write_message (struct rspamd_http_connection *conn,
priv->header = NULL;
priv->buf = g_string_sized_new (128);
+ if (msg->body == NULL || msg->body->len == 0) {
+ pbody = NULL;
+ bodylen = 0;
+ priv->outlen = 2;
+ msg->method = HTTP_GET;
+ }
+ else {
+ pbody = msg->body->str;
+ bodylen = msg->body->len;
+ priv->outlen = 3;
+ msg->method = HTTP_POST;
+ }
+
if (conn->type == RSPAMD_HTTP_SERVER) {
/* Format reply */
ptm = gmtime (&msg->date);
@@ -749,16 +762,6 @@ rspamd_http_connection_write_message (struct rspamd_http_connection *conn,
http_method_str (msg->method), msg->url, msg->body->len);
}
}
- if (msg->body == NULL) {
- pbody = NULL;
- bodylen = 0;
- priv->outlen = 2;
- }
- else {
- pbody = msg->body->str;
- bodylen = msg->body->len;
- priv->outlen = 3;
- }
/* Allocate iov */
priv->wr_total = bodylen + priv->buf->len + 2;
DL_FOREACH (msg->headers, hdr) {
@@ -812,6 +815,7 @@ rspamd_http_new_message (enum http_parser_type type)
new->date = 0;
new->body = NULL;
new->type = type;
+ new->method = HTTP_GET;
return new;
}