Skip to content

Add Initial Support for AWS Common Runtime Http Client #1359

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

Merged
merged 14 commits into from
Sep 9, 2019

Conversation

alexw91
Copy link
Contributor

@alexw91 alexw91 commented Jul 23, 2019

Description

Add Initial Support for AWS Common Runtime Http Client. Users should consider this Client to be in "Early Beta" stage, and users should not replace usages of other Http clients with this one yet.

Motivation and Context

AwsCrtAsyncHttpClient is a non-blocking AsyncIO Http Client that is owned and maintained by AWS that uses the AWS TLS Library s2n on Linux platforms.

Known Missing Features not included in this Pull Request

  • No support for connection pooling or parallelizing requests to the same endpoint over multiple connections. Updated PR to use HttpConnectionPoolManager.
  • No Performance Tests Added AwsCrtAsyncHttpClient sdk-benchmarks Module
  • No support for plaintext Http connections

Testing

  1. AwsCrtHttpClientSpiVerificationTest
    • Verifies AwsCrtAsyncHttpClient correctly implements the SdkAsyncHttpClient SPI
  2. AwsCrtResponseBodyPublisherReactiveStreamCompatTest
    • Verifies AwsCrtResponseBodyPublisher correctly implements the Publisher<ByteBuffer> API
  3. AwsCrtRequestBodySubscriberReactiveStreamCompatTest
    • Verifies AwsCrtRequestBodySubscriber correctly implements the Subscriber<ByteBuffer> API
  4. AwsCrtClientKmsIntegrationTest
    • Verifies that AwsCrtAsyncHttpClient can be used to make CreateKey, Encrypt, and Decrypt calls to KMS.
  5. AwsCrtClientS3IntegrationTest
    • Verifies that AwsCrtAsyncHttpClient can download a file from S3 and that the file has the correct SHA-256 hash.
  6. AwsCrtClientCallingPatternIntegrationTest
    • Verifies that the AwsCrtAsyncHttpClient works in various combinations of calling patterns.

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have read the README document
  • I have added tests to cover my changes
  • All new and existing tests passed
  • A short description of the change has been added to the CHANGELOG
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

@codecov-io
Copy link

Codecov Report

Merging #1359 into master will increase coverage by 0.18%.
The diff coverage is 82.39%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1359      +/-   ##
============================================
+ Coverage     70.94%   71.12%   +0.18%     
- Complexity      188      262      +74     
============================================
  Files           777      782       +5     
  Lines         24266    24570     +304     
  Branches       1817     1854      +37     
============================================
+ Hits          17216    17476     +260     
- Misses         6257     6285      +28     
- Partials        793      809      +16
Flag Coverage Δ Complexity Δ
#unittests 71.12% <82.39%> (+0.18%) 262 <74> (+74) ⬆️
Impacted Files Coverage Δ Complexity Δ
...p/crt/internal/AwsCrtResponseBodySubscription.java 100% <100%> (ø) 5 <5> (?)
...http/crt/internal/AwsCrtRequestBodySubscriber.java 78% <78%> (ø) 12 <12> (?)
.../amazon/awssdk/http/crt/AwsCrtAsyncHttpClient.java 78.84% <78.84%> (ø) 21 <21> (?)
...http/crt/internal/AwsCrtResponseBodyPublisher.java 84.26% <84.26%> (ø) 24 <24> (?)
...ttp/crt/internal/AwsCrtAsyncHttpStreamAdapter.java 86.66% <86.66%> (ø) 12 <12> (?)
...on/awssdk/services/kinesis/KinesisRetryPolicy.java 85.71% <0%> (ø) 0% <0%> (ø) ⬇️
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 393687d...5722ad4. Read the comment docs.

@SdkPublicApi
public class AwsCrtAsyncHttpClient implements SdkAsyncHttpClient {
private static final Logger log = Logger.loggerFor(AwsCrtAsyncHttpClient.class);
private static final String HOST_HEADER = "Host";
Copy link
Contributor

Choose a reason for hiding this comment

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

is this H2 compatible? wouldn't it be :authority in that case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sending 'Host' Header is compatible with both Http/1 and Http/2, but it is recommended to send :authority Header instead of 'Host' if using Http/2.

From the HTTP/2 RFC: Clients that generate HTTP/2 requests directly SHOULD use the :authority pseudo-header field instead of the Host header field.

Also, I don't think we know which version of Http is being used at this point so we shouldn't generate headers that are only compatible with Http/2.

@alexw91 alexw91 changed the title Add Support for AWS Common Runtime Http Client Add Initial Support for AWS Common Runtime Http Client Jul 24, 2019
@alexw91 alexw91 changed the base branch from master to aws-crt-dev-preview August 12, 2019 19:55
@alexw91 alexw91 changed the base branch from aws-crt-dev-preview to master August 12, 2019 22:57
@alexw91 alexw91 changed the base branch from master to aws-crt-dev-preview August 12, 2019 22:57
Copy link
Contributor

@JonathanHenson JonathanHenson left a comment

Choose a reason for hiding this comment

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

just nit picks and questions.

Fix-n-ship

@millems millems merged commit 326c0e0 into aws:aws-crt-dev-preview Sep 9, 2019
aws-sdk-java-automation added a commit that referenced this pull request May 4, 2021
…07f3b8419

Pull request: release <- staging/61f6ba62-0c11-4ef5-b3f2-4af07f3b8419
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.

5 participants