Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
14 changes: 0 additions & 14 deletions lib/mint/application.ex

This file was deleted.

20 changes: 8 additions & 12 deletions lib/mint/core/transport/ssl.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions lib/mint/http1.ex
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ defmodule Mint.HTTP1 do
{:ok, conn, responses}

length <= byte_size(data) ->
<<body::binary-size(^length), rest::binary>> = data
{body, rest} = :erlang.split_binary(data, length)
{conn, responses} = add_body(conn, body, responses)
conn = request_done(conn)
responses = [{:done, request_ref} | responses]
Expand Down Expand Up @@ -836,7 +836,7 @@ defmodule Mint.HTTP1 do
{:ok, conn, responses}

length <= byte_size(data) ->
<<body::binary-size(^length), rest::binary>> = 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)
Expand Down
2 changes: 1 addition & 1 deletion lib/mint/http2.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1266,7 +1266,7 @@ defmodule Mint.HTTP2 do
end

defp split_payload_in_chunks(binary, chunk_size, acc) do
<<chunk::size(^chunk_size)-binary, rest::binary>> = binary
{chunk, rest} = :erlang.split_binary(binary, chunk_size)
split_payload_in_chunks(rest, chunk_size, [chunk | acc])
end

Expand Down
2 changes: 1 addition & 1 deletion lib/mint/http2/frame.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
<<data::size(^data_length)-binary, padding::size(^pad_length)-binary>> = rest
{data, padding} = :erlang.split_binary(rest, data_length)
{data, padding}
end
end
Expand Down
6 changes: 2 additions & 4 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ 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(),

# Xref
xref: [
exclude: [
:persistent_term,
{:ssl, :cipher_suites, 1},
{:public_key, :cacerts_get, 0},
CAStore
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion test/mint/http1/conn_properties_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
<<chunk::binary-size(^length), rest::binary>> = rest
{chunk, rest} = :erlang.split_binary(rest, length)
{[chunk | chunks], rest, split}
end)
|> join_last_chunk()
Expand Down
Loading