Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the Shared Address Space address range #193

Merged
merged 2 commits into from
May 12, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/mochiweb_request.erl
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ get(peer, {?MODULE, [Socket, _Opts, _Method, _RawPath, _Version, _Headers]}=THIS
Hosts ->
string:strip(lists:last(string:tokens(Hosts, ",")))
end;
%% According to RFC 6598, contributor Gerald Xv
{ok, {Addr={100, Second, _, _}, _Port}} when (Second > 63) andalso (Second < 128) ->
case get_header_value("x-forwarded-for", THIS) of
undefined ->
inet_parse:ntoa(Addr);
Hosts ->
string:strip(lists:last(string:tokens(Hosts, ",")))
end;
{ok, {Addr={192, 168, _, _}, _Port}} ->
case get_header_value("x-forwarded-for", THIS) of
undefined ->
Expand Down