Skip to content

Commit

Permalink
Consider HTTP/1 header read timeouts as connection errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mtrudel committed Jan 30, 2025
1 parent 575c396 commit 8f257f1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion lib/bandit/http1/socket.ex
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ defmodule Bandit.HTTP1.Socket do
defp read_available_for_header!(socket) do
case ThousandIsland.Socket.recv(socket, 0) do
{:ok, chunk} -> chunk
{:error, :timeout} -> request_error!("Header read timeout", :request_timeout)
{:error, reason} -> socket_error!(reason)
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/bandit/http1/plug_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ defmodule HTTP1PlugTest do
plug: {__MODULE__, []},
connection_telemetry_span_context: reference(),
telemetry_span_context: reference(),
error: "Header read timeout"
error: "Unrecoverable error: timeout"
}
)
end
Expand Down

0 comments on commit 8f257f1

Please sign in to comment.