Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
cdf7bae
WIP
TingDaoK May 27, 2025
c433ede
next
TingDaoK Jun 10, 2025
143b9e9
WIP
TingDaoK Jun 10, 2025
e87e26e
it works with smithy take2
TingDaoK Jun 10, 2025
e46471c
clean up
TingDaoK Jun 10, 2025
6c802b1
fix test
TingDaoK Jun 10, 2025
b8af499
clean up
TingDaoK Jun 10, 2025
5e8eb43
couple fixes
TingDaoK Jun 11, 2025
91fbf9c
Merge branch 'main' into asyncio-take4
TingDaoK Jun 11, 2025
ad2520b
rename and move the method to be more logically ordered
TingDaoK Jun 11, 2025
d9c90a5
fix python38
TingDaoK Jun 11, 2025
7e2dfeb
python 3.8 has been removed by github
TingDaoK Jun 11, 2025
584b2f9
incase of the future cancelled, just return
TingDaoK Jun 11, 2025
e2bbb98
edit the comments
TingDaoK Jun 12, 2025
7d27da3
show me the path
TingDaoK Jun 16, 2025
16f67d6
more python style ood
TingDaoK Jun 17, 2025
54f3e8e
Potential fix for code scanning alert no. 9: Use of insecure SSL/TLS …
TingDaoK Jun 17, 2025
3f48ddd
couple more fix
TingDaoK Jun 17, 2025
d851cac
Merge branch 'main' into asyncio-take4
TingDaoK Jun 17, 2025
7584894
remove unneeded
TingDaoK Jun 17, 2025
955d176
I'll fix test later
TingDaoK Jun 17, 2025
c95841b
use the loop
TingDaoK Jun 17, 2025
4886a3b
demo for testing
TingDaoK Jun 17, 2025
76f0e33
unified interface as the base
TingDaoK Jun 18, 2025
0fe5d76
fix tests and doc
TingDaoK Jun 18, 2025
f18b979
naming update
TingDaoK Jun 18, 2025
324ec18
typo...
TingDaoK Jun 18, 2025
fdbef55
hmmm
TingDaoK Jun 18, 2025
d3e3ba4
why???
TingDaoK Jun 18, 2025
c48d68f
renaming the module and class
TingDaoK Jun 18, 2025
c3a442d
update the path
TingDaoK Jun 18, 2025
e50a501
Merge branch 'main' into asyncio-take4
TingDaoK Jun 18, 2025
33914ba
address comments
TingDaoK Jun 19, 2025
5bced4a
remove the demo
TingDaoK Jun 19, 2025
ac7782a
Merge branch 'main' into asyncio-take4
TingDaoK Jun 23, 2025
0ab3899
trivial
TingDaoK Jun 23, 2025
7fdc182
remove unneeded forward declaration
TingDaoK Jun 23, 2025
eff3d57
keyword required
TingDaoK Jun 23, 2025
44e2640
use wrap_future for consistence
TingDaoK Jun 24, 2025
cd70094
Merge branch 'main' into asyncio-take4
TingDaoK Sep 10, 2025
7b73c8c
renaming
TingDaoK Sep 10, 2025
0c0a521
why this was included
TingDaoK Sep 10, 2025
f28d1fc
update documentation
TingDaoK Sep 11, 2025
9841c24
latest submodules
TingDaoK Sep 18, 2025
1f8bf1a
include this for new aws-lc change
TingDaoK Sep 18, 2025
b9f20fb
Merge branch 'main' into asyncio-take4
TingDaoK Sep 18, 2025
60172a2
Merge branch 'main' into asyncio-take4
TingDaoK Sep 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,8 @@ jobs:


windows:
runs-on: windows-2022 # latest
# https://github.com/actions/runner-images/issues/12034 Python 3.8.10 is no longer available on windows-2022
runs-on: windows-2025
strategy:
matrix:
arch: [x86, x64]
Expand All @@ -265,8 +266,9 @@ jobs:
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: Build ${{ env.PACKAGE_NAME }} + consumers
run: |
where python
python -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')"
python builder.pyz build -p ${{ env.PACKAGE_NAME }} --python "C:\\hostedtoolcache\\windows\\Python\\3.8.10\\${{ matrix.arch }}\\python.exe"
python builder.pyz build -p ${{ env.PACKAGE_NAME }} --python "C:\\hostedtoolcache\\windows\\Python\\3.9.13\\${{ matrix.arch }}\\python.exe"

macos:
runs-on: macos-14 # latest
Expand Down
1 change: 1 addition & 0 deletions awscrt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
'auth',
'crypto',
'http',
'http_asyncio',
'io',
'mqtt',
'mqtt5',
Expand Down
35 changes: 24 additions & 11 deletions awscrt/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ def _generic_new(
proxy_options: Optional['HttpProxyOptions'] = None,
expected_version: Optional[HttpVersion] = None,
initial_settings: Optional[List[Http2Setting]] = None,
on_remote_settings_changed: Optional[Callable[[List[Http2Setting]], None]] = None) -> "concurrent.futures.Future":
on_remote_settings_changed: Optional[Callable[[List[Http2Setting]], None]] = None,
asyncio_connection=False) -> "concurrent.futures.Future":
"""
Initialize the generic part of the HttpClientConnection class.
"""
Expand All @@ -217,7 +218,8 @@ def _generic_new(
tls_connection_options=tls_connection_options,
connect_future=future,
expected_version=expected_version,
on_remote_settings_changed=on_remote_settings_changed)
on_remote_settings_changed=on_remote_settings_changed,
asyncio_connection=asyncio_connection)

_awscrt.http_client_connection_new(
bootstrap,
Expand Down Expand Up @@ -407,7 +409,6 @@ def _init_common(self,
# keep HttpRequest alive until stream completes
self._request: 'HttpRequest' = request
self._version: HttpVersion = connection.version

self._binding = _awscrt.http_client_stream_new(self, connection, request, http2_manual_write)

@property
Expand Down Expand Up @@ -462,6 +463,9 @@ def write_data(self,
body_stream: InputStream = InputStream.wrap(data_stream, allow_none=True)

def on_write_complete(error_code: int) -> None:
if future.cancelled():
# the future was cancelled, so we don't need to set the result or exception
return
if error_code:
future.set_exception(awscrt.exceptions.from_code(error_code))
else:
Expand Down Expand Up @@ -809,7 +813,8 @@ def __init__(
tls_connection_options: Optional[TlsConnectionOptions] = None,
connect_future: Optional[Future] = None,
expected_version: Optional[HttpVersion] = None,
on_remote_settings_changed: Optional[Callable[[List[Http2Setting]], None]] = None) -> None:
on_remote_settings_changed: Optional[Callable[[List[Http2Setting]], None]] = None,
asyncio_connection=False) -> None:
self._shutdown_future = None
self._host_name = host_name
self._port = port
Expand All @@ -818,23 +823,31 @@ def __init__(
self._connect_future = connect_future
self._expected_version = expected_version
self._on_remote_settings_changed_from_user = on_remote_settings_changed
self._asyncio_connection = asyncio_connection

def _on_connection_setup(self, binding: Any, error_code: int, http_version: HttpVersion) -> None:
if self._connect_future is None:
return

if error_code != 0:
self._connect_future.set_exception(awscrt.exceptions.from_code(error_code))
return
if self._expected_version and self._expected_version != http_version:
# unexpected protocol version
# AWS_ERROR_HTTP_UNSUPPORTED_PROTOCOL
self._connect_future.set_exception(awscrt.exceptions.from_code(2060))
return
if error_code != 0:
self._connect_future.set_exception(awscrt.exceptions.from_code(error_code))
return
if http_version == HttpVersion.Http2:
connection = Http2ClientConnection()
if self._asyncio_connection:
# Import is done here to avoid circular import issues
from awscrt.http_asyncio import HttpClientConnectionAsync, Http2ClientConnectionAsync
if http_version == HttpVersion.Http2:
connection = Http2ClientConnectionAsync()
else:
connection = HttpClientConnectionAsync()
else:
connection = HttpClientConnection()
if http_version == HttpVersion.Http2:
connection = Http2ClientConnection()
else:
connection = HttpClientConnection()

connection._host_name = self._host_name
connection._port = self._port
Expand Down
Loading
Loading