Skip to content

A base URL that redirects drops every report; the README does not say redirects are not followed #25

Closed

Description

@dmccoystephenson

A base URL that answers with a redirect loses every report, and the README does not say so.

Where: send() in src/main/java/software/stephenson/trace/TraceClient.java calls setFixedLengthStreamingMode(...) before writing the body. In streaming mode, HttpURLConnection cannot replay a POST to a redirect target. On a 301, getResponseCode() throws java.net.HttpRetryException: cannot retry due to redirection, in streaming mode. This is caught, so the report is dropped and a FINE [trace] could not deliver ... line is logged. The redirect target is never requested. report_aRedirectIsNotFollowedAndIsLoggedFine in PR #24 pins this on Java 8, 17 and 21.

Why it matters: a trace server that redirects http:// to https:// is a common setup. A program configured with the http:// URL sends nothing, and host loggers normally filter out FINE, so the failure is silent. The README "The wire format" section says only "A 201 is success; anything else is logged at FINE and dropped". That is literally true, but it does not tell an integrator that the base URL must be the final URL, with no redirects.

Options:

  • Documentation only: add a sentence to "The wire format" saying that redirects are not followed and that baseUrl must be the final https:// URL. This needs no contract change.
  • Behaviour change (maintainer decision, because it touches send()): follow 307/308, which keep the method and body, by re-posting to Location once. This would mean giving up fixed-length streaming or re-sending manually.

This issue was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).


drafted by Claude on behalf of Daniel Stephenson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions