]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
Distinguish spamc/rspamc in http code.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 11 Mar 2015 14:28:34 +0000 (14:28 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 11 Mar 2015 14:28:34 +0000 (14:28 +0000)
src/libutil/http.c
src/libutil/http.h

index 615f21de6dffd31ab459bdc1c02596b33ee94274..1e0d37017efa65dad661377c66e441001b98d08e 100644 (file)
@@ -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 {
index c581cb6f6cd79cb6c2bc7199507d6871eb210d6d..eef963f9d32480252c2abc1b1a36dfac0e8a1d45 100644 (file)
@@ -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;
 };