Mercurial > hg > nginx
comparison 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 |
comparison
equal
deleted
inserted
replaced
9234:c690a902bfec | 9235:d7fd0acdea64 |
---|---|
100 | 100 |
101 void | 101 void |
102 ngx_mail_imap_auth_state(ngx_event_t *rev) | 102 ngx_mail_imap_auth_state(ngx_event_t *rev) |
103 { | 103 { |
104 u_char *p; | 104 u_char *p; |
105 size_t n; | |
105 ngx_int_t rc; | 106 ngx_int_t rc; |
106 ngx_uint_t tag; | 107 ngx_uint_t tag; |
107 ngx_connection_t *c; | 108 ngx_connection_t *c; |
108 ngx_mail_session_t *s; | 109 ngx_mail_session_t *s; |
109 | 110 |
283 | 284 |
284 } else { | 285 } else { |
285 if (s->buffer->pos == s->buffer->last) { | 286 if (s->buffer->pos == s->buffer->last) { |
286 s->buffer->pos = s->buffer->start; | 287 s->buffer->pos = s->buffer->start; |
287 s->buffer->last = s->buffer->start; | 288 s->buffer->last = s->buffer->start; |
289 | |
290 } else { | |
291 n = s->buffer->last - s->buffer->pos; | |
292 ngx_memmove(s->buffer->start, s->buffer->pos, n); | |
293 s->buffer->pos = s->buffer->start; | |
294 s->buffer->last = s->buffer->start + n; | |
288 } | 295 } |
289 | 296 |
290 s->tag.len = 0; | 297 s->tag.len = 0; |
291 } | 298 } |
292 } | 299 } |