aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-11 14:28:34 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-11 14:28:34 +0000
commit1ec1570822726f35f4c06a9838e63e54af827bc0 (patch)
tree3b46aa5d5144f7b0c5d095c9648ad5e577153375
parentea26cfd92c60ff4b277144a7110f43e2dc2924f6 (diff)
downloadrspamd-1ec1570822726f35f4c06a9838e63e54af827bc0.tar.gz
rspamd-1ec1570822726f35f4c06a9838e63e54af827bc0.zip
Distinguish spamc/rspamc in http code.
-rw-r--r--src/libutil/http.c11
-rw-r--r--src/libutil/http.h6
2 files changed, 16 insertions, 1 deletions
diff --git a/src/libutil/http.c b/src/libutil/http.c
index 615f21de6..1e0d37017 100644
--- a/src/libutil/http.c
+++ b/src/libutil/http.c
@@ -558,6 +558,10 @@ rspamd_http_on_headers_complete (http_parser * parser)
priv->msg->body = g_string_sized_new (BUFSIZ);
}
+ if (parser->flags & F_SPAMC) {
+ priv->msg->flags |= RSPAMD_HTTP_FLAG_SPAMC;
+ }
+
priv->msg->body_buf.str = priv->msg->body->str;
priv->msg->method = parser->method;
priv->msg->code = parser->status_code;
@@ -1117,7 +1121,12 @@ rspamd_http_connection_write_message (struct rspamd_http_connection *conn,
}
else {
/* Legacy spamd reply */
- rspamd_printf_gstring (buf, "RSPAMD/1.3 0 EX_OK\r\n");
+ if (msg->flags & RSPAMD_HTTP_FLAG_SPAMC) {
+ rspamd_printf_gstring (buf, "SPAMD/1.1 0 EX_OK\r\n");
+ }
+ else {
+ rspamd_printf_gstring (buf, "RSPAMD/1.3 0 EX_OK\r\n");
+ }
}
}
else {
diff --git a/src/libutil/http.h b/src/libutil/http.h
index c581cb6f6..eef963f9d 100644
--- a/src/libutil/http.h
+++ b/src/libutil/http.h
@@ -50,6 +50,11 @@ struct rspamd_http_header {
};
/**
+ * Legacy spamc protocol
+ */
+#define RSPAMD_HTTP_FLAG_SPAMC 1 << 1
+
+/**
* HTTP message structure, used for requests and replies
*/
struct rspamd_http_message {
@@ -65,6 +70,7 @@ struct rspamd_http_message {
time_t date;
gint code;
enum http_method method;
+ gint flags;
};