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

Add flag to disable HTTP 2 #608

Merged
merged 2 commits into from
Jun 20, 2024
Merged

Add flag to disable HTTP 2 #608

merged 2 commits into from
Jun 20, 2024

Conversation

jb3
Copy link
Collaborator

@jb3 jb3 commented Jun 20, 2024

Adds a new config flag force_http1 that explicitly sets the protocols in the
Gun open options to use HTTP1. By default, if a TLS connection is set in the
transport (which defaults to TLS if port 443 is used), then the protocols
defaults to [:http2, :http], preferring HTTP2.

We are currently trying to diagnose an issue with stagnation of connections in
the ratelimiter due to missed responses and this flag would allow us to rule out
HTTP2 as having influence in the problems.

I have tested this locally, as you can see here the first map is an inspected
debug log of the generated options and the response is received as normal:

iex(1)> Nostrum.Api.get_user 165023948638126080
%{
  ...
  protocol: :http,
  transport: :tls,
  ...
  origin_host: ~c"discord.com",
  origin_port: 443,
  origin_scheme: "https",
  ...
}
{:ok,
 %Nostrum.Struct.User{
   id: 165023948638126080,
   username: "joe.banks",
   discriminator: "0",
   global_name: "joe",
   avatar: "a_bbe3b1029f3ab24d8034bebd9772ed2c",
   bot: nil,
   public_flags: 4457216
 }}

@jb3 jb3 changed the title Add flag to disable HTTP Add flag to disable HTTP 2 Jun 20, 2024
@jchristgit jchristgit merged commit 0142400 into master Jun 20, 2024
10 checks passed
@jchristgit
Copy link
Collaborator

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants