Mercurial > hg > nginx
comparison src/mail/ngx_mail_pop3_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 |
---|---|
117 | 117 |
118 | 118 |
119 void | 119 void |
120 ngx_mail_pop3_auth_state(ngx_event_t *rev) | 120 ngx_mail_pop3_auth_state(ngx_event_t *rev) |
121 { | 121 { |
122 size_t n; | |
122 ngx_int_t rc; | 123 ngx_int_t rc; |
123 ngx_connection_t *c; | 124 ngx_connection_t *c; |
124 ngx_mail_session_t *s; | 125 ngx_mail_session_t *s; |
125 | 126 |
126 c = rev->data; | 127 c = rev->data; |
289 s->args.nelts = 0; | 290 s->args.nelts = 0; |
290 | 291 |
291 if (s->buffer->pos == s->buffer->last) { | 292 if (s->buffer->pos == s->buffer->last) { |
292 s->buffer->pos = s->buffer->start; | 293 s->buffer->pos = s->buffer->start; |
293 s->buffer->last = s->buffer->start; | 294 s->buffer->last = s->buffer->start; |
295 | |
296 } else { | |
297 n = s->buffer->last - s->buffer->pos; | |
298 ngx_memmove(s->buffer->start, s->buffer->pos, n); | |
299 s->buffer->pos = s->buffer->start; | |
300 s->buffer->last = s->buffer->start + n; | |
294 } | 301 } |
295 | 302 |
296 if (s->state) { | 303 if (s->state) { |
297 s->arg_start = s->buffer->pos; | 304 s->arg_start = s->buffer->pos; |
298 } | 305 } |