[PATCH] Mail: fix support for unix sockets in auth_http
Maxim Dounin
mdounin at mdounin.ru
Thu Dec 24 03:49:57 MSK 2009
# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1261615729 -10800
# Node ID c72fabe04c8d51c5d9f972aaeee1b1644d4c8ac1
# Parent 6026569dbf6419fdfef3dd31b76d6898ee3bbb17
Mail: fix support for unix sockets in auth_http.
Requests to auth_http server were produced with incorrect Host header and
as a result were rejected at least by nginx's own http server. Use localhost
as Host header for unix sockets (consistent with http proxy module).
Reported by: Alexey V. Degtyarev
diff --git a/src/mail/ngx_mail_auth_http_module.c b/src/mail/ngx_mail_auth_http_module.c
--- a/src/mail/ngx_mail_auth_http_module.c
+++ b/src/mail/ngx_mail_auth_http_module.c
@@ -1405,7 +1405,14 @@ ngx_mail_auth_http(ngx_conf_t *cf, ngx_c
ahcf->peer = u.addrs;
- ahcf->host_header = u.host;
+ if (u.family != AF_UNIX) {
+ ahcf->host_header = u.host;
+
+ } else {
+ ahcf->host_header.len = sizeof("localhost") - 1;
+ ahcf->host_header.data = (u_char *) "localhost";
+ }
+
ahcf->uri = u.uri;
if (ahcf->uri.len == 0) {
More information about the nginx-devel
mailing list