summaryrefslogtreecommitdiffstats
path: root/examples/httpserver
diff options
context:
space:
mode:
authorTasuku Suzuki <tasuku.suzuki@qbc.io>2019-06-14 14:43:06 +0900
committerTasuku Suzuki <tasuku.suzuki@qbc.io>2019-07-10 16:20:50 +0900
commitb025906bf73a2a571fe4c6ad8aea6331d4cc59b7 (patch)
tree48a25d8edf1482b4f90f1fb59c0cdf4bfb3cc332 /examples/httpserver
parentfb551f9845126ba991ecc13455fcc67bc42c0fe1 (diff)
Add remoteAddress() to QHttpServerRequest
Change-Id: If72ff6f96a645e86f718d61e57e1f8549f8806da Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'examples/httpserver')
-rw-r--r--examples/httpserver/simple/main.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/examples/httpserver/simple/main.cpp b/examples/httpserver/simple/main.cpp
index b76f944..0bf21e2 100644
--- a/examples/httpserver/simple/main.cpp
+++ b/examples/httpserver/simple/main.cpp
@@ -108,6 +108,10 @@ int main(int argc, char *argv[])
return QHttpServerResponse::fromFile(QStringLiteral(":/assets/%1").arg(url.path()));
});
+ httpServer.route("/remote_address", [](const QHttpServerRequest &request) {
+ return request.remoteAddress().toString();
+ });
+
const auto port = httpServer.listen(QHostAddress::Any);
if (port == -1) {
qDebug() << QCoreApplication::translate(