comparison src/mail/ngx_mail_pop3_handler.c @ 7838:815c63581be4

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.
author Maxim Dounin <mdounin@mdounin.ru>
date Wed, 19 May 2021 03:13:18 +0300
parents da0a85e91587
children c690a902bfec
comparison
equal deleted inserted replaced
7837:ba8a8299b904 7838:815c63581be4
260 rc = ngx_mail_auth_external(s, c, 0); 260 rc = ngx_mail_auth_external(s, c, 0);
261 break; 261 break;
262 } 262 }
263 } 263 }
264 264
265 if (s->buffer->pos < s->buffer->last) {
266 s->blocked = 1;
267 }
268
265 switch (rc) { 269 switch (rc) {
266 270
267 case NGX_DONE: 271 case NGX_DONE:
268 ngx_mail_auth(s, c); 272 ngx_mail_auth(s, c);
269 return; 273 return;
281 /* fall through */ 285 /* fall through */
282 286
283 case NGX_OK: 287 case NGX_OK:
284 288
285 s->args.nelts = 0; 289 s->args.nelts = 0;
286 s->buffer->pos = s->buffer->start; 290
287 s->buffer->last = s->buffer->start; 291 if (s->buffer->pos == s->buffer->last) {
292 s->buffer->pos = s->buffer->start;
293 s->buffer->last = s->buffer->start;
294 }
288 295
289 if (s->state) { 296 if (s->state) {
290 s->arg_start = s->buffer->start; 297 s->arg_start = s->buffer->pos;
291 } 298 }
292 299
293 if (ngx_handle_read_event(c->read, 0) != NGX_OK) { 300 if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
294 ngx_mail_session_internal_server_error(s); 301 ngx_mail_session_internal_server_error(s);
295 return; 302 return;
398 ngx_mail_ssl_conf_t *sslcf; 405 ngx_mail_ssl_conf_t *sslcf;
399 406
400 if (c->ssl == NULL) { 407 if (c->ssl == NULL) {
401 sslcf = ngx_mail_get_module_srv_conf(s, ngx_mail_ssl_module); 408 sslcf = ngx_mail_get_module_srv_conf(s, ngx_mail_ssl_module);
402 if (sslcf->starttls) { 409 if (sslcf->starttls) {
410 s->buffer->pos = s->buffer->start;
411 s->buffer->last = s->buffer->start;
403 c->read->handler = ngx_mail_starttls_handler; 412 c->read->handler = ngx_mail_starttls_handler;
404 return NGX_OK; 413 return NGX_OK;
405 } 414 }
406 } 415 }
407 416