Skip to content

server.requestIp()#4559

Closed
Parzival-3141 wants to merge 5 commits intooven-sh:mainfrom
Parzival-3141:server-request-ip
Closed

server.requestIp()#4559
Parzival-3141 wants to merge 5 commits intooven-sh:mainfrom
Parzival-3141:server-request-ip

Conversation

@Parzival-3141
Copy link
Copy Markdown
Contributor

What does this PR do?

Closes #3540
Implements server.requestIp(request), returning the origin IP address of a Request.

Currently it just returns an ipv6 address string directly from UWS. The plan is to return a "SocketAddress" object, which will contain the address string and a value signaling what type it is.

  • Documentation or TypeScript types (it's okay to leave the rest blank in this case)
  • Code changes

How did you verify your code works?

  • I checked the lifetime of memory allocated to verify it's (1) freed and (2) only freed when it should be

  • I or my editor ran zig fmt on the changed files

  • I included a test for the new code, or an existing test covers it

  • JSValue used outside of the stack is either wrapped in a JSC.Strong or is JSValueProtect'ed

  • I added TypeScript types for the new methods, getters, or setters

  • I ran make codegen to regenerate the C++ and Zig code

Changed Request.uws_request to the new AnyRequestContext. This
allows grabbing the IP from a Request. Unfinished.
Currently using uws's requestIpAsText, which always returns a ipv6
string. We should return a `SocketAddress` object to the user instead,
which will contain the formatted address string and what type it is.
We'll have to use requestIpAsBinary and parse that ourselves.
@simylein
Copy link
Copy Markdown
Contributor

Any updates on this?

@JawadAhbab
Copy link
Copy Markdown

Any updates on this?

@phtdacosta
Copy link
Copy Markdown

Any...updates?

@ibnz36
Copy link
Copy Markdown

ibnz36 commented Sep 28, 2023

Any...updates?

I guess there are other currently important issuess.. but I'd love this to get checked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement server.requestIp

6 participants