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
-*- 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]
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 ]
* 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
*/
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
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)
? ""
*/
/* 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 = "";
* 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);
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);