aiohttp icon indicating copy to clipboard operation
aiohttp copied to clipboard

Http2 Support using hpack & hyperframe

Open Vizonex opened this issue 3 months ago • 4 comments

What do these changes do?

Many users have begged for http2 protocols and website use http2 to talk to legitimate users. With the rise of this new technologies hosting with http/2 as well as webscraping or using http2 with apis is now in demand. This is a concept for http2 support using hpack & hyperframe.

With httpx supporting http2 protocols already were behind and could use a little bit of the newer protocols ourselves.

I am requesting some assistance with figuring things out including injection of http2 for different kinds of requests or clients that are requesting http/2. (Hence why this is still a draft)

Are there changes in behavior for the user?

HTTP/2 will be added in and allow users to communicate with servers that have http/2 support.

Is it a substantial burden for the maintainers to support this?

The only burden I see is when we start to introduce more things and I have talked heavily on matrix about finding and hunting C libraries or making our own and yes have one already made one for parsing frames :) but we first need a pure python concept before we can use this llh2 library I came up with and more so the pure python stuff is what we will focus on tackling first.

Related issue number

Checklist

  • [ ] I think the code is well written
  • [ ] Unit tests for the changes exist
  • [ ] Documentation reflects the changes
  • [ ] If you provide code modification, please add yourself to CONTRIBUTORS.txt
    • The format is <Name> <Surname>.
    • Please keep alphabetical order, the file is sorted by names.
  • [ ] Add a new news fragment into the CHANGES/ folder
    • name it <issue_or_pr_num>.<type>.rst (e.g. 588.bugfix.rst)

    • if you don't have an issue number, change it to the pull request number after creating the PR

      • .bugfix: A bug fix for something the maintainers deemed an improper undesired behavior that got corrected to match pre-agreed expectations.
      • .feature: A new behavior, public APIs. That sort of stuff.
      • .deprecation: A declaration of future API removals and breaking changes in behavior.
      • .breaking: When something public is removed in a breaking way. Could be deprecated in an earlier release.
      • .doc: Notable updates to the documentation structure or build process.
      • .packaging: Notes for downstreams about unobvious side effects and tooling. Changes in the test invocation considerations and runtime assumptions.
      • .contrib: Stuff that affects the contributor experience. e.g. Running tests, building the docs, setting up the development environment.
      • .misc: Changes that are hard to assign to any of the above categories.
    • Make sure to use full sentences with correct case and punctuation, for example:

      Fixed issue with non-ascii contents in doctest text files
      -- by :user:`contributor-gh-handle`.
      

      Use the past tense or the present tense a non-imperative mood, referring to what's changed compared to the last released version of this project.

Vizonex avatar Sep 17 '25 22:09 Vizonex

CodSpeed Performance Report

Merging #11522 will not alter performance

Comparing Vizonex:http2 (d3e9c47) with master (35754d4)

Summary

✅ 59 untouched

codspeed-hq[bot] avatar Sep 17 '25 22:09 codspeed-hq[bot]

We probably need some tests (and it actually being linked together to the rest of the project) showing the implementation working before we review this.

Dreamsorcerer avatar Sep 19 '25 14:09 Dreamsorcerer

We probably need some tests (and it actually being linked together to the rest of the project) showing the implementation working before we review this.

Sure thing ^^ This is a draft after all and I will need help and suggestions in the matrix if I need it I want to create a dynamic setup when swapping from http/1.1 to http/2 before I start the PR. I thought about writing a abstract class object for the transitioning with all the inner stuff like sockets and things but let me see about making that and finding a dummy server that has http2 before I begin.

Vizonex avatar Sep 19 '25 15:09 Vizonex

Also, isn't h2 meant to handle most of this? I'm wondering if you've not just started recreating h2..

Dreamsorcerer avatar Sep 19 '25 17:09 Dreamsorcerer