mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-02 17:28:30 +00:00
Use last X-Forwarded-For header (#367)
This header is non-standard but AWS seems to need this.
This commit is contained in:
parent
cfc557f7c7
commit
2a938b3eaa
4 changed files with 16 additions and 5 deletions
|
@ -822,8 +822,12 @@ static inline void GetRemoteAddr(uint32_t *ip, uint16_t *port) {
|
|||
GetClientAddr(ip, port);
|
||||
if (HasHeader(kHttpXForwardedFor) &&
|
||||
(IsPrivateIp(*ip) || IsLoopbackIp(*ip))) {
|
||||
ParseForwarded(HeaderData(kHttpXForwardedFor),
|
||||
HeaderLength(kHttpXForwardedFor), ip, port);
|
||||
if (ParseForwarded(HeaderData(kHttpXForwardedFor),
|
||||
HeaderLength(kHttpXForwardedFor),
|
||||
ip, port) == -1)
|
||||
WARNF("invalid X-Forwarded-For value: %`'.*s",
|
||||
HeaderLength(kHttpXForwardedFor),
|
||||
HeaderData(kHttpXForwardedFor));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue