• v2.2.0 5555babe06

    v2.2.0 Stable

    michael released this 2026-10-17 08:22:48 +02:00 | 1 commits to main since this release

    Fixes

    • i18n/en.json and i18n/de.json lacked the schema field that
      daw_i18n/v1 requires in every resource file. Both files now carry
      "schema": "daw_i18n/v1". daw-lua-net itself never read the field, so
      its behaviour is unchanged; consumers that validate the header of a
      resource file (for example when merging the i18n sources of several
      libraries) rejected the files before.

    Internal

    • No code and no API change. The 30 resources and the source_hash
      values in i18n/de.json are unchanged.
    • Tested with daw-lua-common 2.1.1 and 2.2.0: 67 tests, Lua 5.1 and 5.4.

    Requires daw-lua-common >= 2.1.0.

    Downloads
  • v2.1.2 b011425f82

    v2.1.2 Stable

    michael released this 2026-09-21 08:04:15 +02:00 | 5 commits to main since this release

    Fixes

    • The local error helpers (fail_missing() in init.lua, fail() in
      ip_utils.lua and http_client.lua) now fall back to the
      daw-error-facility-unavailable sentinel if daw_error.new()
      returns neither an object nor an error, instead of returning nil.
      Not reachable with the current daw.common.error; this hardens the
      modules against a broken or replaced error facility.
      See DAW/daw-lua-net#14.

    Internal

    • The context of the three sentinel resources in i18n/en.json now
      covers the no-result case (text unchanged); source_hash in
      i18n/de.json recomputed.
    • Test suite: 66 -> 67 tests.

    Requires daw-lua-common >= 2.1.0.

    Downloads
  • v2.1.1 f9c4a98019

    v2.1.1 Stable

    michael released this 2026-09-20 20:11:10 +02:00 | 9 commits to main since this release

    New

    • daw_i18n/v1 language resources: i18n/en.json (canonical) and
      i18n/de.json, 30 resources in total. Every error construction site
      now carries its own resource_id (init.lua 3, ip_utils.lua 15,
      http_client.lua 12). Error codes are unchanged.

    Changed

    • Bootstrap case: if daw.common.error itself is unreachable, all
      modules now return the reserved daw_error/v1 sentinel
      (id = "daw-error-facility-unavailable", with resource_id) instead
      of a plain "[ERROR] ..." string. This removes the one documented
      exception to the error contract.
    • http_client: a connection failure now has the message
      request failed; the raw LuaSocket error text moved to
      err.data.detail. The code (connection_failed) and the method /
      url data fields are unchanged.
    • Stub messages: the facade stub in init.lua now reads
      <name> submodule not available (the load error is in
      err.data.detail); the dependency stub in http_client reads
      http_client unavailable: required dependency <name> is missing and
      carries err.data.dependency.

    Fixes

    • http_client: the dependency stub (missing socket.http, ltn12 or
      daw.common.json) returned the error object as its first value
      instead of nil, err, so a caller checking if not result treated
      the error as a result. It now returns nil, daw_error/v1.
      See DAW/daw-lua-net#12.

    Internal

    • http_client.lua: request() now builds its daw_error/v1 where
      each failure is detected; get / post / put just return
      request(...).
    • Makefile: removed the obsolete install / uninstall targets. The
      module is shipped as a git submodule in lib/daw/net/
      (DAW/daw-lua-net#13).
    • README.md: Contributing section aligned with the GitHub Issues
      policy (DAW/daw-lua-net#11); the error-contract section describes the
      sentinel.
    • Test suite: 64 -> 66 tests.

    Migration

    Only code that inspects error text or the bootstrap string needs
    changes: a check for the old plain "[ERROR] ..." fallback string,
    message:find(...) on the raw LuaSocket text (now
    err.data.detail), or matching the old stub messages. Code that only
    checks if err then or err.code is unaffected.

    Requires daw-lua-common >= 2.1.0. resource_id is set on errors built
    through daw.common.error only with a daw-lua-common release that
    supports opts.resource_id; with 2.1.0 the field is accepted and
    ignored (the sentinel objects carry it directly).

    See DAW/daw-lua-net#10.

    Downloads
  • v2.1.0 69088dc6e9

    v2.1.0 Stable

    michael released this 2026-08-10 13:19:40 +02:00 | 20 commits to main since this release

    Breaking changes

    • All public failures across http_client and ip_utils now return
      nil, <daw_error/v1 object> instead of nil, <string>. The return
      contract itself (result, nil | nil, err) is unchanged -- only what
      err is. See MIGRATION-DAW-LUA-NET-2.1.md for the full code table
      and cause-chain examples.
    • init.lua's facade stub (missing submodule case) likewise now
      returns nil, daw_error/v1 instead of a string.

    Fixes

    • Module registration (_G.daw_register guard) corrected from
      type(_G.daw_register) == "function" to the simple truthy check
      if _G.daw_register then ..., matching the lived pattern already
      used across daw-lua-common (accepted decision, see
      DAW/daw-docs#18).
    • ip_utils.ip_matches_cidr(): the exact-match path (no / in
      cidr) previously skipped IPv4 validation entirely and crashed with
      a raw Lua error on a non-string cidr (e.g. nil). Both ip and
      cidr are now validated the same way regardless of which path is
      taken.
    • ip_utils.is_ip_allowed() / get_client_ip(): a non-table
      allowed_ips/trusted_proxies (e.g. a bare string) previously
      reached #/ipairs() directly and could crash or silently
      misbehave. Both now return nil, daw_error/v1 for a non-table,
      non-nil value.
    • http_client: opts.headers was previously used directly without a
      type check; a non-table value (e.g. a string) could crash inside
      pairs()/header lookup. Now validated up front in both request()
      and get_raw().
    • http_client.post/put: a json.encode() failure was previously
      flattened into plain text ("encode failed: " .. tostring(err)),
      discarding the structured daw_error/v1 from json.encode(). It is
      now preserved as cause on the resulting encode_failed error,
      consistent with how ip_utils already chains errors.

    Internal

    • http_client.lua: internal request() helper now returns a
      machine-readable reason keyword alongside its plain-text error, so
      the public get/post/put functions can build precise
      daw_error/v1 codes (invalid_opts, encode_failed,
      connection_failed) without parsing error text.
    • ip_utils.lua: nine distinct error codes across
      ip_matches_cidr/is_ip_allowed/get_client_ip; public-to-public
      error propagation now uses cause embedding instead of string
      concatenation.
    • init.lua: facade rebuilt around the daw_error/v1-aware
      fail()/module_stub() pattern shared with daw.common/init.lua.
    • test/dev-module-map.lua: added daw.common.error,
      daw.common.error.util, daw.common.uuid -- required by the new
      error contract, previously missing from this repo's dev module map.
    • New test/test_init.lua covering the root facade (submodule
      aggregation, object identity, stub fallback on a missing submodule),
      mirroring daw-lua-common's test_init.lua.
    • Test suite: 42 -> 64 tests.

    Migration

    Only code that inspects error text (string matching/parsing on
    err) needs changes -- code that only checks if err then is
    unaffected. MIGRATION-DAW-LUA-NET-2.1.md walks through the full
    error-code reference and cause-chain examples.

    Requires daw-lua-common >= 2.1.0 (for daw.common.error).

    Downloads
  • v2.0.0 d3b330047d

    v2.0.0 Stable

    michael released this 2026-07-25 20:24:51 +02:00 | 25 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