Found while running a signed /v1/image/ request against next (0de6972).
Steps
Sign a /v1/image/ URL for cdn.example.com/photos/cat.jpg (see README Signed URLs) and request it. cdn.example.com has no DNS address.
What happened
pixa answers 500 {"error":"internal error"}. It logs failed to get image at error level, with upstream fetch failed: invalid or unresolvable host: cdn.example.com.
respondImageError in internal/handlers/image.go has no case for httpfetcher.ErrInvalidHost, so the error takes its default case. Its doc says a 500 is pixa's own failure, and that failures the client or the upstream caused are logged at warn level.
Unverified, from reading the code: every other failure of client.Do in internal/httpfetcher/httpfetcher.go that is not a timeout reaches the same default case, for example a refused connection or a failed TLS handshake.
What should happen
A host with no address answers 502 upstream error and is logged at warn level, like an upstream error status. So does any other failed fetch that is not a timeout.
README Routes lists these under 502.
Model: opus-5-5
Found while running a signed `/v1/image/` request against `next` (`0de6972`).
## Steps
Sign a `/v1/image/` URL for `cdn.example.com/photos/cat.jpg` (see README Signed URLs) and request it. `cdn.example.com` has no DNS address.
## What happened
pixa answers 500 `{"error":"internal error"}`. It logs `failed to get image` at error level, with `upstream fetch failed: invalid or unresolvable host: cdn.example.com`.
`respondImageError` in `internal/handlers/image.go` has no case for `httpfetcher.ErrInvalidHost`, so the error takes its default case. Its doc says a 500 is pixa's own failure, and that failures the client or the upstream caused are logged at warn level.
Unverified, from reading the code: every other failure of `client.Do` in `internal/httpfetcher/httpfetcher.go` that is not a timeout reaches the same default case, for example a refused connection or a failed TLS handshake.
## What should happen
- A host with no address answers 502 `upstream error` and is logged at warn level, like an upstream error status. So does any other failed fetch that is not a timeout.
- README Routes lists these under 502.
Model: opus-5-5
A host with no address, and any failed fetch that is neither a timeout nor a cancellation, now answers 502 upstream error, logged at warn level. README Routes lists both under 502.
Model: opus-5-5
PR: https://git.eeqj.de/sneak/pixa/pulls/368, branch `issue-367-unreachable-upstream-502`.
A host with no address, and any failed fetch that is neither a timeout nor a cancellation, now answers 502 `upstream error`, logged at warn level. README Routes lists both under 502.
Model: opus-5-5
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Found while running a signed
/v1/image/request againstnext(0de6972).Steps
Sign a
/v1/image/URL forcdn.example.com/photos/cat.jpg(see README Signed URLs) and request it.cdn.example.comhas no DNS address.What happened
pixa answers 500
{"error":"internal error"}. It logsfailed to get imageat error level, withupstream fetch failed: invalid or unresolvable host: cdn.example.com.respondImageErrorininternal/handlers/image.gohas no case forhttpfetcher.ErrInvalidHost, so the error takes its default case. Its doc says a 500 is pixa's own failure, and that failures the client or the upstream caused are logged at warn level.Unverified, from reading the code: every other failure of
client.Doininternal/httpfetcher/httpfetcher.gothat is not a timeout reaches the same default case, for example a refused connection or a failed TLS handshake.What should happen
upstream errorand is logged at warn level, like an upstream error status. So does any other failed fetch that is not a timeout.Model: opus-5-5
PR: #368, branch
issue-367-unreachable-upstream-502.A host with no address, and any failed fetch that is neither a timeout nor a cancellation, now answers 502
upstream error, logged at warn level. README Routes lists both under 502.Model: opus-5-5