]> granicus.if.org Git - apache/commitdiff
Turn static function get_server_name_for_url() into public function
authorStefan Fritsch <sf@apache.org>
Sat, 16 Jan 2010 20:32:09 +0000 (20:32 +0000)
committerStefan Fritsch <sf@apache.org>
Sat, 16 Jan 2010 20:32:09 +0000 (20:32 +0000)
ap_get_server_name_for_url() and use it where appropriate. This fixes
mod_rewrite generating invalid URLs for redirects to IPv6 literal addresses.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@900022 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
include/ap_mmn.h
include/http_core.h
modules/mappers/mod_rewrite.c
modules/ssl/ssl_engine_kernel.c
server/core.c

diff --git a/CHANGES b/CHANGES
index 0ef44b57e4134a7807bc2ff6d143aec5e7ed97a7..f2e79f286e44799a71cdf69c1ed80753fd35d6c9 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -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]
 
index ceb8f0b98c551b4085ae6216c8e589bae2fad75c..47c0bb6bfc74b5e739eaeabf89822dd26e9e4c4e 100644 (file)
  * 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()
  *
  */
 
 #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
index 2583493609f496089a56197dcea2d4c9f1da6d94..f6d81a4069bcd3c53f0720fb7e18e163d2079e08 100644 (file)
@@ -210,6 +210,15 @@ AP_DECLARE(char *) ap_construct_url(apr_pool_t *p, const char *uri, request_rec
  */
 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
index dd01c813aba4c54096c1bfdc7f1eac8f31320d1b..1fbd917620d455d55fd8976fbf8112a5d5839aaa 100644 (file)
@@ -881,7 +881,7 @@ static void fully_qualify_uri(request_rec *r)
         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 @@ static int hook_uri2file(request_rec *r)
      */
 
     /* 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 = "";
index fdfcee2b5d449b1adb72cfcb90a52d2e5d3ec5f2..c9cd164661bd60435d82375b91328fcb22c748b6 100644 (file)
@@ -151,7 +151,7 @@ int ssl_hook_ReadReq(request_rec *r)
 
         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,
index 7c37861aaf251f9a584ecd9b0b69b096f15e0ae3..239c7840f9f0bd103db4131e0a3e8db5198d416f 100644 (file)
@@ -924,7 +924,7 @@ AP_DECLARE(const char *) ap_get_server_name(request_rec *r)
  * 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 @@ AP_DECLARE(char *) ap_construct_url(apr_pool_t *p, const char *uri,
                                     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);