Mercurial > hg > nginx
comparison src/mail/ngx_mail_proxy_module.c @ 2049:2a92804f4109
*) back out r2040
*) refactor ngx_palloc()
*) introduce ngx_pnalloc()
*) additional pool blocks have smaller header
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 17 Jun 2008 15:00:30 +0000 |
parents | 65581f79e81b |
children | 8156bc03982a |
comparison
equal
deleted
inserted
replaced
2048:824615f3b4ec | 2049:2a92804f4109 |
---|---|
251 ngx_log_debug0(NGX_LOG_DEBUG_MAIL, rev->log, 0, "mail proxy send user"); | 251 ngx_log_debug0(NGX_LOG_DEBUG_MAIL, rev->log, 0, "mail proxy send user"); |
252 | 252 |
253 s->connection->log->action = "sending user name to upstream"; | 253 s->connection->log->action = "sending user name to upstream"; |
254 | 254 |
255 line.len = sizeof("USER ") - 1 + s->login.len + 2; | 255 line.len = sizeof("USER ") - 1 + s->login.len + 2; |
256 line.data = ngx_palloc(c->pool, line.len); | 256 line.data = ngx_pnalloc(c->pool, line.len); |
257 if (line.data == NULL) { | 257 if (line.data == NULL) { |
258 ngx_mail_proxy_internal_server_error(s); | 258 ngx_mail_proxy_internal_server_error(s); |
259 return; | 259 return; |
260 } | 260 } |
261 | 261 |
270 ngx_log_debug0(NGX_LOG_DEBUG_MAIL, rev->log, 0, "mail proxy send pass"); | 270 ngx_log_debug0(NGX_LOG_DEBUG_MAIL, rev->log, 0, "mail proxy send pass"); |
271 | 271 |
272 s->connection->log->action = "sending password to upstream"; | 272 s->connection->log->action = "sending password to upstream"; |
273 | 273 |
274 line.len = sizeof("PASS ") - 1 + s->passwd.len + 2; | 274 line.len = sizeof("PASS ") - 1 + s->passwd.len + 2; |
275 line.data = ngx_palloc(c->pool, line.len); | 275 line.data = ngx_pnalloc(c->pool, line.len); |
276 if (line.data == NULL) { | 276 if (line.data == NULL) { |
277 ngx_mail_proxy_internal_server_error(s); | 277 ngx_mail_proxy_internal_server_error(s); |
278 return; | 278 return; |
279 } | 279 } |
280 | 280 |
367 | 367 |
368 s->connection->log->action = "sending LOGIN command to upstream"; | 368 s->connection->log->action = "sending LOGIN command to upstream"; |
369 | 369 |
370 line.len = s->tag.len + sizeof("LOGIN ") - 1 | 370 line.len = s->tag.len + sizeof("LOGIN ") - 1 |
371 + 1 + NGX_SIZE_T_LEN + 1 + 2; | 371 + 1 + NGX_SIZE_T_LEN + 1 + 2; |
372 line.data = ngx_palloc(c->pool, line.len); | 372 line.data = ngx_pnalloc(c->pool, line.len); |
373 if (line.data == NULL) { | 373 if (line.data == NULL) { |
374 ngx_mail_proxy_internal_server_error(s); | 374 ngx_mail_proxy_internal_server_error(s); |
375 return; | 375 return; |
376 } | 376 } |
377 | 377 |
386 ngx_log_debug0(NGX_LOG_DEBUG_MAIL, rev->log, 0, "mail proxy send user"); | 386 ngx_log_debug0(NGX_LOG_DEBUG_MAIL, rev->log, 0, "mail proxy send user"); |
387 | 387 |
388 s->connection->log->action = "sending user name to upstream"; | 388 s->connection->log->action = "sending user name to upstream"; |
389 | 389 |
390 line.len = s->login.len + 1 + 1 + NGX_SIZE_T_LEN + 1 + 2; | 390 line.len = s->login.len + 1 + 1 + NGX_SIZE_T_LEN + 1 + 2; |
391 line.data = ngx_palloc(c->pool, line.len); | 391 line.data = ngx_pnalloc(c->pool, line.len); |
392 if (line.data == NULL) { | 392 if (line.data == NULL) { |
393 ngx_mail_proxy_internal_server_error(s); | 393 ngx_mail_proxy_internal_server_error(s); |
394 return; | 394 return; |
395 } | 395 } |
396 | 396 |
406 "mail proxy send passwd"); | 406 "mail proxy send passwd"); |
407 | 407 |
408 s->connection->log->action = "sending password to upstream"; | 408 s->connection->log->action = "sending password to upstream"; |
409 | 409 |
410 line.len = s->passwd.len + 2; | 410 line.len = s->passwd.len + 2; |
411 line.data = ngx_palloc(c->pool, line.len); | 411 line.data = ngx_pnalloc(c->pool, line.len); |
412 if (line.data == NULL) { | 412 if (line.data == NULL) { |
413 ngx_mail_proxy_internal_server_error(s); | 413 ngx_mail_proxy_internal_server_error(s); |
414 return; | 414 return; |
415 } | 415 } |
416 | 416 |
503 s->connection->log->action = "sending HELO/EHLO to upstream"; | 503 s->connection->log->action = "sending HELO/EHLO to upstream"; |
504 | 504 |
505 cscf = ngx_mail_get_module_srv_conf(s, ngx_mail_core_module); | 505 cscf = ngx_mail_get_module_srv_conf(s, ngx_mail_core_module); |
506 | 506 |
507 line.len = sizeof("HELO ") - 1 + cscf->server_name.len + 2; | 507 line.len = sizeof("HELO ") - 1 + cscf->server_name.len + 2; |
508 line.data = ngx_palloc(c->pool, line.len); | 508 line.data = ngx_pnalloc(c->pool, line.len); |
509 if (line.data == NULL) { | 509 if (line.data == NULL) { |
510 ngx_mail_proxy_internal_server_error(s); | 510 ngx_mail_proxy_internal_server_error(s); |
511 return; | 511 return; |
512 } | 512 } |
513 | 513 |
533 line.len = sizeof("XCLIENT PROTO=SMTP HELO= ADDR= LOGIN= NAME=" | 533 line.len = sizeof("XCLIENT PROTO=SMTP HELO= ADDR= LOGIN= NAME=" |
534 CRLF) - 1 | 534 CRLF) - 1 |
535 + s->esmtp + s->smtp_helo.len | 535 + s->esmtp + s->smtp_helo.len |
536 + s->connection->addr_text.len + s->login.len + s->host.len; | 536 + s->connection->addr_text.len + s->login.len + s->host.len; |
537 | 537 |
538 line.data = ngx_palloc(c->pool, line.len); | 538 line.data = ngx_pnalloc(c->pool, line.len); |
539 if (line.data == NULL) { | 539 if (line.data == NULL) { |
540 ngx_mail_proxy_internal_server_error(s); | 540 ngx_mail_proxy_internal_server_error(s); |
541 return; | 541 return; |
542 } | 542 } |
543 | 543 |