]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r900022 from trunk.
authorYann Ylavic <ylavic@apache.org>
Mon, 11 May 2015 10:02:04 +0000 (10:02 +0000)
committerYann Ylavic <ylavic@apache.org>
Mon, 11 May 2015 10:02:04 +0000 (10:02 +0000)
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.

Committed by: sf
Reviewed by: jailletc36, ylavic, rjung
Backported by: ylavic

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@1678714 13f79535-47bb-0310-9956-ffa450edef68

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

diff --git a/CHANGES b/CHANGES
index 6c0c49f771df0f89aa1bf1f4786cb5bdd5d90ca8..05223aaf688a96c6a98f5a76f15ec25f708e7644 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,11 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.2.30
 
+  *) 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. PR 52831 [Stefan Fritsch]
+
   *) dav_validate_request: avoid validating locks and ETags when there are
      no If headers providing them on a resource we aren't modifying.
      [Ben Reser]
diff --git a/STATUS b/STATUS
index 3127c7ca27ef352981f0b796102d85728cee237d..64925736db3c27ab5b793e6339e6754ac0a04620 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -101,15 +101,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-   * mod_rewrite: 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.
-     Fixed in 2.3.5 five years ago but repported later in 2.2.x (PR 52831)
-     trunk patch: http://svn.apache.org/r900022
-     2.4.x patch: http://people.apache.org/~jailletc36/PR52831.patch
-     +1: jailletc36, ylavic, rjung
-
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]
index 205869674383f9e3bfc9f8e401326db2481fa07b..975e951d9a9a7e44672aa93121c99d95b7eda9aa 100644 (file)
  * 20051115.34 (2.2.28) Add ap_copy_scoreboard_worker()
  * 20051115.35 (2.2.28) Add SSL reusable SNI to mod_proxy.h's proxy_conn_rec
  * 20051115.36 (2.2.28) Add r->trailers_{in,out}
+ * 20051115.37 (2.2.30) Add ap_get_server_name_for_url()
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503232UL /* "AP22" */
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
 #define MODULE_MAGIC_NUMBER_MAJOR 20051115
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 36                    /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 37                    /* 0...n */
 
 /**
  * Determine if the server's current MODULE_MAGIC_NUMBER is at least a
index 1aa9bd9b5a9e200ed8f1ec7c5de6ef2459874866..c397962bd4235250eaffffde038a4d004ed3f1cb 100644 (file)
@@ -227,6 +227,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 d3209b44954cfd84ca2ccac8f26660f57b0e1964..e1afe6f43c016a739f8885533d5bf31140a054a3 100644 (file)
@@ -860,7 +860,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)
                    ? ""
@@ -4353,7 +4353,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 07e099715d5065db296bed01e937c277c6dcfbbc..4f2df326ba6837b7079cc05ff7ee3bc23d3136e5 100644 (file)
@@ -973,7 +973,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);
 
@@ -1036,7 +1036,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);