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

request.info.remoteAddress / request.info.remotePort undefined after connection closed (request aborted) #4034

Closed
dominykas opened this issue Jan 27, 2020 · 1 comment
Assignees
Labels
$ Issue covered by a commercial support plan bug Bug or defect feature New functionality or improvement
Milestone

Comments

@dominykas
Copy link
Contributor

Support plan

  • which support plan is this issue covered by? (e.g. Community, Core, Plus, or Enterprise): Enterprise (I think)
  • is this issue currently blocking your project? (yes/no): not exactly, a workaround exists
  • is this issue affecting a production system? (yes/no): not yet

Context

  • node version: 12.4.1
  • module version with issue: @commercial/hapi@19.0.5
  • last module version without issue: Unsure, but 18.x was OK
  • environment (e.g. node, browser, native): node
  • used with (e.g. hapi application, another framework, standalone, ...): hapi service
  • any other relevant information:

What are you trying to achieve or the steps to reproduce?

request.info.remoteAddress is not available after the socket is closed. It used to be available, because info data used to be constructed in full up till acab470, whereas now remoteAddress / remotePort are cached upon first access. If the first access is after the request aborted - the returned value is undefined (node docs say this bit is as designed).

It is trivial to work around this by e.g. calling request.info.toJSON() at the start of the request handler to make sure the IP is cached, but I wonder if this was intended and if so - should it be listed in release notes.

A quick search also found this: nodejs/node-v0.x-archive#9287, and I can see the IP address in the peername field, but it seems this has changed at some point between 0.x and 4.x...

What was the result you got?

request.info.remoteAddress is undefined.

What result did you expect?

request.info.remoteAddress should report the remote address (as recorded when the request came in?)

@dominykas dominykas added the support Questions, discussions, and general support label Jan 27, 2020
@hueniverse hueniverse self-assigned this Feb 3, 2020
@hueniverse hueniverse added bug Bug or defect feature New functionality or improvement $ Issue covered by a commercial support plan and removed support Questions, discussions, and general support labels Feb 3, 2020
@hueniverse hueniverse added this to the 19.0.6 milestone Feb 3, 2020
@hueniverse
Copy link
Contributor

Also updated the v19 release notes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
$ Issue covered by a commercial support plan bug Bug or defect feature New functionality or improvement
Projects
None yet
Development

No branches or pull requests

2 participants