-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Use req.socket instead of req.connection #8 #9
Use req.socket instead of req.connection #8 #9
Conversation
Thank you for the fix! I am hitting the same warning from the logs. When will this fix be released? |
FIY: |
Thanks for this PR, and sorry I was not subscribed to this module's notifications. I see no issue with reading the new property, but I am a little afraid about modules on npm that are trying to overwrite the ip or mock http may end up having an issue once this is merged. I am thinking about the impact to the use in Express, so it may extend to other things using this. So I'm wondering if it would be possible to keep reading both values or something. I will try to research into what the mocks and such are doing at least in the Express ecosystem to assess the impact of switching to a new property, but anyone is welcome to post an assessment as well. No assessment on the impact has been provided so far, so I will try to do it this weekend since Node.js has deprecated the property used here (though I'm not sure what the impact of using the old property is). |
Just as an update before I go to sleep, I looked around a bit, and there are definately a fair number of mock libraries on public npm that only provide a So ideally if there is a way to make this change backwards-compatible that would be amazing. If it is not possible, then we may want to figure out what our next steps should be. Anyway, the above can still be deferred until there is a more comprehensive list of affected mock libraries, etc. as well. |
Sorry, I just realized before I signed off, that I... swapped |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI - proxy-addr tests only mock .connection
. I think we should release this as patch, so the best option is to support both.
@@ -28,7 +28,7 @@ function forwarded (req) { | |||
|
|||
// simple header parsing | |||
var proxyAddrs = parse(req.headers['x-forwarded-for'] || '') | |||
var socketAddr = req.connection.remoteAddress | |||
var socketAddr = req.socket.remoteAddress |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var socketAddr = req.socket.remoteAddress | |
var socketAddr = req.socket ? req.socket.remoteAddress : req.connection.remoteAddress |
A test should be added to cover this case.
Hi @briceruzand I went ahead and incorporated all the changes from this PR as well as added tests for these changes since I didn't hear any objection about the changes, but also the changes were never accepted in to the PR. |
Fixes #8
I used fastify and jshttp/forwarded generate a warning due to that deprecation usage.
Related fastify issues :