aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/http_private.h
blob: 0e2658617dc8e317ddcc8c492fd1982d8dd8e54e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*-
 * 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 "ref.h"
#define HASH_CASELESS
#include "uthash_strcase.h"

/**
 * HTTP header structure
 */
struct rspamd_http_header {
	rspamd_fstring_t *combined;
	rspamd_ftok_t name;
	rspamd_ftok_t value;
	UT_hash_handle hh;
	struct rspamd_http_header *prev, *next;
};

/**
 * 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;
		/* Allocated len */
		gsize allocated_len;
		/* Data buffer (used to write data inside) */
		gchar *str;

		/* Internal storage */
		union _rspamd_storage_u {
			rspamd_fstring_t *normal;
			struct _rspamd_storage_shared_s {
				struct rspamd_storage_shmem *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;
	ref_entry_t ref;
};


#endif /* SRC_LIBUTIL_HTTP_PRIVATE_H_ */