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

Mint adapter does not support HTTP2 push #370

Open
ZsoltMaslanyi opened this issue Apr 5, 2020 · 4 comments
Open

Mint adapter does not support HTTP2 push #370

ZsoltMaslanyi opened this issue Apr 5, 2020 · 4 comments
Labels
bug 🔥 good first issue mint Issues related to mint adapter

Comments

@ZsoltMaslanyi
Copy link

Hi guys,

This is a feature request that I can't take on on my own.

The Mint adapter does not support HTTP2 push messages and I haven't found a way to disable it through the adapter configuration.

The following arguments were given to anonymous fn/2 in Tesla.Adapter.Mint.reduce_responses/3:
# 1
{:push_promise, #Reference<0.1726172914.1690042371.196731>,
 #Reference<0.1726172914.1690042371.196749>,
 [
   {":method", "GET"},
   {":path", "/assets/index.css?1583114754"},
   {":scheme", "https"},
   {":authority", "remoteok.io"},
   {"user-agent", "mint/1.0.0"}
 ]}
# 2
%{}
@teamon
Copy link
Member

teamon commented Apr 7, 2020

Please share an example code, these is little I can do with the given information.

I'm also not sure if this is a feature, or a bug. Please clarify.

@ZsoltMaslanyi
Copy link
Author

ZsoltMaslanyi commented Apr 7, 2020

Hi @teamon , thanks for taking the time to check this!

Sorry if it wasn't obvious from the description, here's the example code:

defmodule TeslaClient do
  use Tesla
  adapter(Tesla.Adapter.Mint)

  def get_example_http2_site() do
    get("https://remoteok.io")
  end
end

TeslaClient.get_example_http2_site()

The error message is the same as the original post I wrote.
The Mint adapter's reduce_responses/3 gets called with :push_promise to push down content on the connection, but the response is not handled by the adapter.

Re for if it's a feature request or a bug - I'd go with feature request, but you'll be the judge.
Tesla does have a Mint adapter, but it fails to work on any HTTP2 sites.

@teamon teamon added feature ✨ help wanted mint Issues related to mint adapter and removed awaiting-feedback labels Apr 16, 2020
@teamon
Copy link
Member

teamon commented Dec 17, 2021

Confirmed:

iex(5)> Tesla.get(client, "https://remoteok.com")
** (FunctionClauseError) no function clause matching in anonymous fn/2 in Tesla.Adapter.Mint.reduce_responses/3    
    
    The following arguments were given to anonymous fn/2 in Tesla.Adapter.Mint.reduce_responses/3:
    
        # 1
        {:push_promise, #Reference<0.179896103.3862429701.90397>,
         #Reference<0.179896103.3862429701.90400>,
         [
           {":method", "GET"},
           {":path", "/global.css?1639217940"},
           {":scheme", "https"},
           {":authority", "remoteok.com"},
           {"user-agent", "mint/1.3.0"}
         ]}
    
        # 2
        %{}
    
    (tesla 1.4.3) lib/tesla/adapter/mint.ex:328: anonymous fn/2 in Tesla.Adapter.Mint.reduce_responses/3
    (elixir 1.12.3) lib/enum.ex:2385: Enum."-reduce/3-lists^foldl/2-0-"/3
    (tesla 1.4.3) lib/tesla/adapter/mint.ex:298: Tesla.Adapter.Mint.receive_packet/4
    (tesla 1.4.3) lib/tesla/adapter/mint.ex:258: Tesla.Adapter.Mint.receive_responses/4
    (tesla 1.4.3) lib/tesla/adapter/mint.ex:197: Tesla.Adapter.Mint.format_response/3
    (tesla 1.4.3) lib/tesla/adapter/mint.ex:59: Tesla.Adapter.Mint.call/2

@yordis
Copy link
Member

yordis commented May 15, 2023

I tried to replicate this: https://gist.github.com/yordis/ea7226110cc578e4372845e3dffd92d3#file-elixir-tesla-tesla-pull-591-livemd

But it seems to be working just fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🔥 good first issue mint Issues related to mint adapter
Projects
Status: Todo
Development

No branches or pull requests

3 participants