Skip to content

Commit bf98749

Browse files
committed
Blindly pass Plug.Conn.Adapter opts through
1 parent ec4e66e commit bf98749

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

lib/bandit/http2/adapter.ex

+1-3
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,12 @@ defmodule Bandit.HTTP2.Adapter do
4747
@impl Plug.Conn.Adapter
4848
def read_req_body(%__MODULE__{} = adapter, opts) do
4949
validate_calling_process!(adapter)
50-
length = Keyword.get(opts, :length, 8_000_000)
51-
timeout = Keyword.get(opts, :read_timeout, 15_000)
5250

5351
metrics =
5452
adapter.metrics
5553
|> Map.put_new_lazy(:req_body_start_time, &Bandit.Telemetry.monotonic_time/0)
5654

57-
case Bandit.HTTP2.Stream.read_data(adapter.stream, length, timeout) do
55+
case Bandit.HTTP2.Stream.read_data(adapter.stream, opts) do
5856
{:ok, body, stream} ->
5957
body = IO.iodata_to_binary(body)
6058

lib/bandit/http2/stream.ex

+5-1
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,11 @@ defmodule Bandit.HTTP2.Stream do
242242
[{"cookie", combined_cookie} | other_headers]
243243
end
244244

245-
def read_data(stream, max_bytes, timeout), do: do_read_data(stream, max_bytes, timeout, [])
245+
def read_data(stream, opts) do
246+
max_bytes = Keyword.get(opts, :length, 8_000_000)
247+
timeout = Keyword.get(opts, :read_timeout, 15_000)
248+
do_read_data(stream, max_bytes, timeout, [])
249+
end
246250

247251
defp do_read_data(%__MODULE__{state: state} = stream, max_bytes, timeout, acc)
248252
when state in [:open, :local_closed] do

lib/bandit/http2/stream_process.ex

-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ defmodule Bandit.HTTP2.StreamProcess do
99

1010
use GenServer, restart: :temporary
1111

12-
# A stream process can be created only once we have an adapter & set of headers. Pass them in
13-
# at creation time to ensure this invariant
1412
@spec start_link(
1513
Bandit.HTTP2.Stream.t(),
1614
Bandit.Pipeline.plug_def(),

0 commit comments

Comments
 (0)