From c0d9a7ada5293eeb5878dd9abd4e43b2ce93fe21 Mon Sep 17 00:00:00 2001 From: Daniel McCoy Stephenson Date: Thu, 22 Oct 2026 05:25:32 -0600 Subject: [PATCH 1/2] Say that redirects are not followed and baseUrl must be the final URL Co-Authored-By: Claude Opus 5.5 --- README.md | 7 +++++++ src/main/java/software/stephenson/trace/TraceClient.java | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bd5f48e..8bac66d 100644 --- a/README.md +++ b/README.md @@ -232,6 +232,13 @@ is JSON); `tags` always holds at least `version`, and `install` whenever the client has an [installation ID](#every-event-carries-a-random-server-id). The server assigns the timestamp. A `201` is success; anything else is logged at `FINE` and dropped. +Redirects are not followed. The body is streamed with a fixed length, so +`HttpURLConnection` cannot re-send it to a redirect target: a redirect is +logged at `FINE` and the report is dropped, like any other answer that is +not `201`. Give +`baseUrl` as the final URL — `https://` if the server redirects `http://` +there — or nothing reaches the server. + ## Keys A key identifies the program to the server and lets the operator revoke it; diff --git a/src/main/java/software/stephenson/trace/TraceClient.java b/src/main/java/software/stephenson/trace/TraceClient.java index c83a2b9..6a56831 100644 --- a/src/main/java/software/stephenson/trace/TraceClient.java +++ b/src/main/java/software/stephenson/trace/TraceClient.java @@ -243,7 +243,10 @@ private TraceClient(Builder builder) { * at {@code version}, reporting to the trace server at {@code baseUrl}. * The version is sent as the tag {@code version} on every event; a blank * one, or one longer than {@value #MAX_TAG_LENGTH} characters, is an - * {@link IllegalArgumentException}. + * {@link IllegalArgumentException}. Redirects are not followed, so + * {@code baseUrl} must be the final URL (e.g. {@code https://} when the + * server redirects {@code http://} there); otherwise every report is + * dropped and logged at {@code FINE}. */ public static Builder builder(String baseUrl, String application, String version) { return new Builder(baseUrl, application, version); From 5178bd240cc19d3f1528b8c24a29cb57416bed13 Mon Sep 17 00:00:00 2001 From: Daniel McCoy Stephenson Date: Thu, 22 Oct 2026 05:26:35 -0600 Subject: [PATCH 2/2] Reflow the redirect paragraph in the README Co-Authored-By: Claude Opus 5.5 --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8bac66d..5a12971 100644 --- a/README.md +++ b/README.md @@ -235,9 +235,8 @@ timestamp. A `201` is success; anything else is logged at `FINE` and dropped. Redirects are not followed. The body is streamed with a fixed length, so `HttpURLConnection` cannot re-send it to a redirect target: a redirect is logged at `FINE` and the report is dropped, like any other answer that is -not `201`. Give -`baseUrl` as the final URL — `https://` if the server redirects `http://` -there — or nothing reaches the server. +not `201`. Give `baseUrl` as the final URL — `https://` if the server +redirects `http://` there — or nothing reaches the server. ## Keys