]> source.dussan.org Git - rspamd.git/commitdiff
[Rework] Move http internal structures to a private header
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 10 Jun 2016 13:46:44 +0000 (14:46 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 10 Jun 2016 13:46:44 +0000 (14:46 +0100)
src/libutil/http.c
src/libutil/http.h
src/libutil/http_private.h [new file with mode: 0644]

index 2e9fa259ae55cc619884c6840c785b93ec1e8e67..718ef818d4c5fadf024a36bff64a642319106224 100644 (file)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 #include "config.h"
-#include "http.h"
+#include "http_private.h"
 #include "utlist.h"
 #include "util.h"
 #include "printf.h"
index 59567b10aa56c1839d1bf7a6ddceb4f25a535124..bb5f8d8a750cb33a35c2c8b120785fd152329817 100644 (file)
 #include "keypair.h"
 #include "keypairs_cache.h"
 #include "fstring.h"
-#include "uthash.h"
 
 enum rspamd_http_connection_type {
        RSPAMD_HTTP_SERVER,
        RSPAMD_HTTP_CLIENT
 };
 
-/**
- * HTTP header structure
- */
-struct rspamd_http_header {
-       rspamd_ftok_t *name;
-       rspamd_ftok_t *value;
-       rspamd_fstring_t *combined;
-       UT_hash_handle hh;
-};
+struct rspamd_http_header;
+struct rspamd_http_message;
+struct rspamd_http_connection_private;
+struct rspamd_http_connection;
+struct rspamd_http_connection_router;
+struct rspamd_http_connection_entry;
 
 /**
  * Legacy spamc protocol
@@ -58,44 +54,6 @@ struct rspamd_http_header {
  */
 #define RSPAMD_HTTP_FLAG_SHMEM_IMMUTABLE (1 << 3)
 
-/**
- * HTTP message structure, used for requests and replies
- */
-struct rspamd_http_message {
-       rspamd_fstring_t *url;
-       rspamd_fstring_t *host;
-       rspamd_fstring_t *status;
-       struct rspamd_http_header *headers;
-
-       struct _rspamd_body_buf_s {
-               /* Data start */
-               const gchar *begin;
-               /* Data len */
-               gsize len;
-               /* Data buffer (used to write data inside) */
-               gchar *str;
-
-               /* Internal storage */
-               union _rspamd_storage_u {
-                       rspamd_fstring_t *normal;
-                       struct {
-                               gchar *shm_name;
-                               gint shm_fd;
-                       } shared;
-               } c;
-       } body_buf;
-
-       struct rspamd_cryptobox_pubkey *peer_key;
-       time_t date;
-       time_t last_modified;
-       unsigned port;
-       enum http_parser_type type;
-       gint code;
-       enum http_method method;
-       gint flags;
-};
-
-
 /**
  * Options for HTTP connection
  */
@@ -105,11 +63,6 @@ enum rspamd_http_options {
        RSPAMD_HTTP_CLIENT_ENCRYPTED = 0x4 /**< Encrypt data for client */
 };
 
-struct rspamd_http_connection_private;
-struct rspamd_http_connection;
-struct rspamd_http_connection_router;
-struct rspamd_http_connection_entry;
-
 typedef int (*rspamd_http_body_handler_t) (struct rspamd_http_connection *conn,
        struct rspamd_http_message *msg,
        const gchar *chunk,
diff --git a/src/libutil/http_private.h b/src/libutil/http_private.h
new file mode 100644 (file)
index 0000000..a944cb3
--- /dev/null
@@ -0,0 +1,73 @@
+/*-
+ * Copyright 2016 Vsevolod Stakhov
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef SRC_LIBUTIL_HTTP_PRIVATE_H_
+#define SRC_LIBUTIL_HTTP_PRIVATE_H_
+
+#include "http.h"
+#include "str_util.h"
+#include "../../contrib/mumhash/mum.h"
+#define HASH_CASELESS
+#include "uthash_strcase.h"
+
+/**
+ * HTTP header structure
+ */
+struct rspamd_http_header {
+       rspamd_ftok_t *name;
+       rspamd_ftok_t *value;
+       rspamd_fstring_t *combined;
+       UT_hash_handle hh;
+};
+
+/**
+ * HTTP message structure, used for requests and replies
+ */
+struct rspamd_http_message {
+       rspamd_fstring_t *url;
+       rspamd_fstring_t *host;
+       rspamd_fstring_t *status;
+       struct rspamd_http_header *headers;
+
+       struct _rspamd_body_buf_s {
+               /* Data start */
+               const gchar *begin;
+               /* Data len */
+               gsize len;
+               /* Data buffer (used to write data inside) */
+               gchar *str;
+
+               /* Internal storage */
+               union _rspamd_storage_u {
+                       rspamd_fstring_t *normal;
+                       struct {
+                               gchar *shm_name;
+                               gint shm_fd;
+                       } shared;
+               } c;
+       } body_buf;
+
+       struct rspamd_cryptobox_pubkey *peer_key;
+       time_t date;
+       time_t last_modified;
+       unsigned port;
+       enum http_parser_type type;
+       gint code;
+       enum http_method method;
+       gint flags;
+};
+
+
+#endif /* SRC_LIBUTIL_HTTP_PRIVATE_H_ */