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

Regarding experimental function "sg_httpreq_ip()" #26

Closed
silvioprog opened this issue Apr 10, 2019 · 1 comment
Closed

Regarding experimental function "sg_httpreq_ip()" #26

silvioprog opened this issue Apr 10, 2019 · 1 comment

Comments

@silvioprog
Copy link
Member

Hello.

The experimental function sg_httpreq_ip() should be renamed to sg_ntop() (or, in a more legacy way, sg_ntoa()) and become part of sg_utils, and the request should provide some function like sg_httpreq_client() or sg_httpres_socket() returning the client socket. For example:

char ip[46];
struct sockaddr_in *client = sg_httpreq_client(req); // or sockaddr_in6
sg_ntop(&client->sin_addr, ip, sizeof(ip));
printf("Client IP '%s' and port '%d'\n", ip, client->sin_port);

cheers

silvioprog added a commit that referenced this issue Apr 11, 2019
…t()" in order to return only the client address information. (#26)
silvioprog added a commit that referenced this issue Apr 11, 2019
…t()" in order to return the client address information. (#26)
@silvioprog
Copy link
Member Author

Solved by (caf5336).

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

No branches or pull requests

1 participant