comparison src/imap/ngx_imap.h @ 527:7fa11e5c6e96 release-0.1.38

nginx-0.1.38-RELEASE import *) Feature: the "limit_rate" directive is supported in in proxy and FastCGI mode. *) Feature: the "X-Accel-Limit-Rate" response header line is supported in proxy and FastCGI mode. *) Feature: the "break" directive. *) Feature: the "log_not_found" directive. *) Bugfix: the response status code was not changed when request was redirected by the ""X-Accel-Redirect" header line. *) Bugfix: the variables set by the "set" directive could not be used in SSI. *) Bugfix: the segmentation fault may occurred if the SSI page has more than one remote subrequest. *) Bugfix: nginx treated the backend response as invalid if the status line in the header was transferred in two packets; the bug had appeared in 0.1.29. *) Feature: the "ssi_types" directive. *) Feature: the "autoindex_exact_size" directive. *) Bugfix: the ngx_http_autoindex_module did not support the long file names in UTF-8. *) Feature: the IMAP/POP3 proxy.
author Igor Sysoev <igor@sysoev.ru>
date Fri, 08 Jul 2005 14:34:20 +0000
parents 09b42134ac0c
children 371c1cee100d
comparison
equal deleted inserted replaced
526:e31ce4d8b8e6 527:7fa11e5c6e96
34 size_t imap_client_buffer_size; 34 size_t imap_client_buffer_size;
35 size_t proxy_buffer_size; 35 size_t proxy_buffer_size;
36 36
37 ngx_uint_t protocol; 37 ngx_uint_t protocol;
38 38
39 ngx_buf_t *pop3_capability;
40 ngx_buf_t *imap_capability;
41
42 ngx_array_t pop3_capabilities;
43 ngx_array_t imap_capabilities;
44
39 /* server ctx */ 45 /* server ctx */
40 ngx_imap_conf_ctx_t *ctx; 46 ngx_imap_conf_ctx_t *ctx;
41 } ngx_imap_core_srv_conf_t; 47 } ngx_imap_core_srv_conf_t;
42 48
43 49
49 char *(*merge_srv_conf)(ngx_conf_t *cf, void *prev, void *conf); 55 char *(*merge_srv_conf)(ngx_conf_t *cf, void *prev, void *conf);
50 } ngx_imap_module_t; 56 } ngx_imap_module_t;
51 57
52 58
53 typedef enum { 59 typedef enum {
60 ngx_imap_start = 0,
61 ngx_imap_login,
62 ngx_imap_user,
63 ngx_imap_passwd,
64 } ngx_imap_state_e;
65
66
67 typedef enum {
54 ngx_pop3_start = 0, 68 ngx_pop3_start = 0,
55 ngx_pop3_user 69 ngx_pop3_user,
56 } ngx_imap_state_e; 70 ngx_pop3_passwd
71 } ngx_po3_state_e;
57 72
58 73
59 typedef struct { 74 typedef struct {
60 ngx_peer_connection_t upstream; 75 ngx_peer_connection_t upstream;
61 ngx_buf_t *buffer; 76 ngx_buf_t *buffer;
66 uint32_t signature; /* "IMAP" */ 81 uint32_t signature; /* "IMAP" */
67 82
68 ngx_connection_t *connection; 83 ngx_connection_t *connection;
69 84
70 ngx_buf_t *buffer; 85 ngx_buf_t *buffer;
86 ngx_str_t out;
71 87
72 void **ctx; 88 void **ctx;
73 void **main_conf; 89 void **main_conf;
74 void **srv_conf; 90 void **srv_conf;
75 91
76 ngx_imap_proxy_ctx_t *proxy; 92 ngx_imap_proxy_ctx_t *proxy;
77 93
78 ngx_imap_state_e imap_state; 94 ngx_uint_t imap_state;
79 95
80 unsigned protocol:1; 96 unsigned protocol:1;
97 unsigned quoted:1;
81 98
82 ngx_str_t login; 99 ngx_str_t login;
83 ngx_str_t passwd; 100 ngx_str_t passwd;
84 101
102 ngx_str_t tag;
103
85 ngx_uint_t command; 104 ngx_uint_t command;
86 ngx_array_t args; 105 ngx_array_t args;
106
107 ngx_uint_t login_attempt;
87 108
88 /* used to parse IMAP/POP3 command */ 109 /* used to parse IMAP/POP3 command */
89 110
90 ngx_uint_t state; 111 ngx_uint_t state;
112 u_char *cmd_start;
91 u_char *arg_start; 113 u_char *arg_start;
92 u_char *arg_end; 114 u_char *arg_end;
115 ngx_uint_t literal_len;
93 } ngx_imap_session_t; 116 } ngx_imap_session_t;
94 117
95 118
96 #define NGX_POP3_USER 1 119 #define NGX_POP3_USER 1
97 #define NGX_POP3_PASS 2 120 #define NGX_POP3_PASS 2
98 #define NGX_POP3_APOP 3 121 #define NGX_POP3_CAPA 3
99 #define NGX_POP3_STAT 4 122 #define NGX_POP3_QUIT 4
100 #define NGX_POP3_LIST 5 123 #define NGX_POP3_NOOP 5
101 #define NGX_POP3_RETR 6 124 #define NGX_POP3_APOP 6
102 #define NGX_POP3_DELE 7 125 #define NGX_POP3_STAT 7
103 #define NGX_POP3_NOOP 8 126 #define NGX_POP3_LIST 8
104 #define NGX_POP3_RSET 9 127 #define NGX_POP3_RETR 9
105 #define NGX_POP3_TOP 10 128 #define NGX_POP3_DELE 10
106 #define NGX_POP3_UIDL 11 129 #define NGX_POP3_RSET 11
107 #define NGX_POP3_QUIT 12 130 #define NGX_POP3_TOP 12
131 #define NGX_POP3_UIDL 13
108 132
109 133
110 #define NGX_IMAP_PARSE_INVALID_COMMAND 10 134 #define NGX_IMAP_LOGIN 1
135 #define NGX_IMAP_LOGOUT 2
136 #define NGX_IMAP_CAPABILITY 3
137 #define NGX_IMAP_NOOP 4
138
139 #define NGX_IMAP_NEXT 5
140
141
142 #define NGX_IMAP_PARSE_INVALID_COMMAND 20
111 143
112 144
113 #define NGX_IMAP_PROXY_INVALID 10 145 #define NGX_IMAP_PROXY_INVALID 10
114 #define NGX_IMAP_PROXY_ERROR 11 146 #define NGX_IMAP_PROXY_ERROR 11
115 147
133 (s)->main_conf[module.ctx_index] 165 (s)->main_conf[module.ctx_index]
134 #define ngx_imap_get_module_srv_conf(s, module) (s)->srv_conf[module.ctx_index] 166 #define ngx_imap_get_module_srv_conf(s, module) (s)->srv_conf[module.ctx_index]
135 167
136 168
137 void ngx_imap_init_connection(ngx_connection_t *c); 169 void ngx_imap_init_connection(ngx_connection_t *c);
170 void ngx_imap_auth_state(ngx_event_t *rev);
171 void ngx_pop3_auth_state(ngx_event_t *rev);
138 void ngx_imap_close_connection(ngx_connection_t *c); 172 void ngx_imap_close_connection(ngx_connection_t *c);
139 void ngx_imap_session_internal_server_error(ngx_imap_session_t *s); 173 void ngx_imap_session_internal_server_error(ngx_imap_session_t *s);
140 174
175 ngx_int_t ngx_imap_parse_command(ngx_imap_session_t *s);
141 ngx_int_t ngx_pop3_parse_command(ngx_imap_session_t *s); 176 ngx_int_t ngx_pop3_parse_command(ngx_imap_session_t *s);
142 177
143 178
144 /* STUB */ 179 /* STUB */
145 void ngx_imap_proxy_init(ngx_imap_session_t *s, ngx_peers_t *peers); 180 void ngx_imap_proxy_init(ngx_imap_session_t *s, ngx_peers_t *peers);