Skip to content

Commit

Permalink
Fix http_client input connect bug
Browse files Browse the repository at this point in the history
`h.codecCtor.Create` will return a `*service.OwnedScanner`, but
`h.codec` has type `codec.DeprecatedFallbackStream`, so if we get
an error from `h.codecCtor.Create`, the `h.codec != nil` check in
`Connect` will be true, so Benthos will think the input is
connected. This can happen if the codec specification isn't
compatible with the received data.

Signed-off-by: Mihai Todor <[email protected]>
  • Loading branch information
mihaitodor committed Mar 2, 2025
1 parent 4d6fce6 commit 60d5253
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions internal/impl/io/input_http_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ func (h *httpClientInput) Connect(ctx context.Context) (err error) {
return nil
}, service.NewScannerSourceDetails()); err != nil {
res.Body.Close()
h.codec = nil
return err
}
return nil
Expand Down

0 comments on commit 60d5253

Please sign in to comment.