~ubuntu-branches/ubuntu/utopic/dovecot/utopic-proposed

« back to all changes in this revision

Viewing changes to src/lib-http/http-request.h

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-01-08 09:35:49 UTC
  • mfrom: (4.1.35 sid)
  • Revision ID: package-import@ubuntu.com-20140108093549-i72o93pux8p0dlaf
Tags: 1:2.2.9-1ubuntu1
* Merge from Debian unstable, remaining changes:
  + Add mail-stack-delivery package:
    - Update d/rules
    - d/control: convert existing dovecot-postfix package to a dummy
      package and add new mail-stack-delivery package.
    - Update maintainer scripts.
    - Rename d/dovecot-postfix.* to debian/mail-stack-delivery.*
    - d/mail-stack-delivery.preinst: Move previously installed backups and
      config files to a new package namespace.
    - d/mail-stack-delivery.prerm: Added to handle downgrades.
  + Use Snakeoil SSL certificates by default:
    - d/control: Depend on ssl-cert.
    - d/dovecot-core.postinst: Relax grep for SSL_* a bit.
  + Add autopkgtest to debian/tests/*.
  + Add ufw integration:
    - d/dovecot-core.ufw.profile: new ufw profile.
    - d/rules: install profile in dovecot-core.
    - d/control: dovecot-core - suggest ufw.
  + d/dovecot-core.dirs: Added usr/share/doc/dovecot-core
  + Add apport hook:
    - d/rules, d/source_dovecot.py
  + Add upstart job:
    - d/rules, d/dovecot-core.dovecot.upstart, d/control,
      d/dovecot-core.dirs, dovecot-imapd.{postrm, postinst, prerm},
      d/dovecot-pop3d.{postinst, postrm, prerm}.
      d/mail-stack-deliver.postinst: Convert init script to upstart.
  + Use the autotools-dev dh addon to update config.guess/config.sub for
    arm64.
* Dropped changes, included in Debian:
  - Update Dovecot name to reflect distribution in login greeting.
  - Update Drac plugin for >= 2.0.0 support.
* d/control: Drop dovecot-postfix package as its no longer required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef HTTP_REQUEST_H
 
2
#define HTTP_REQUEST_H
 
3
 
 
4
#include "http-header.h"
 
5
 
 
6
struct http_url;
 
7
 
 
8
#define HTTP_REQUEST_DEFAULT_MAX_TARGET_LENGTH      (8 * 1024)
 
9
#define HTTP_REQUEST_DEFAULT_MAX_HEADER_SIZE        (200 * 1024)
 
10
#define HTTP_REQUEST_DEFAULT_MAX_HEADER_FIELD_SIZE  (8 * 1024)
 
11
#define HTTP_REQUEST_DEFAULT_MAX_HEADER_FIELDS      50
 
12
#define HTTP_REQUEST_DEFAULT_MAX_PAYLOAD_SIZE       (1 * 1024 * 1024)
 
13
 
 
14
struct http_request_limits {
 
15
        uoff_t max_target_length;
 
16
        uoff_t max_payload_size;
 
17
 
 
18
        struct http_header_limits header;
 
19
};
 
20
 
 
21
enum http_request_target_format {
 
22
        HTTP_REQUEST_TARGET_FORMAT_ORIGIN = 0,
 
23
        HTTP_REQUEST_TARGET_FORMAT_ABSOLUTE,
 
24
        HTTP_REQUEST_TARGET_FORMAT_AUTHORITY,
 
25
        HTTP_REQUEST_TARGET_FORMAT_ASTERISK
 
26
};
 
27
 
 
28
struct http_request_target {
 
29
        enum http_request_target_format format;
 
30
        struct http_url *url;
 
31
};
 
32
 
 
33
struct http_request {
 
34
        const char *method;
 
35
 
 
36
        const char *target_raw;
 
37
        struct http_request_target target;
 
38
 
 
39
        unsigned char version_major;
 
40
        unsigned char version_minor;
 
41
 
 
42
        time_t date;
 
43
        const struct http_header *header;
 
44
        struct istream *payload;
 
45
 
 
46
        ARRAY_TYPE(const_string) connection_options;
 
47
 
 
48
        unsigned int connection_close:1;
 
49
        unsigned int expect_100_continue:1;
 
50
};
 
51
 
 
52
static inline bool
 
53
http_request_method_is(const struct http_request *req, const char *method)
 
54
{
 
55
        if (req->method == NULL)
 
56
                return FALSE;
 
57
 
 
58
        return (strcmp(req->method, method) == 0);
 
59
}
 
60
 
 
61
static inline const struct http_header_field *
 
62
http_request_header_find(const struct http_request *req, const char *name)
 
63
{
 
64
        return http_header_field_find(req->header, name);
 
65
}
 
66
 
 
67
static inline const char *
 
68
http_request_header_get(const struct http_request *req, const char *name)
 
69
{
 
70
        return http_header_field_get(req->header, name);
 
71
}
 
72
 
 
73
static inline const ARRAY_TYPE(http_header_field) *
 
74
http_request_header_get_fields(const struct http_request *req)
 
75
{
 
76
        return http_header_get_fields(req->header);
 
77
}
 
78
 
 
79
bool http_request_has_connection_option(const struct http_request *req,
 
80
        const char *option);
 
81
int http_request_get_payload_size(const struct http_request *req,
 
82
        uoff_t *size_r);
 
83
 
 
84
#endif