From: tenzap <fabstz-it@yahoo.fr>
Date: Sun, 12 Oct 2025 12:57:52 +0200
Subject: [PATCH] Add support for setting path to vnu in the HttpClient

Forwarded: https://github.com/validator/validator/pull/1885
---
 README.md                               | 10 +++++++++-
 index.html                              | 11 ++++++++++-
 src/nu/validator/client/HttpClient.java |  7 +++++--
 3 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index a1be1e0..f264346 100644
--- a/README.md
+++ b/README.md
@@ -542,12 +542,20 @@ checker service, as documented at
 
 #### nu.validator.client.port
 
-    Specifies the hostname of the checker for the client to connect to.
+    Specifies the port of the checker for the client to connect to.
 
     default: "8888"
 
     example: java -Dnu.validator.client.port=8080 -jar ~/vnu.jar FILE.html
 
+#### nu.validator.client.path
+
+    Specifies the path of the checker for the client to connect to.
+
+    default: "/"
+
+    example: java -Dnu.validator.client.path=/vnu -jar ~/vnu.jar FILE.html
+
 #### nu.validator.client.level
 
     Specifies the severity level of messages to report; to suppress
diff --git a/index.html b/index.html
index 0e031dc..bb51af5 100644
--- a/index.html
+++ b/index.html
@@ -672,13 +672,22 @@ default: <span class=option-value>"127.0.0.1"</span>
 
 <h4 id="nuvalidatorclientport">nu.validator.client.port</h4>
 <pre>
-Specifies the hostname of the checker for the client to connect to.
+Specifies the port of the checker for the client to connect to.
 
 default: <span class=option-value>"8888"</span>
 
 example: java -Dnu.validator.client.port=8080 -jar ~/vnu.jar FILE.html
 </pre>
 
+<h4 id="nuvalidatorclientpath">nu.validator.client.path</h4>
+<pre>
+Specifies the path of the checker for the client to connect to.
+
+default: <span class=option-value>"/"</span>
+
+example: java -Dnu.validator.client.path=/vnu -jar ~/vnu.jar FILE.html
+</pre>
+
 <h4 id="nuvalidatorclientlevel">nu.validator.client.level</h4>
 <pre>
 Specifies the severity level of messages to report; to
diff --git a/src/nu/validator/client/HttpClient.java b/src/nu/validator/client/HttpClient.java
index f1f8e80..125eefd 100644
--- a/src/nu/validator/client/HttpClient.java
+++ b/src/nu/validator/client/HttpClient.java
@@ -42,14 +42,17 @@ public class HttpClient {
         String host = System.getProperty("nu.validator.client.host",
                 "127.0.0.1");
         String port = System.getProperty("nu.validator.client.port", "8888");
-        String origin = "http://" + host + ":" + port;
+        String path = System.getProperty("nu.validator.client.path", "/");
+        if (!path.endsWith("/"))
+            path += "/";
+        String origin = "http://" + host + ":" + port + path;
         String level = System.getProperty("nu.validator.client.level", null);
         String parser = System.getProperty("nu.validator.client.parser", null);
         String charset = System.getProperty("nu.validator.client.charset", null);
         String contentType = System.getProperty(
                 "nu.validator.client.content-type", null);
         boolean hasErrors = false;
-        String url = origin + "/?laxtype="
+        String url = origin + "?laxtype="
                 + System.getProperty("nu.validator.client.laxtype", "yes");
         url += "&out="
                 + System.getProperty("nu.validator.client.out", "gnu");
