fix(node-http-handler): shift http1 expect 100-continue requests to isolated http Agents #1754
+58
−19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue #, if available:
aws/aws-sdk-js-v3#6940
This pairs with aws/aws-sdk-js-v3#7450 which allows the criteria of the expect 100-continue header to be configured by the S3 Client owner.
Description of changes:
This PR moves http1.1 requests having header
expect: 100-continueto separate http(s) Agent instances. The presence of the header causes a confusion (crossed streams style) in the transmission of http headers and bodies in the Node.js http/https modules when using shared Agent instances and Buffer/Uint8Array payloads under conditions described in the linked issue.This is despite referential consistency in how the requests are invoked and no stray mutations in the user code, so at this point I suspect a bug or at least undocumented behavior in http(s) Agent sockets. It also only happens with Buffers and not strings. This shouldn't be related to shared Buffer memory misuse either, since I tried copying standalone Uint8Arrays at the call sites synchronously.
As a side effect of using isolated Agents, these requests will not be subject to the socket limits nor socket reuse intentions placed on the NodeHttpHandler's Agent by the downstream consumer.