Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compression middleware doesn't update content-* headers after decompression #598

Closed
tanguilp opened this issue Jun 19, 2023 · 0 comments · Fixed by #606
Closed

Compression middleware doesn't update content-* headers after decompression #598

tanguilp opened this issue Jun 19, 2023 · 0 comments · Fixed by #606

Comments

@tanguilp
Copy link
Contributor

tanguilp commented Jun 19, 2023

When decompressing, content-encoding and content-length are left unchanged:

iex> response = Tesla.client([Tesla.Middleware.Compression]) |> Tesla.get!("http://perdu.com")
iex> response.headers |> List.keyfind("content-encoding", 0)
{"content-encoding", "gzip"}
iex> response.body
"<html><head><title>Vous Etes Perdu ?</title></head><body><h1>Perdu sur l'Internet ?</h1><h2>Pas de panique, on va vous aider</h2><strong><pre>    * <----- vous &ecirc;tes ici</pre></strong></body></html>\n"
iex> response.body |> byte_size()
204
iex> response.headers |> List.keyfind("content-length", 0)  
{"content-length", "163"}

Information provided by these headers no longer match the body, and this could users and next middlewares. I believe they should be updated. What do you think?

yordis added a commit that referenced this issue Aug 10, 2023
yordis added a commit that referenced this issue Aug 10, 2023
yordis added a commit that referenced this issue Aug 10, 2023
yordis added a commit that referenced this issue Aug 10, 2023
yordis added a commit that referenced this issue Aug 11, 2023
yordis added a commit that referenced this issue Aug 11, 2023
yordis added a commit that referenced this issue Sep 10, 2023
yordis added a commit that referenced this issue Sep 10, 2023
yordis added a commit that referenced this issue Oct 5, 2023
yordis added a commit that referenced this issue Oct 5, 2023
closes #598

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
yordis added a commit that referenced this issue Oct 5, 2023
closes #598

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
yordis added a commit that referenced this issue Oct 5, 2023
closes #598

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
yordis added a commit that referenced this issue Oct 6, 2023
closes #598

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
yordis added a commit that referenced this issue Oct 6, 2023
closes #598

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
yordis added a commit that referenced this issue Oct 6, 2023
closes #598

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
yordis added a commit that referenced this issue Oct 6, 2023
closes #598

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
yordis added a commit that referenced this issue Oct 8, 2023
closes #598

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
yordis added a commit that referenced this issue Oct 25, 2023
* chore(deps): bump ibrowse from 4.4.0 to 4.4.2 (#594)

* chore(deps): bump ibrowse from 4.4.0 to 4.4.2

Bumps [ibrowse](https://github.com/cmullaparthi/ibrowse) from 4.4.0 to 4.4.2.
- [Release notes](https://github.com/cmullaparthi/ibrowse/releases)
- [Changelog](https://github.com/cmullaparthi/ibrowse/blob/master/CHANGELOG)
- [Commits](cmullaparthi/ibrowse@v4.4...v4.4.2)

---
updated-dependencies:
- dependency-name: ibrowse
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* remove comment

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Yordis Prieto <yordis.prieto@gmail.com>

* chore(deps): bump msgpax from 2.3.1 to 2.4.0 (#595)

Bumps [msgpax](https://github.com/lexmag/msgpax) from 2.3.1 to 2.4.0.
- [Changelog](https://github.com/lexmag/msgpax/blob/master/CHANGELOG.md)
- [Commits](https://github.com/lexmag/msgpax/commits)

---
updated-dependencies:
- dependency-name: msgpax
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Yordis Prieto <yordis.prieto@gmail.com>

* fix: use mint passive mode (#591)

* chore: move modules to its own file (#615)

* fix: merging adapter options using Opts middleware (#613)

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>

* chore(deps-dev): bump excoveralls from 0.16.1 to 0.17.1 (#620)

Bumps [excoveralls](https://github.com/parroty/excoveralls) from 0.16.1 to 0.17.1.
- [Release notes](https://github.com/parroty/excoveralls/releases)
- [Changelog](https://github.com/parroty/excoveralls/blob/master/CHANGELOG.md)
- [Commits](parroty/excoveralls@v0.16.1...v0.17.1)

---
updated-dependencies:
- dependency-name: excoveralls
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): bump mix_test_watch from 1.1.0 to 1.1.1 (#619)

Bumps [mix_test_watch](https://github.com/lpil/mix-test.watch) from 1.1.0 to 1.1.1.
- [Changelog](https://github.com/lpil/mix-test.watch/blob/master/CHANGELOG.md)
- [Commits](lpil/mix-test.watch@v1.1.0...v1.1.1)

---
updated-dependencies:
- dependency-name: mix_test_watch
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump jason from 1.4.0 to 1.4.1 (#618)

Bumps [jason](https://github.com/michalmuskala/jason) from 1.4.0 to 1.4.1.
- [Release notes](https://github.com/michalmuskala/jason/releases)
- [Changelog](https://github.com/michalmuskala/jason/blob/master/CHANGELOG.md)
- [Commits](michalmuskala/jason@v1.4.0...v1.4.1)

---
updated-dependencies:
- dependency-name: jason
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump actions/checkout from 3 to 4 (#616)

Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): bump ex_doc from 0.29.4 to 0.30.6 (#617)

Bumps [ex_doc](https://github.com/elixir-lang/ex_doc) from 0.29.4 to 0.30.6.
- [Changelog](https://github.com/elixir-lang/ex_doc/blob/main/CHANGELOG.md)
- [Commits](elixir-lang/ex_doc@v0.29.4...v0.30.6)

---
updated-dependencies:
- dependency-name: ex_doc
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat: improve decompression middleware (#606)

closes #598

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>

* feat: allow to configure the prefix for the telemtry events (#622)

* Revert "feat: allow to configure the prefix for the telemtry events" (#624)

Revert "feat: allow to configure the prefix for the telemtry events (#622)"

This reverts commit 5d2a8f5.

* Update Tesla.Middleware.Logger for Elixir 1.11+ (#627)

Elixir 1.15 is now warning whenever the `:warn` level is used with the
recommendation of using `:warning` instead. The `Logger` middleware uses
`Logger.log/3`, so a compile-time warning would not be shown, only
a runtime warning.

This change adds `:warning` as a valid configuration option for Tesla
log level and automatically translates `:warn` or `:warning` to the
appropriate level (`:warn` for Elixir 1.10.x, `:warning` for Elixir
1.11.x or higher, as `Logger.warning/2` was introduced in 1.11.0).

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Yordis Prieto <yordis.prieto@gmail.com>
Co-authored-by: Austin Ziegler <austin@zieglers.ca>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant