Support LOCAL_ADDR and LOCAL_PORT header in client Request (#1450)

Having the local address/port is useful if the server is bound to
all interfaces, e.g. to serve different content for developers
on localhost only.
This commit is contained in:
Ingo Bauersachs 2022-12-06 14:23:09 +01:00 committed by GitHub
parent c8c1c3d376
commit 8f32271e8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 63 additions and 8 deletions

View file

@ -22,8 +22,6 @@ public:
ssize_t write(const std::string &s) { return write(s.data(), s.size()); }
std::string get_remote_addr() const { return ""; }
bool is_readable() const override { return true; }
bool is_writable() const override { return true; }
@ -33,6 +31,11 @@ public:
port = 8080;
}
void get_local_ip_and_port(std::string &ip, int &port) const override {
ip = "127.0.0.1";
port = 8080;
}
socket_t socket() const override { return 0; }
private: