comparison src/mail/ngx_mail_auth_http_module.c @ 382:984bb0b1399b NGINX_0_7_3

nginx 0.7.3 *) Change: the "rss" extension MIME type has been changed to "application/rss+xml". *) Change: now the "gzip_vary" directive turned on issues a "Vary: Accept-Encoding" header line for uncompressed responses too. *) Feature: now the "rewrite" directive does a redirect automatically if the "https://" protocol is used. *) Bugfix: the "proxy_pass" directive did not work with the HTTPS protocol; the bug had appeared in 0.6.9.
author Igor Sysoev <http://sysoev.ru>
date Mon, 23 Jun 2008 00:00:00 +0400
parents 05693816539c
children 12defd37f578
comparison
equal deleted inserted replaced
381:23d1555141d9 382:984bb0b1399b
591 sizeof("Auth-User") - 1) 591 sizeof("Auth-User") - 1)
592 == 0) 592 == 0)
593 { 593 {
594 s->login.len = ctx->header_end - ctx->header_start; 594 s->login.len = ctx->header_end - ctx->header_start;
595 595
596 s->login.data = ngx_palloc(s->connection->pool, s->login.len); 596 s->login.data = ngx_pnalloc(s->connection->pool, s->login.len);
597 if (s->login.data == NULL) { 597 if (s->login.data == NULL) {
598 ngx_close_connection(ctx->peer.connection); 598 ngx_close_connection(ctx->peer.connection);
599 ngx_destroy_pool(ctx->pool); 599 ngx_destroy_pool(ctx->pool);
600 ngx_mail_session_internal_server_error(s); 600 ngx_mail_session_internal_server_error(s);
601 return; 601 return;
612 sizeof("Auth-Pass") - 1) 612 sizeof("Auth-Pass") - 1)
613 == 0) 613 == 0)
614 { 614 {
615 s->passwd.len = ctx->header_end - ctx->header_start; 615 s->passwd.len = ctx->header_end - ctx->header_start;
616 616
617 s->passwd.data = ngx_palloc(s->connection->pool, s->passwd.len); 617 s->passwd.data = ngx_pnalloc(s->connection->pool,
618 s->passwd.len);
618 if (s->passwd.data == NULL) { 619 if (s->passwd.data == NULL) {
619 ngx_close_connection(ctx->peer.connection); 620 ngx_close_connection(ctx->peer.connection);
620 ngx_destroy_pool(ctx->pool); 621 ngx_destroy_pool(ctx->pool);
621 ngx_mail_session_internal_server_error(s); 622 ngx_mail_session_internal_server_error(s);
622 return; 623 return;
649 sizeof("Auth-Error-Code") - 1) 650 sizeof("Auth-Error-Code") - 1)
650 == 0) 651 == 0)
651 { 652 {
652 ctx->errcode.len = ctx->header_end - ctx->header_start; 653 ctx->errcode.len = ctx->header_end - ctx->header_start;
653 654
654 ctx->errcode.data = ngx_palloc(s->connection->pool, 655 ctx->errcode.data = ngx_pnalloc(s->connection->pool,
655 ctx->errcode.len); 656 ctx->errcode.len);
656 if (ctx->errcode.data == NULL) { 657 if (ctx->errcode.data == NULL) {
657 ngx_close_connection(ctx->peer.connection); 658 ngx_close_connection(ctx->peer.connection);
658 ngx_destroy_pool(ctx->pool); 659 ngx_destroy_pool(ctx->pool);
659 ngx_mail_session_internal_server_error(s); 660 ngx_mail_session_internal_server_error(s);
660 return; 661 return;
689 } 690 }
690 691
691 ctx->err.len = ctx->errcode.len + ctx->errmsg.len 692 ctx->err.len = ctx->errcode.len + ctx->errmsg.len
692 + sizeof(" " CRLF) - 1; 693 + sizeof(" " CRLF) - 1;
693 694
694 p = ngx_palloc(s->connection->pool, ctx->err.len); 695 p = ngx_pnalloc(s->connection->pool, ctx->err.len);
695 if (p == NULL) { 696 if (p == NULL) {
696 ngx_close_connection(ctx->peer.connection); 697 ngx_close_connection(ctx->peer.connection);
697 ngx_destroy_pool(ctx->pool); 698 ngx_destroy_pool(ctx->pool);
698 ngx_mail_session_internal_server_error(s); 699 ngx_mail_session_internal_server_error(s);
699 return; 700 return;
808 809
809 len = ctx->addr.len + 1 + ctx->port.len; 810 len = ctx->addr.len + 1 + ctx->port.len;
810 811
811 peer->name.len = len; 812 peer->name.len = len;
812 813
813 peer->name.data = ngx_palloc(s->connection->pool, len); 814 peer->name.data = ngx_pnalloc(s->connection->pool, len);
814 if (peer->name.data == NULL) { 815 if (peer->name.data == NULL) {
815 ngx_destroy_pool(ctx->pool); 816 ngx_destroy_pool(ctx->pool);
816 ngx_mail_session_internal_server_error(s); 817 ngx_mail_session_internal_server_error(s);
817 return; 818 return;
818 } 819 }
1253 return NGX_OK; 1254 return NGX_OK;
1254 } 1255 }
1255 1256
1256 escaped->len = text->len + n * 2; 1257 escaped->len = text->len + n * 2;
1257 1258
1258 p = ngx_palloc(pool, escaped->len); 1259 p = ngx_pnalloc(pool, escaped->len);
1259 if (p == NULL) { 1260 if (p == NULL) {
1260 return NGX_ERROR; 1261 return NGX_ERROR;
1261 } 1262 }
1262 1263
1263 (void) ngx_escape_uri(p, text->data, text->len, NGX_ESCAPE_MAIL_AUTH); 1264 (void) ngx_escape_uri(p, text->data, text->len, NGX_ESCAPE_MAIL_AUTH);
1324 header = conf->headers->elts; 1325 header = conf->headers->elts;
1325 for (i = 0; i < conf->headers->nelts; i++) { 1326 for (i = 0; i < conf->headers->nelts; i++) {
1326 len += header[i].key.len + 2 + header[i].value.len + 2; 1327 len += header[i].key.len + 2 + header[i].value.len + 2;
1327 } 1328 }
1328 1329
1329 p = ngx_palloc(cf->pool, len); 1330 p = ngx_pnalloc(cf->pool, len);
1330 if (p == NULL) { 1331 if (p == NULL) {
1331 return NGX_CONF_ERROR; 1332 return NGX_CONF_ERROR;
1332 } 1333 }
1333 1334
1334 conf->header.len = len; 1335 conf->header.len = len;