Project

General

Profile

Actions

Bug #2610

closed

req_header.overwrite doesn't appear to overwrite the value

Added by Jynxster over 9 years ago. Updated over 9 years ago.

Status:
Invalid
Priority:
Normal
Category:
-

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.

Actions #1

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.

Actions #2

Updated by Jynxster over 9 years ago

stbuehler wrote:

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.

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)

Actions

Also available in: Atom