Browse Source

set REDIRECT_URI in mod_rewrite, mod_magnet

set REDIRECT_URI in mod_rewrite, mod_magnet if request URI is modified
to differ from the original request URI.
personal/stbuehler/mod-csrf-old
Glenn Strauss 6 years ago
parent
commit
b473220d69
  1. 6
      src/mod_magnet.c
  2. 7
      src/mod_rewrite.c

6
src/mod_magnet.c

@ -1015,6 +1015,12 @@ static handler_t magnet_attract(server *srv, connection *con, plugin_data *p, bu
result = HANDLER_FINISHED;
} else if (MAGNET_RESTART_REQUEST == lua_return_value) {
if (!buffer_is_equal(con->request.uri, con->request.orig_uri)
&& !array_get_element(con->environment, "REDIRECT_URI")) {
array_set_key_value(con->environment,
CONST_STR_LEN("REDIRECT_URI"),
CONST_BUF_LEN(con->request.orig_uri));
}
result = HANDLER_COMEBACK;
}

7
src/mod_rewrite.c

@ -444,6 +444,13 @@ static handler_t process_rewrite_rules(server *srv, connection *con, plugin_data
if (rule->once) hctx->state = REWRITE_STATE_FINISHED;
if (!buffer_is_equal(con->request.uri, con->request.orig_uri)
&& !array_get_element(con->environment, "REDIRECT_URI")) {
array_set_key_value(con->environment,
CONST_STR_LEN("REDIRECT_URI"),
CONST_BUF_LEN(con->request.orig_uri));
}
return HANDLER_COMEBACK;
}
#undef N

Loading…
Cancel
Save