Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
asharpe-squiz opened this issue Aug 9, 2024 · 0 comments
Open

Comments

@asharpe-squiz
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant