[mod_redirect,mod_rewrite] use server_name

use server_name for authority if Host not provided
(Host is not required in HTTP/1.0)
This commit is contained in:
Glenn Strauss 2018-11-18 22:38:47 -05:00
parent b5cd216781
commit f0df89a996
2 changed files with 4 additions and 0 deletions

View File

@ -163,6 +163,8 @@ URIHANDLER_FUNC(mod_redirect_uri_handler) {
burl.port = sock_addr_get_port(&con->srv_socket->addr);
burl.path = con->uri.path_raw;
burl.query = con->uri.query;
if (buffer_string_is_empty(burl.authority))
burl.authority = con->server_name;
/* redirect URL on match
* e.g. redirect /base/ to /index.php?section=base

View File

@ -256,6 +256,8 @@ static handler_t process_rewrite_rules(server *srv, connection *con, plugin_data
burl.port = sock_addr_get_port(&con->srv_socket->addr);
burl.path = con->uri.path_raw;
burl.query = con->uri.query;
if (buffer_string_is_empty(burl.authority))
burl.authority = con->server_name;
rc = pcre_keyvalue_buffer_process(kvb, &ctx, con->request.uri, srv->tmp_buf);
if (HANDLER_FINISHED == rc && !buffer_is_empty(srv->tmp_buf) && srv->tmp_buf->ptr[0] == '/') {