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 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 "str_util.h"
  20. #include "ref.h"
  21. #define HASH_CASELESS
  22. #include "uthash_strcase.h"
  23. /**
  24. * HTTP header structure
  25. */
  26. struct rspamd_http_header {
  27. rspamd_fstring_t *combined;
  28. rspamd_ftok_t name;
  29. rspamd_ftok_t value;
  30. UT_hash_handle hh;
  31. struct rspamd_http_header *prev, *next;
  32. };
  33. /**
  34. * HTTP message structure, used for requests and replies
  35. */
  36. struct rspamd_http_message {
  37. rspamd_fstring_t *url;
  38. rspamd_fstring_t *host;
  39. rspamd_fstring_t *status;
  40. struct rspamd_http_header *headers;
  41. struct _rspamd_body_buf_s {
  42. /* Data start */
  43. const gchar *begin;
  44. /* Data len */
  45. gsize len;
  46. /* Allocated len */
  47. gsize allocated_len;
  48. /* Data buffer (used to write data inside) */
  49. gchar *str;
  50. /* Internal storage */
  51. union _rspamd_storage_u {
  52. rspamd_fstring_t *normal;
  53. struct _rspamd_storage_shared_s {
  54. struct rspamd_storage_shmem *name;
  55. gint shm_fd;
  56. } shared;
  57. } c;
  58. } body_buf;
  59. struct rspamd_cryptobox_pubkey *peer_key;
  60. time_t date;
  61. time_t last_modified;
  62. unsigned port;
  63. enum http_parser_type type;
  64. gint code;
  65. enum http_method method;
  66. gint flags;
  67. ref_entry_t ref;
  68. };
  69. #endif /* SRC_LIBUTIL_HTTP_PRIVATE_H_ */