Skip to content

--max-time accepts 0 and negative values without validation #31

Description

@korya

Problem

--max-time is converted straight to a duration and handed to http.Client.Timeout, where any value <= 0 means no timeout at all.

Reproduction

$ http-assert -m 0 --assert-ok http://127.0.0.1:8791/ok
[+] PASSED       ← no timeout applied

$ http-assert -m -5 --assert-ok http://127.0.0.1:8791/ok
[+] PASSED       ← no timeout applied

Why it matters

A user typing -m 0 most likely means "fail immediately", and a script computing a deadline that goes negative silently gets an unbounded request — the opposite of the intent, and a hang in CI.

Suggested fix

Reject negative values as an invalid argument. Either reject 0 too, or document explicitly that 0 disables the timeout (curl's convention).

No activity

Activity on this issue will appear here.

Activity

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

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions