Skip to content

Error handling a request with multiple Surrogate-Capability headers #202

Description

@asharpe-squiz

The error manifests as

state_machine.lua:44: state 'fetching' failed to call action 'fetch': ledge/lib/ledge/handler.lua:448: attempt to concatenate local 'sc' (a table value), client: ...

and this might be a reasonable workaround...

diff --git lib/ledge/handler.lua lib/ledge/handler.lua
index f65fd7c5..9817666e 100644
--- lib/ledge/handler.lua
+++ lib/ledge/handler.lua
@@ -445,6 +445,7 @@ local function fetch_from_origin(self)
         if not sc then
             headers["Surrogate-Capability"] = capability_entry
         else
+            if type(sc) == "table" then sc = tbl_concat(sc, ", ") end
             headers["Surrogate-Capability"] = sc .. ", " .. capability_entry
         end
     end

Alternatively we could turn a string into a table and append

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions