fix: http_client -- unprotected require, json.decode can throw #2

Closed
opened 2026-05-25 19:57:47 +02:00 by michael · 1 comment
Owner

Problems

  1. require("socket.http") and require("ltn12") are unprotected (no pcall).

  2. json.decode can throw error() -- comment "returns nil on non-JSON"
    is wrong. Caller is not protected. See DAW/daw-lua-common#25.

  3. Header path outdated: src/daw/lua/common/http_client.lua
    Refs point to daw-lua-common instead of daw-lua-net.

## Problems 1. require("socket.http") and require("ltn12") are unprotected (no pcall). 2. json.decode can throw error() -- comment "returns nil on non-JSON" is wrong. Caller is not protected. See DAW/daw-lua-common#25. 3. Header path outdated: src/daw/lua/common/http_client.lua Refs point to daw-lua-common instead of daw-lua-net.
Author
Owner

Fixed as part of the daw-lua-common 2.0.0 migration (DAW/daw-lua-net#6, released as v2.0.0):

  • socket.http/ltn12 require() now wrapped in pcall
  • json.decode/encode no longer relied upon to throw (aligned with the 2.0.0 contract)
  • header path comment corrected

Refs: DAW/daw-lua-net#6

Fixed as part of the daw-lua-common 2.0.0 migration (DAW/daw-lua-net#6, released as v2.0.0): - socket.http/ltn12 require() now wrapped in pcall - json.decode/encode no longer relied upon to throw (aligned with the 2.0.0 contract) - header path comment corrected Refs: DAW/daw-lua-net#6
michael 2026-07-25 20:30:54 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
DAW/daw-lua-net#2
No description provided.