-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Http2 Support using hpack & hyperframe #11522
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
base: master
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,192 @@ | |||
import base64 # TODO: Pybase64 or libbase64 in Cython would be a good idea here... |
Check notice
Code scanning / CodeQL
Unused import Note
from hpack.hpack import Decoder | ||
from http_writer import HttpVersion, HttpVersion20 | ||
from hyperframe.frame import ContinuationFrame, Frame, GoAwayFrame, HeadersFrame | ||
from multidict import CIMultiDict, CIMultiDictProxy, istr |
Check notice
Code scanning / CodeQL
Unused import Note
Import of 'istr' is not used.
from multidict import CIMultiDict, CIMultiDictProxy, istr | ||
from yarl import URL | ||
|
||
from . import hdrs |
Check notice
Code scanning / CodeQL
Unused import Note
BrotliDecompressor, | ||
ZLibDecompressor, | ||
ZSTDDecompressor, | ||
) | ||
from .http_parser import RawRequestMessage, RawResponseMessage, _MsgT | ||
from .streams import EMPTY_PAYLOAD, StreamReader | ||
from .typedefs import RawHeaders |
Check notice
Code scanning / CodeQL
Unused import Note
Import of 'HAS_ZSTD' is not used.
Import of 'BrotliDecompressor' is not used.
Import of 'ZLibDecompressor' is not used.
Import of 'ZSTDDecompressor' is not used.
ZSTDDecompressor, | ||
) | ||
from .http_parser import RawRequestMessage, RawResponseMessage, _MsgT | ||
from .streams import EMPTY_PAYLOAD, StreamReader |
Check notice
Code scanning / CodeQL
Unused import Note
Import of 'StreamReader' is not used.
) | ||
from .http_parser import RawRequestMessage, RawResponseMessage, _MsgT | ||
from .streams import EMPTY_PAYLOAD, StreamReader | ||
from .typedefs import RawHeaders |
Check notice
Code scanning / CodeQL
Unused import Note
|
||
# Reflects h2/connection from a lower-level prespective so | ||
# socket writing can be a bit more optimized. | ||
from hpack.hpack import Decoder, Encoder |
Check notice
Code scanning / CodeQL
Unused import Note
from .base_protocol import BaseProtocol | ||
from .client_exceptions import ClientConnectionResetError | ||
from .compression_utils import ZLibCompressor | ||
from .helpers import NO_EXTENSIONS |
Check notice
Code scanning / CodeQL
Unused import Note
CodSpeed Performance ReportMerging #11522 will not alter performanceComparing Summary
|
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. |
Also, isn't h2 meant to handle most of this? I'm wondering if you've not just started recreating h2.. |
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
CONTRIBUTORS.txt
CHANGES/
foldername 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 animproper 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 breakingchanges 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 buildprocess.
.packaging
: Notes for downstreams about unobvious side effectsand 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 abovecategories.
Make sure to use full sentences with correct case and punctuation,
for example:
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.