Skip to content
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

Copy stream for upload requests and remove expect header #739

Merged
merged 8 commits into from
Aug 20, 2021

Conversation

mwwoda
Copy link
Contributor

@mwwoda mwwoda commented Aug 3, 2021

Stream is being closed (disposed) when request is sent by HttpClient. See dotnet/runtime#14612

When a request completes, HttpClient disposes the request content so the user doesn't have to. This also ensures that a HttpContent object is only sent once using HttpClient (similar to HttpRequestMessages that can also be sent only once)

It was actually resolved in .NET Core (dotnet/corefx#19082), but since we need to support the .NET Framework too, another fix is required.

The drawback of copying stream is that we allocate additional memory for the copied stream (basically stream size is doubled).

Another fix that could be applied instead would be to check if token is valid before making the upload request.

Remove expect header
@mwwoda mwwoda requested review from mhagmajer and PJSimon August 3, 2021 17:39
Change ReusableContent to internal
mhagmajer
mhagmajer previously approved these changes Aug 5, 2021
Box.V2/Request/HttpRequestHandler.cs Outdated Show resolved Hide resolved
Box.V2/Request/ReusableContent.cs Outdated Show resolved Hide resolved
@mwwoda mwwoda merged commit 69164b3 into main Aug 20, 2021
@mwwoda mwwoda deleted the sdk-1695-long-upload-fail branch August 20, 2021 08:18
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.

3 participants