From a1862cc809caf08516f8fe5cf11080b46cc0ea69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BChler?= Date: Mon, 27 Jul 2009 16:12:36 +0000 Subject: [PATCH] Fix ipv6 in mod_proxy (fixes #2043) git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2605 152afb58-edef-0310-8abb-c4023f1b3aa9 --- NEWS | 1 + src/mod_proxy.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 385c1408..9e9210e6 100644 --- a/NEWS +++ b/NEWS @@ -31,6 +31,7 @@ NEWS * Use disable-time in fastcgi for all disables after errors, default is 1sec (fixes #2040) * Remove adaptive spawning code from fastcgi (was disabled for a long time) * Allow mod_mysql_vhost to use stored procedures (fixes #2011, thx Ben Brown) + * Fix ipv6 in mod_proxy (fixes #2043) - 1.4.23 - 2009-06-19 * Added some extra warning options in cmake and fix the resulting warnings (unused/static functions) diff --git a/src/mod_proxy.c b/src/mod_proxy.c index 9883c932..258890c8 100644 --- a/src/mod_proxy.c +++ b/src/mod_proxy.c @@ -756,12 +756,15 @@ static handler_t proxy_write_request(server *srv, handler_ctx *hctx) { switch(hctx->state) { case PROXY_STATE_INIT: +#if defined(HAVE_IPV6) && defined(HAVE_INET_PTON) if (strstr(host->host->ptr,":")) { if (-1 == (hctx->fd = socket(AF_INET6, SOCK_STREAM, 0))) { log_error_write(srv, __FILE__, __LINE__, "ss", "socket failed: ", strerror(errno)); return HANDLER_ERROR; } - } else { + } else +#endif + { if (-1 == (hctx->fd = socket(AF_INET, SOCK_STREAM, 0))) { log_error_write(srv, __FILE__, __LINE__, "ss", "socket failed: ", strerror(errno)); return HANDLER_ERROR;