]> 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 15:21:01 +0000 (15:21 +0000)
Conflicts:
src/libutil/http.c

src/libutil/http.c
src/libutil/http.h

index 5a597fbd21a5151ab32bc19a01a0d1e742103092..02740081a069265a078e31f83390eac5c69537ab 100644 (file)
@@ -503,6 +503,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->method = parser->method;
        priv->msg->code = parser->status_code;
 
@@ -965,7 +969,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 c6fcf0b83ff704ab5f9f7451642b8325711dfa78..72c07b4499f42ec0444c8381eb196ad50fc65cf7 100644 (file)
@@ -48,6 +48,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
  */
@@ -62,6 +67,7 @@ struct rspamd_http_message {
        time_t date;
        gint code;
        enum http_method method;
+       gint flags;
 };