Bug #2610
closedreq_header.overwrite doesn't appear to overwrite the value
Description
Trying to modify the REMOTE_ADDR value
req_header.overwrite( "REMOTE_ADDR", "127.0.0.1" );
it appears that:
./modules/fastcgi_stream.c: fastcgi_env_add(buf, envdup, CONST_STR_LEN("REMOTE_ADDR"), GSTR_LEN(coninfo->remote_addr_str));
is ignoring the information assigned above.
Updated by stbuehler over 9 years ago
- Status changed from New to Invalid
REMOTE_ADDR
is a CGI environment variable; setting those is done with env.set
and friends.
The request headers are part of the CGI environment as well, but the key (header name) is prefixed with "HTTP_" and all non alpha-numeric characters in the key get replaced by "_", i.e. the header "overwritten" above would be visible as HTTP_REMOTE_ADDR
.
Updated by Jynxster over 9 years ago
stbuehler wrote:
REMOTE_ADDR
is a CGI environment variable; setting those is done withenv.set
and friends.The request headers are part of the CGI environment as well, but the key (header name) is prefixed with "HTTP_" and all non alpha-numeric characters in the key get replaced by "_", i.e. the header "overwritten" above would be visible as
HTTP_REMOTE_ADDR
.
Thanks for that stbuehler, using env.set indeed worked as expected.
Maybe with the docs, you could specify the difference (ie: req_header does HTTP_ while env.set does not?) with so many header related functions, it's hard to determine what is used for what (header.add, req_header.add, env.add)
Also available in: Atom