Mercurial > hg > nginx
diff src/mail/ngx_mail_imap_handler.c @ 9235:d7fd0acdea64
Mail: handling of pipelined commands which cross buffer boundary.
Previously, pipelined commands which cross buffer boundary were rejected
as too long, even if the command itself was short enough to be handled
within the client buffer.
Fix is to move non-processed commands to the start of the buffer after
the previous command is fully processed.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Sat, 30 Mar 2024 05:05:31 +0300 |
parents | c690a902bfec |
children | 32d4582c484d |
line wrap: on
line diff
--- a/src/mail/ngx_mail_imap_handler.c Sat Mar 30 05:05:05 2024 +0300 +++ b/src/mail/ngx_mail_imap_handler.c Sat Mar 30 05:05:31 2024 +0300 @@ -102,6 +102,7 @@ ngx_mail_imap_auth_state(ngx_event_t *rev) { u_char *p; + size_t n; ngx_int_t rc; ngx_uint_t tag; ngx_connection_t *c; @@ -285,6 +286,12 @@ if (s->buffer->pos == s->buffer->last) { s->buffer->pos = s->buffer->start; s->buffer->last = s->buffer->start; + + } else { + n = s->buffer->last - s->buffer->pos; + ngx_memmove(s->buffer->start, s->buffer->pos, n); + s->buffer->pos = s->buffer->start; + s->buffer->last = s->buffer->start + n; } s->tag.len = 0;