From 526f150482a0c207bea8675e2bf0204bab8c10e8 Mon Sep 17 00:00:00 2001 From: andrewlalis Date: Thu, 25 Jan 2024 20:31:01 -0500 Subject: [PATCH] Upgraded to handy-httpd v8.1.0 --- dub.json | 2 +- dub.selections.json | 7 ++++--- source/app.d | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/dub.json b/dub.json index 6a571f6..28b303e 100644 --- a/dub.json +++ b/dub.json @@ -6,7 +6,7 @@ "dependencies": { "d-properties": "~>1.0.4", "d2sqlite3": "~>1.0.0", - "handy-httpd": "~>7.7.0" + "handy-httpd": "~>8.1.0" }, "subConfigurations": { "d2sqlite3": "all-included" diff --git a/dub.selections.json b/dub.selections.json index 9a262c4..3222022 100644 --- a/dub.selections.json +++ b/dub.selections.json @@ -1,11 +1,12 @@ { "fileVersion": 1, "versions": { - "d-properties": "1.0.4", + "d-properties": "1.0.5", "d2sqlite3": "1.0.0", - "handy-httpd": "7.7.0", + "handy-httpd": "8.1.0", "httparsed": "1.2.1", - "slf4d": "2.4.2", + "path-matcher": "1.1.3", + "slf4d": "2.4.3", "streams": "3.5.0" } } diff --git a/source/app.d b/source/app.d index 9bacdb8..6217c8c 100644 --- a/source/app.d +++ b/source/app.d @@ -1,5 +1,5 @@ import handy_httpd; -import handy_httpd.handlers.path_delegating_handler; +import handy_httpd.handlers.path_handler; import slf4d; import d_properties; import d2sqlite3; @@ -54,12 +54,12 @@ void handleVisitorLog(ref HttpRequestContext ctx) { ctx.response.writeBodyString("Message is too long."); return; } - if (!ctx.request.hasHeader("X-Forwarded-For")) { + if (!ctx.request.headers.contains("X-Forwarded-For")) { ctx.response.setStatus(HttpStatus.FORBIDDEN); ctx.response.writeBodyString("Missing remote IP"); return; } - string remoteAddress = ctx.request.getHeader("X-Forwarded-For"); + string remoteAddress = ctx.request.headers.getFirst("X-Forwarded-For").orElseThrow(); // If the user has sent another log within the last minute, block this one. LogEntry[] recentLogsByThisAddress = getRecentLogEntriesByRemoteAddress(remoteAddress);