Mercurial > hg > nginx
comparison src/mail/ngx_mail_smtp_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 |
comparison
equal
deleted
inserted
replaced
9234:c690a902bfec | 9235:d7fd0acdea64 |
---|---|
428 | 428 |
429 | 429 |
430 void | 430 void |
431 ngx_mail_smtp_auth_state(ngx_event_t *rev) | 431 ngx_mail_smtp_auth_state(ngx_event_t *rev) |
432 { | 432 { |
433 size_t n; | |
433 ngx_int_t rc; | 434 ngx_int_t rc; |
434 ngx_connection_t *c; | 435 ngx_connection_t *c; |
435 ngx_mail_session_t *s; | 436 ngx_mail_session_t *s; |
436 | 437 |
437 c = rev->data; | 438 c = rev->data; |
575 s->args.nelts = 0; | 576 s->args.nelts = 0; |
576 | 577 |
577 if (s->buffer->pos == s->buffer->last) { | 578 if (s->buffer->pos == s->buffer->last) { |
578 s->buffer->pos = s->buffer->start; | 579 s->buffer->pos = s->buffer->start; |
579 s->buffer->last = s->buffer->start; | 580 s->buffer->last = s->buffer->start; |
581 | |
582 } else { | |
583 n = s->buffer->last - s->buffer->pos; | |
584 ngx_memmove(s->buffer->start, s->buffer->pos, n); | |
585 s->buffer->pos = s->buffer->start; | |
586 s->buffer->last = s->buffer->start + n; | |
580 } | 587 } |
581 | 588 |
582 if (s->state) { | 589 if (s->state) { |
583 s->arg_start = s->buffer->pos; | 590 s->arg_start = s->buffer->pos; |
584 } | 591 } |