Skip to content

H2 write stream #635

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

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open

H2 write stream #635

wants to merge 18 commits into from

Conversation

TingDaoK
Copy link
Contributor

@TingDaoK TingDaoK commented Mar 31, 2025

Issue #, if available:

  • binding out the aws_http2_stream_write_data
  • Modify the interface to have http2 specific connection and stream leave the opportunity for us to adding more http/2 specific features.

Description of changes:

  • In aws_py_translate_py_error, clearly don't set_sys_last_vars. Since the set_sys_last_vars will leave the exception (traceback) object live in the sys level, and somehow it may refer to the CRT native objects, and causing the test to leak. (which in theory, it's probably fine?)
  • Adding new API to allow user to use aws_http2_stream_write_data to avoid every ticket of the loop to check the input stream for more data. It will wait until the next available input stream to read from it, which reduces the CPU usage.

Key Design options

  1. The connection/stream interface is a low level details in terms of the http client. If we implement the http client in the future, the connection/stream won't be the interface we want public usage
  2. Given the low level interface here, I believe we should have the separate interface for HTTP/1.1 and HTTP/2, we can build the unified interface on top of this in the future, but we cannot get the other way to leave the door open.
  3. We add those functionalities based on the use case from python SDK, only add as needed.
  4. Some good features like "allow the alpn to return different protocol" and "helper to config the http/2 for the http/2 connection" as not currently needed.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@TingDaoK TingDaoK marked this pull request as ready for review March 31, 2025 22:46
This class extends HttpClientConnection with HTTP/2 specific functionality.
"""
@classmethod
def new(cls,
Copy link
Contributor

@graebm graebm Apr 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debatable: not sure it's worth giving this an explicit constructor? It's not doing anything to actually cause the user to get an HTTP/2 connection, like setting alpn=h2 or prior_knowledge_http2. It's just forcing an error if the user didn't end up getting an HTTP/2 connection.

For better or worse, our API in C takes all possible options, because it's possible to kick off a connection and not know what you're going to get at the end.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we will add more to the connection, like settings, in the near future.

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

Successfully merging this pull request may close these issues.

None yet

2 participants