Skip to content

[BUG] HTTP/2 yields errors #3556

@Poolitzer

Description

@Poolitzer

We introduced HTTP/2 support by default in #3506. This lead to two problems:

  1. Connection to a local bot api instance without proxy leads to a broken connection, since the local api only supports HTTP/1.0 or HTTP/1.1. While this can be fixed by the user if they run a proxy in front of it which is capable of resolving HTTP/2 requests, this is an unnecessary strain to the end user. I propose the following:

    • whenever local_mode or http_version is called, check if the http is set to 2/local mode is set to true. If yes, raise a PTBUserWarning that this will probably not work out.
      • (maybe also when changing the URLs?)
    • when building, reset http to 1.1 if we still decide it should be 2 by default and if local mode is true. Don't do that if http is explicitly set to 2.
    • add a big note to the docs about all this to the http_version command
  2. For two users in our report chat, the long polling getUpdates process broke. For now, we do not know why. I will try to see if I can get it to fail with curl or a different back-end over the coming days, but if I can't find the reason why/reproduce it reliable enough to report it to the api developer, we should consider changing our default to 1.1.

    Related traceback, courtesy of @Trifase https://nekobin.com/fuluyanoja.py

Workaround

If you're getting connection errors, such as the one in the traceback, add this to your builder:

builder.get_updates_http_version('1.1').http_version('1.1').build()

Metadata

Metadata

Assignees

Labels

No labels
No labels

Priority

None yet

Effort

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions