You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

http_private.h 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*-
  2. * Copyright 2016 Vsevolod Stakhov
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef SRC_LIBUTIL_HTTP_PRIVATE_H_
  17. #define SRC_LIBUTIL_HTTP_PRIVATE_H_
  18. #include "http_connection.h"
  19. #include "http_parser.h"
  20. #include "str_util.h"
  21. #include "ref.h"
  22. #define HASH_CASELESS
  23. #include "uthash_strcase.h"
  24. /**
  25. * HTTP header structure
  26. */
  27. struct rspamd_http_header {
  28. rspamd_fstring_t *combined;
  29. rspamd_ftok_t name;
  30. rspamd_ftok_t value;
  31. UT_hash_handle hh;
  32. struct rspamd_http_header *prev, *next;
  33. };
  34. /**
  35. * HTTP message structure, used for requests and replies
  36. */
  37. struct rspamd_http_message {
  38. rspamd_fstring_t *url;
  39. rspamd_fstring_t *host;
  40. rspamd_fstring_t *status;
  41. struct rspamd_http_header *headers;
  42. struct _rspamd_body_buf_s {
  43. /* Data start */
  44. const gchar *begin;
  45. /* Data len */
  46. gsize len;
  47. /* Allocated len */
  48. gsize allocated_len;
  49. /* Data buffer (used to write data inside) */
  50. gchar *str;
  51. /* Internal storage */
  52. union _rspamd_storage_u {
  53. rspamd_fstring_t *normal;
  54. struct _rspamd_storage_shared_s {
  55. struct rspamd_storage_shmem *name;
  56. gint shm_fd;
  57. } shared;
  58. } c;
  59. } body_buf;
  60. struct rspamd_cryptobox_pubkey *peer_key;
  61. time_t date;
  62. time_t last_modified;
  63. unsigned port;
  64. int type;
  65. gint code;
  66. enum http_method method;
  67. gint flags;
  68. ref_entry_t ref;
  69. };
  70. #define HTTP_ERROR http_error_quark ()
  71. GQuark http_error_quark (void);
  72. void rspamd_http_message_storage_cleanup (struct rspamd_http_message *msg);
  73. gboolean rspamd_http_message_grow_body (struct rspamd_http_message *msg,
  74. gsize len);
  75. #endif /* SRC_LIBUTIL_HTTP_PRIVATE_H_ */