diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5a7e6156..f55543a7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,9 +22,9 @@ jobs: # One version down. - erlang: "27.2" elixir: "1.18" - # Oldest version. We technically support OTP 23 but hard to test in CI + # Oldest version. - erlang: "24.3" - elixir: "1.15" + elixir: "1.12.3" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/lib/mint/application.ex b/lib/mint/application.ex deleted file mode 100644 index 058d4a83..00000000 --- a/lib/mint/application.ex +++ /dev/null @@ -1,14 +0,0 @@ -defmodule Mint.Application do - @moduledoc false - use Application - - def start(_type, _args) do - persistent_term = - Code.ensure_loaded?(:persistent_term) and function_exported?(:persistent_term, :get, 2) - - Application.put_env(:mint, :persistent_term, persistent_term) - - opts = [strategy: :one_for_one, name: Mint.Supervisor] - Supervisor.start_link([], opts) - end -end diff --git a/lib/mint/core/transport/ssl.ex b/lib/mint/core/transport/ssl.ex index 8631bd75..d4cbf1b1 100644 --- a/lib/mint/core/transport/ssl.ex +++ b/lib/mint/core/transport/ssl.ex @@ -601,18 +601,14 @@ defmodule Mint.Core.Transport.SSL do end defp get_cacertfile(path) do - if Application.get_env(:mint, :persistent_term) do - case :persistent_term.get({:mint, {:cacertfile, path}}, :error) do - {:ok, cacerts} -> - cacerts - - :error -> - cacerts = decode_cacertfile(path) - :persistent_term.put({:mint, {:cacertfile, path}}, {:ok, cacerts}) - cacerts - end - else - decode_cacertfile(path) + case :persistent_term.get({:mint, {:cacertfile, path}}, :error) do + {:ok, cacerts} -> + cacerts + + :error -> + cacerts = decode_cacertfile(path) + :persistent_term.put({:mint, {:cacertfile, path}}, {:ok, cacerts}) + cacerts end end diff --git a/lib/mint/http1.ex b/lib/mint/http1.ex index be31db7c..5445ab60 100644 --- a/lib/mint/http1.ex +++ b/lib/mint/http1.ex @@ -762,7 +762,7 @@ defmodule Mint.HTTP1 do {:ok, conn, responses} length <= byte_size(data) -> - <> = data + {body, rest} = :erlang.split_binary(data, length) {conn, responses} = add_body(conn, body, responses) conn = request_done(conn) responses = [{:done, request_ref} | responses] @@ -836,7 +836,7 @@ defmodule Mint.HTTP1 do {:ok, conn, responses} length <= byte_size(data) -> - <> = data + {body, rest} = :erlang.split_binary(data, length) {conn, responses} = add_body(conn, body, responses) conn = put_in(conn.request.body, {:chunked, :crlf}) decode_body({:chunked, :crlf}, conn, rest, request_ref, responses) diff --git a/lib/mint/http2.ex b/lib/mint/http2.ex index dad9e506..d1b562d0 100644 --- a/lib/mint/http2.ex +++ b/lib/mint/http2.ex @@ -1266,7 +1266,7 @@ defmodule Mint.HTTP2 do end defp split_payload_in_chunks(binary, chunk_size, acc) do - <> = binary + {chunk, rest} = :erlang.split_binary(binary, chunk_size) split_payload_in_chunks(rest, chunk_size, [chunk | acc]) end diff --git a/lib/mint/http2/frame.ex b/lib/mint/http2/frame.ex index 7312ee49..1b110580 100644 --- a/lib/mint/http2/frame.ex +++ b/lib/mint/http2/frame.ex @@ -271,7 +271,7 @@ defmodule Mint.HTTP2.Frame do else # 1 byte is for the space taken by pad_length data_length = byte_size(payload) - pad_length - 1 - <> = rest + {data, padding} = :erlang.split_binary(rest, data_length) {data, padding} end end diff --git a/mix.exs b/mix.exs index fce72a66..df67b1e1 100644 --- a/mix.exs +++ b/mix.exs @@ -8,7 +8,7 @@ defmodule Mint.MixProject do [ app: :mint, version: @version, - elixir: "~> 1.15", + elixir: "~> 1.12", start_permanent: Mix.env() == :prod, elixirc_paths: elixirc_paths(Mix.env()), deps: deps(), @@ -16,7 +16,6 @@ defmodule Mint.MixProject do # Xref xref: [ exclude: [ - :persistent_term, {:ssl, :cipher_suites, 1}, {:public_key, :cacerts_get, 0}, CAStore @@ -54,8 +53,7 @@ defmodule Mint.MixProject do # Run "mix help compile.app" to learn about applications. def application do [ - extra_applications: [:logger, :ssl], - mod: {Mint.Application, []} + extra_applications: [:logger, :ssl] ] end diff --git a/test/mint/http1/conn_properties_test.exs b/test/mint/http1/conn_properties_test.exs index 906c0038..2e1d7f27 100644 --- a/test/mint/http1/conn_properties_test.exs +++ b/test/mint/http1/conn_properties_test.exs @@ -90,7 +90,7 @@ defmodule Mint.HTTP1.PropertiesTest do |> Enum.sort() |> Enum.reduce({[], binary, 0}, fn split, {chunks, rest, prev_split} -> length = split - prev_split - <> = rest + {chunk, rest} = :erlang.split_binary(rest, length) {[chunk | chunks], rest, split} end) |> join_last_chunk()