mirror of
https://github.com/hoytech/strfry.git
synced 2025-06-20 17:59:50 +00:00
hack to workaround uWebsockets issue preventing parsing of some IPv6 addresses (reported by Petr Kracík)
This commit is contained in:
2
CHANGES
2
CHANGES
@ -1,6 +1,8 @@
|
|||||||
* New config param: relay.info.nips which allows you to override the NIPs
|
* New config param: relay.info.nips which allows you to override the NIPs
|
||||||
that are claimed to be supported (requested by ismyhc)
|
that are claimed to be supported (requested by ismyhc)
|
||||||
* New connectionTimeout parameter in router config (thanks Braydon Fuller!)
|
* New connectionTimeout parameter in router config (thanks Braydon Fuller!)
|
||||||
|
* Bugfix: IPv4-mapped IPv6 addresses in X-Real-IP headers were not parsed
|
||||||
|
correctly (reported by Petr Kracík)
|
||||||
|
|
||||||
1.0.1
|
1.0.1
|
||||||
* Prevent exporting a v2 DB using --fried. The packed representation will be
|
* Prevent exporting a v2 DB using --fried. The packed representation will be
|
||||||
|
@ -197,6 +197,11 @@ void RelayServer::runWebsocket(ThreadPool<MsgWebsocket>::Thread &thr) {
|
|||||||
|
|
||||||
if (cfg().relay__realIpHeader.size()) {
|
if (cfg().relay__realIpHeader.size()) {
|
||||||
auto header = req.getHeader(cfg().relay__realIpHeader.c_str()).toString(); // not string_view: parseIP needs trailing 0 byte
|
auto header = req.getHeader(cfg().relay__realIpHeader.c_str()).toString(); // not string_view: parseIP needs trailing 0 byte
|
||||||
|
|
||||||
|
// HACK: uWebSockets strips leading : characters, which interferes with IPv6 parsing.
|
||||||
|
// This fixes it for the common ::1 and ::ffff:1.2.3.4 cases. FIXME: fix the underlying library.
|
||||||
|
if (header == "1" || header.starts_with("ffff:")) header = std::string("::") + header;
|
||||||
|
|
||||||
c->ipAddr = parseIP(header);
|
c->ipAddr = parseIP(header);
|
||||||
if (c->ipAddr.size() == 0) LW << "Couldn't parse IP from header " << cfg().relay__realIpHeader << ": " << header;
|
if (c->ipAddr.size() == 0) LW << "Couldn't parse IP from header " << cfg().relay__realIpHeader << ": " << header;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user