From: Vsevolod Stakhov Date: Wed, 11 Mar 2015 14:28:34 +0000 (+0000) Subject: Distinguish spamc/rspamc in http code. X-Git-Tag: 0.9.0~524 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1ec1570822726f35f4c06a9838e63e54af827bc0;p=thirdparty%2Frspamd.git Distinguish spamc/rspamc in http code. --- diff --git a/src/libutil/http.c b/src/libutil/http.c index 615f21de6d..1e0d37017e 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 c581cb6f6c..eef963f9d3 100644 --- a/src/libutil/http.h +++ b/src/libutil/http.h @@ -49,6 +49,11 @@ struct rspamd_http_header { struct rspamd_http_header *next, *prev; }; +/** + * Legacy spamc protocol + */ +#define RSPAMD_HTTP_FLAG_SPAMC 1 << 1 + /** * HTTP message structure, used for requests and replies */ @@ -65,6 +70,7 @@ struct rspamd_http_message { time_t date; gint code; enum http_method method; + gint flags; };