Browse Source

[mod_redirect,mod_rewrite] use server_name

use server_name for authority if Host not provided
(Host is not required in HTTP/1.0)
personal/stbuehler/fix-fdevent
Glenn Strauss 4 years ago
parent
commit
f0df89a996
  1. 2
      src/mod_redirect.c
  2. 2
      src/mod_rewrite.c

2
src/mod_redirect.c

@ -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

2
src/mod_rewrite.c

@ -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] == '/') {

Loading…
Cancel
Save