aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2006-12-03 13:48:49 +0000
committerIgor Sysoev <igor@sysoev.ru>2006-12-03 13:48:49 +0000
commita53f7293c8b8e2dcc3168ce96903afe5c55dd763 (patch)
treeca4fe6f8dcecdda72ceb1d6b747d38b4e710508a /src
parent90d7bb2b13c2e3133300939734e202c9686a8f64 (diff)
downloadnginx-a53f7293c8b8e2dcc3168ce96903afe5c55dd763.tar.gz
nginx-a53f7293c8b8e2dcc3168ce96903afe5c55dd763.zip
Auth-Status: WAIT
Diffstat (limited to 'src')
-rw-r--r--src/imap/ngx_imap.h1
-rw-r--r--src/imap/ngx_imap_auth_http_module.c33
2 files changed, 34 insertions, 0 deletions
diff --git a/src/imap/ngx_imap.h b/src/imap/ngx_imap.h
index b7b62a5cb..848a60210 100644
--- a/src/imap/ngx_imap.h
+++ b/src/imap/ngx_imap.h
@@ -160,6 +160,7 @@ typedef struct {
unsigned no_sync_literal:1;
unsigned starttls:1;
unsigned auth_method:2;
+ unsigned auth_wait:1;
ngx_str_t login;
ngx_str_t passwd;
diff --git a/src/imap/ngx_imap_auth_http_module.c b/src/imap/ngx_imap_auth_http_module.c
index d39c29502..73856f30e 100644
--- a/src/imap/ngx_imap_auth_http_module.c
+++ b/src/imap/ngx_imap_auth_http_module.c
@@ -488,6 +488,16 @@ ngx_imap_auth_http_process_headers(ngx_imap_session_t *s,
continue;
}
+ if (len == 4
+ && ctx->header_start[0] == 'W'
+ && ctx->header_start[1] == 'A'
+ && ctx->header_start[2] == 'I'
+ && ctx->header_start[3] == 'T')
+ {
+ s->auth_wait = 1;
+ continue;
+ }
+
ctx->errmsg.len = len;
ctx->errmsg.data = ctx->header_start;
@@ -632,6 +642,23 @@ ngx_imap_auth_http_process_headers(ngx_imap_session_t *s,
return;
}
+ if (s->auth_wait) {
+ timer = ctx->sleep;
+
+ ngx_destroy_pool(ctx->pool);
+
+ if (timer == 0) {
+ ngx_imap_auth_http_init(s);
+ return;
+ }
+
+ ngx_add_timer(s->connection->read, timer * 1000);
+
+ s->connection->read->handler = ngx_imap_auth_sleep_handler;
+
+ return;
+ }
+
if (ctx->addr.len == 0 || ctx->port.len == 0) {
ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
"auth http server %V did not send server or port",
@@ -758,6 +785,12 @@ ngx_imap_auth_sleep_handler(ngx_event_t *rev)
rev->timedout = 0;
+ if (s->auth_wait) {
+ s->auth_wait = 0;
+ ngx_imap_auth_http_init(s);
+ return;
+ }
+
if (s->protocol == NGX_IMAP_POP3_PROTOCOL) {
s->imap_state = ngx_pop3_start;
s->connection->read->handler = ngx_pop3_auth_state;