Is it possible to get the remote IP in crow::request?
As far as I could tell the information is available in the Adaptors (SocketAdaptor and SSLAdaptor) but it gets lost. Is it possible to somehow make it available?
Thank you.
the same question
the same question
Maybe try to add std::string field in crow::request (e.g. std::string ipAddress) and then set it in http_connection.h:259 with something like:
req.ipAddress = adaptor_.socket_.remote_endpoint().address().to_string();
Didn't test it, just looked into code.
Hi @mrozigor
req.ipAddress = adaptor_.socket_.remote_endpoint().address().to_string();
I tested it and it works except for a typo (I think). This line worked for me (only remove socket_).
req.ipAddress = adaptor_.remote_endpoint().address().to_string();
Do you have any interest to open a pull request for this?
Yeah, I want to make some improvements when I'll have some time ;) Try to make PR by the end of this week.
Added in #322. Changes are on my fork, on master branch.