You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by sf...@apache.org on 2010/01/16 21:32:10 UTC
svn commit: r900022 - in /httpd/httpd/trunk: CHANGES include/ap_mmn.h
include/http_core.h modules/mappers/mod_rewrite.c
modules/ssl/ssl_engine_kernel.c server/core.c
Author: sf
Date: Sat Jan 16 20:32:09 2010
New Revision: 900022
URL: http://svn.apache.org/viewvc?rev=900022&view=rev
Log:
Turn static function get_server_name_for_url() into public function
ap_get_server_name_for_url() and use it where appropriate. This fixes
mod_rewrite generating invalid URLs for redirects to IPv6 literal addresses.
Modified:
httpd/httpd/trunk/CHANGES
httpd/httpd/trunk/include/ap_mmn.h
httpd/httpd/trunk/include/http_core.h
httpd/httpd/trunk/modules/mappers/mod_rewrite.c
httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c
httpd/httpd/trunk/server/core.c
Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=900022&r1=900021&r2=900022&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Sat Jan 16 20:32:09 2010
@@ -2,6 +2,11 @@
Changes with Apache 2.3.5
+ *) Turn static function get_server_name_for_url() into public
+ ap_get_server_name_for_url() and use it where appropriate. This
+ fixes mod_rewrite generating invalid URLs for redirects to IPv6
+ literal addresses. [Stefan Fritsch]
+
*) mod_ldap: Introduce new config option LDAPTimeout to set the timeout
for LDAP operations like bind and search. [Stefan Fritsch]
Modified: httpd/httpd/trunk/include/ap_mmn.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_mmn.h?rev=900022&r1=900021&r2=900022&view=diff
==============================================================================
--- httpd/httpd/trunk/include/ap_mmn.h (original)
+++ httpd/httpd/trunk/include/ap_mmn.h Sat Jan 16 20:32:09 2010
@@ -211,6 +211,7 @@
* 20091230.0 (2.3.5-dev) Move ftp_directory_charset from proxy_dir_conf
* to proxy_ftp_dir_conf(mod_proxy_ftp)
* 20091230.1 (2.3.5-dev) add util_ldap_state_t.opTimeout
+ * 20091230.2 (2.3.5-dev) add ap_get_server_name_for_url()
*
*/
@@ -219,7 +220,7 @@
#ifndef MODULE_MAGIC_NUMBER_MAJOR
#define MODULE_MAGIC_NUMBER_MAJOR 20091230
#endif
-#define MODULE_MAGIC_NUMBER_MINOR 1 /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 2 /* 0...n */
/**
* Determine if the server's current MODULE_MAGIC_NUMBER is at least a
Modified: httpd/httpd/trunk/include/http_core.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/http_core.h?rev=900022&r1=900021&r2=900022&view=diff
==============================================================================
--- httpd/httpd/trunk/include/http_core.h (original)
+++ httpd/httpd/trunk/include/http_core.h Sat Jan 16 20:32:09 2010
@@ -211,6 +211,15 @@
AP_DECLARE(const char *) ap_get_server_name(request_rec *r);
/**
+ * Get the current server name from the request for the purposes
+ * of using in a URL. If the server name is an IPv6 literal
+ * address, it will be returned in URL format (e.g., "[fe80::1]").
+ * @param r The current request
+ * @return the server name
+ */
+AP_DECLARE(const char *) ap_get_server_name_for_url(request_rec *r);
+
+/**
* Get the current server port
* @param r The current request
* @return The server's port
Modified: httpd/httpd/trunk/modules/mappers/mod_rewrite.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_rewrite.c?rev=900022&r1=900021&r2=900022&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/mappers/mod_rewrite.c (original)
+++ httpd/httpd/trunk/modules/mappers/mod_rewrite.c Sat Jan 16 20:32:09 2010
@@ -881,7 +881,7 @@
char *thisport;
int port;
- thisserver = ap_get_server_name(r);
+ thisserver = ap_get_server_name_for_url(r);
port = ap_get_server_port(r);
thisport = ap_is_default_port(port, r)
? ""
@@ -4402,7 +4402,7 @@
*/
/* add the canonical URI of this URL */
- thisserver = ap_get_server_name(r);
+ thisserver = ap_get_server_name_for_url(r);
port = ap_get_server_port(r);
if (ap_is_default_port(port, r)) {
thisport = "";
Modified: httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c?rev=900022&r1=900021&r2=900022&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c (original)
+++ httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c Sat Jan 16 20:32:09 2010
@@ -151,7 +151,7 @@
thisurl = ap_escape_html(r->pool,
apr_psprintf(r->pool, "https://%s%s/",
- ap_get_server_name(r),
+ ap_get_server_name_for_url(r),
thisport));
errmsg = apr_psprintf(r->pool,
Modified: httpd/httpd/trunk/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?rev=900022&r1=900021&r2=900022&view=diff
==============================================================================
--- httpd/httpd/trunk/server/core.c (original)
+++ httpd/httpd/trunk/server/core.c Sat Jan 16 20:32:09 2010
@@ -924,7 +924,7 @@
* of using in a URL. If the server name is an IPv6 literal
* address, it will be returned in URL format (e.g., "[fe80::1]").
*/
-static const char *get_server_name_for_url(request_rec *r)
+AP_DECLARE(const char *) ap_get_server_name_for_url(request_rec *r)
{
const char *plain_server_name = ap_get_server_name(r);
@@ -987,7 +987,7 @@
request_rec *r)
{
unsigned port = ap_get_server_port(r);
- const char *host = get_server_name_for_url(r);
+ const char *host = ap_get_server_name_for_url(r);
if (ap_is_default_port(port, r)) {
return apr_pstrcat(p, ap_http_scheme(r), "://", host, uri, NULL);