diff options
author | Maxim Dounin <mdounin@mdounin.ru> | 2021-05-19 03:13:18 +0300 |
---|---|---|
committer | Maxim Dounin <mdounin@mdounin.ru> | 2021-05-19 03:13:18 +0300 |
commit | d96d60d2e0a41a4e01163f7e5d1835e028f94b72 (patch) | |
tree | 614a998fe5b712737a86c0421ae0ba40ebd95c26 /src/mail/ngx_mail_pop3_handler.c | |
parent | 317223cb56f70f3fc2eb646a78a8f0161cafa70b (diff) | |
download | nginx-d96d60d2e0a41a4e01163f7e5d1835e028f94b72.tar.gz nginx-d96d60d2e0a41a4e01163f7e5d1835e028f94b72.zip |
Mail: POP3 pipelining support.
The change is mostly the same as the SMTP one (04e43d03e153 and 3f5d0af4e40a),
and ensures that nginx is able to properly handle or reject multiple POP3
commands, as required by the PIPELINING capability (RFC 2449). The s->cmd
field is not really used and set for consistency.
Diffstat (limited to 'src/mail/ngx_mail_pop3_handler.c')
-rw-r--r-- | src/mail/ngx_mail_pop3_handler.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/mail/ngx_mail_pop3_handler.c b/src/mail/ngx_mail_pop3_handler.c index edfd98681..226e7419b 100644 --- a/src/mail/ngx_mail_pop3_handler.c +++ b/src/mail/ngx_mail_pop3_handler.c @@ -262,6 +262,10 @@ ngx_mail_pop3_auth_state(ngx_event_t *rev) } } + if (s->buffer->pos < s->buffer->last) { + s->blocked = 1; + } + switch (rc) { case NGX_DONE: @@ -283,11 +287,14 @@ ngx_mail_pop3_auth_state(ngx_event_t *rev) case NGX_OK: s->args.nelts = 0; - s->buffer->pos = s->buffer->start; - s->buffer->last = s->buffer->start; + + if (s->buffer->pos == s->buffer->last) { + s->buffer->pos = s->buffer->start; + s->buffer->last = s->buffer->start; + } if (s->state) { - s->arg_start = s->buffer->start; + s->arg_start = s->buffer->pos; } if (ngx_handle_read_event(c->read, 0) != NGX_OK) { @@ -400,6 +407,8 @@ ngx_mail_pop3_stls(ngx_mail_session_t *s, ngx_connection_t *c) if (c->ssl == NULL) { sslcf = ngx_mail_get_module_srv_conf(s, ngx_mail_ssl_module); if (sslcf->starttls) { + s->buffer->pos = s->buffer->start; + s->buffer->last = s->buffer->start; c->read->handler = ngx_mail_starttls_handler; return NGX_OK; } |