Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This property represents the IP closest to the user. This means it is
potentially unsafe because clients can fake it but might be more useful for geolocation purposes.
Closes #904
Hi 👋!
This is my first attempt at contributing to tornado (long time user via JupyterHub and BinderHub). I picked #904 because it looked interesting and not too hard. However it is a very old issue so maybe thinking has moved on since then about how useful it is?
I thought I'd open this PR already to get some early feedback. I think if things look about right a better/more doc string is needed and maybe some more edge case test. Also need to look at availability of the
ipaddress
module in terms of which versions tornado supports.I think it is ok to always provide this, not only when
xheaders=True
, as it is always "unsafe" to look at this value/take it at face value.What do you think of the name of the new property? Is the
HTTPServerRequest
class the right place for this or should it be in the connection class like theremote_ip
handling?(should this be a draft PR until it is ready for reviewing?)