• v2.0.0 d3b330047d

    v2.0.0 Stable

    michael released this 2026-07-25 20:24:51 +02:00 | 1 commits to main since this release

    Breaking changes

    • http.get/post/put(url, [body], opts) -- headers parameter replaced by
      an opts table: { timeout = <seconds>, headers = <table, optional> }.
      timeout is required, no default.
    • http.get/post/put/get_raw now return { body, status, headers }, nil
      on success or nil, err on failure, replacing the previous
      body, status, err positional return.
    • ip_utils.ip_matches_cidr and ip_utils.is_ip_allowed now return
      nil, err for malformed CIDRs, out-of-range masks, or non-IPv4 input,
      instead of treating them as an ordinary false. is_ip_allowed fails
      closed on the first malformed entry in allowed_ips.
    • ip_utils.get_client_ip(request, trusted_proxies) -- new required
      request.remote_addr field (the real TCP peer address). Forwarding
      headers (x-forwarded-for, x-real-ip) are only honored when
      trusted_proxies is given and remote_addr matches it; the previous
      hardcoded 127.0.0.1 fallback is gone. IPv4 only.

    Fixes

    • json.decode/json.encode are no longer relied upon to throw --
      aligned with the daw-lua-common 2.0.0 contract.
    • socket.http/ltn12 requires are now wrapped in pcall.
    • Case-insensitive header handling in http_client (no more duplicate
      Content-Type/Content-Length when the caller already supplied a
      differently-cased variant).

    Internal

    • init.lua rebuilt around the module_stub()/load_submodule()
      facade pattern shared with daw.common/init.lua.
    • All public functions consistently return result, nil | nil, err,
      including true, nil / false, nil for predicate functions.
    • Test suite: 20 -> 42 tests.

    Migration

    Callers of http_client and ip_utils need code changes -- see
    DAW/steurjan#144 for a worked example. A dedicated migration guide is
    planned; until then, DAW/daw-lua-net#6 documents the full change set.

    Requires daw-lua-common >= 2.0.0.

    Downloads