From 2b9e214da60a86f61b07d21116812ce54cfa9db5 Mon Sep 17 00:00:00 2001 From: franknfjr Date: Sun, 19 May 2024 16:34:19 -0300 Subject: [PATCH 1/3] mix format --- lib/plug/static.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/plug/static.ex b/lib/plug/static.ex index 7fc2d495..8ffb7d48 100644 --- a/lib/plug/static.ex +++ b/lib/plug/static.ex @@ -167,7 +167,8 @@ defmodule Plug.Static do %{ encodings: encodings, only_rules: {Keyword.get(opts, :only, []), Keyword.get(opts, :only_matching, [])}, - qs_cache: Keyword.get(opts, :cache_control_for_vsn_requests, "public, max-age=31536000, immutable"), + qs_cache: + Keyword.get(opts, :cache_control_for_vsn_requests, "public, max-age=31536000, immutable"), et_cache: Keyword.get(opts, :cache_control_for_etags, "public"), et_generation: Keyword.get(opts, :etag_generation, nil), headers: Keyword.get(opts, :headers, %{}), From 5fd8ddf1e6df6b0dd6b083a5bacc7b8a1fa9a354 Mon Sep 17 00:00:00 2001 From: franknfjr Date: Sun, 19 May 2024 16:35:41 -0300 Subject: [PATCH 2/3] fix typos --- guides/https.md | 2 +- lib/plug/debugger.ex | 4 ++-- lib/plug/rewrite_on.ex | 8 ++++---- lib/plug/session/cookie.ex | 4 ++-- lib/plug/static.ex | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/guides/https.md b/guides/https.md index 7483adb4..124971a1 100644 --- a/guides/https.md +++ b/guides/https.md @@ -51,7 +51,7 @@ The `cacertfile` option is not needed when using a self-signed certificate, or w keyfile: "/etc/letsencrypt/live/example.net/privkey.pem" ``` -It is possible to bundle the certificate files with the application, possibly for packaging into a release. In this case the files must be stored under the application's 'priv' directory. The `otp_app` option must be set to the name of the OTP application that contains the files, in order to correctly resolve the relative paths: +It is possible to bundle the certificate files with the application, possibly for packaging into a release. In this case the files must be stored under the application's 'priv' directory. The `otp_app` option must be set to the name of the OTP application that contains the files, in order to correctly resolve the relative paths: ```elixir Plug.Cowboy.https MyApp.MyPlug, [], diff --git a/lib/plug/debugger.ex b/lib/plug/debugger.ex index 3b936d07..b3d2a55a 100644 --- a/lib/plug/debugger.ex +++ b/lib/plug/debugger.ex @@ -64,7 +64,7 @@ defmodule Plug.Debugger do ## Custom Banners - You may pass an MFA (`{module, function, args}`) to be invoked when an + You may pass a MFA (`{module, function, args}`) to be invoked when an error is rendered which provides a custom banner at the top of the debugger page. The function receives the following arguments, with the passed `args` concatenated at the end: @@ -496,7 +496,7 @@ defmodule Plug.Debugger do {:ok, other} -> raise ArgumentError, - "expected :banner to be an MFA ({module, func, args}), got: #{inspect(other)}" + "expected :banner to be a MFA ({module, func, args}), got: #{inspect(other)}" :error -> nil diff --git a/lib/plug/rewrite_on.ex b/lib/plug/rewrite_on.ex index e794cb50..07bafcce 100644 --- a/lib/plug/rewrite_on.ex +++ b/lib/plug/rewrite_on.ex @@ -10,10 +10,10 @@ defmodule Plug.RewriteOn do The supported values are: - * `:x_forwarded_for` - to override the remote ip based on on the "x-forwarded-for" header - * `:x_forwarded_host` - to override the host based on on the "x-forwarded-host" header - * `:x_forwarded_port` - to override the port based on on the "x-forwarded-port" header - * `:x_forwarded_proto` - to override the protocol based on on the "x-forwarded-proto" header + * `:x_forwarded_for` - to override the remote ip based on the "x-forwarded-for" header + * `:x_forwarded_host` - to override the host based on the "x-forwarded-host" header + * `:x_forwarded_port` - to override the port based on the "x-forwarded-port" header + * `:x_forwarded_proto` - to override the protocol based on the "x-forwarded-proto" header A tuple representing a Module-Function-Args can also be given as argument instead of a list. diff --git a/lib/plug/session/cookie.ex b/lib/plug/session/cookie.ex index 7b7dcf13..9dd5566a 100644 --- a/lib/plug/session/cookie.ex +++ b/lib/plug/session/cookie.ex @@ -26,11 +26,11 @@ defmodule Plug.Session.COOKIE do * `:encryption_salt` - a salt used with `conn.secret_key_base` to generate a key for encrypting/decrypting a cookie, can be either a binary or - an MFA returning a binary; + a MFA returning a binary; * `:signing_salt` - a salt used with `conn.secret_key_base` to generate a key for signing/verifying a cookie, can be either a binary or - an MFA returning a binary; + a MFA returning a binary; * `:key_iterations` - option passed to `Plug.Crypto.KeyGenerator` when generating the encryption and signing keys. Defaults to 1000; diff --git a/lib/plug/static.ex b/lib/plug/static.ex index 8ffb7d48..8e97785a 100644 --- a/lib/plug/static.ex +++ b/lib/plug/static.ex @@ -12,7 +12,7 @@ defmodule Plug.Static do atom representing the application name (where assets will be served from `priv/static`), a tuple containing the application name and the directory to serve assets from (besides - `priv/static`), or an MFA tuple. + `priv/static`), or a MFA tuple. The preferred form is to use `:from` with an atom or tuple, since it will make your application independent from the starting directory. From f11e531ae11a618c83e4106c8e915f8b8b485ed4 Mon Sep 17 00:00:00 2001 From: franknfjr Date: Mon, 20 May 2024 07:04:36 -0300 Subject: [PATCH 3/3] revert to an MFA --- lib/plug/debugger.ex | 4 ++-- lib/plug/session/cookie.ex | 4 ++-- lib/plug/static.ex | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/plug/debugger.ex b/lib/plug/debugger.ex index b3d2a55a..3b936d07 100644 --- a/lib/plug/debugger.ex +++ b/lib/plug/debugger.ex @@ -64,7 +64,7 @@ defmodule Plug.Debugger do ## Custom Banners - You may pass a MFA (`{module, function, args}`) to be invoked when an + You may pass an MFA (`{module, function, args}`) to be invoked when an error is rendered which provides a custom banner at the top of the debugger page. The function receives the following arguments, with the passed `args` concatenated at the end: @@ -496,7 +496,7 @@ defmodule Plug.Debugger do {:ok, other} -> raise ArgumentError, - "expected :banner to be a MFA ({module, func, args}), got: #{inspect(other)}" + "expected :banner to be an MFA ({module, func, args}), got: #{inspect(other)}" :error -> nil diff --git a/lib/plug/session/cookie.ex b/lib/plug/session/cookie.ex index 9dd5566a..7b7dcf13 100644 --- a/lib/plug/session/cookie.ex +++ b/lib/plug/session/cookie.ex @@ -26,11 +26,11 @@ defmodule Plug.Session.COOKIE do * `:encryption_salt` - a salt used with `conn.secret_key_base` to generate a key for encrypting/decrypting a cookie, can be either a binary or - a MFA returning a binary; + an MFA returning a binary; * `:signing_salt` - a salt used with `conn.secret_key_base` to generate a key for signing/verifying a cookie, can be either a binary or - a MFA returning a binary; + an MFA returning a binary; * `:key_iterations` - option passed to `Plug.Crypto.KeyGenerator` when generating the encryption and signing keys. Defaults to 1000; diff --git a/lib/plug/static.ex b/lib/plug/static.ex index 8e97785a..8ffb7d48 100644 --- a/lib/plug/static.ex +++ b/lib/plug/static.ex @@ -12,7 +12,7 @@ defmodule Plug.Static do atom representing the application name (where assets will be served from `priv/static`), a tuple containing the application name and the directory to serve assets from (besides - `priv/static`), or a MFA tuple. + `priv/static`), or an MFA tuple. The preferred form is to use `:from` with an atom or tuple, since it will make your application independent from the starting directory.