Implement IStream::Seek on IRequestStream to accommodate reuse #1573
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.
This PR adds an
IStream
implementation to http_client_winrt.cpp'sIRequestStream
in order to supportIStream::Seek
and so stream reuse. This addresses #1572.An implementation of
ISequentialStream
is passed intoIXMLHttpRequest2::Send
to represent the body of an HTTP request. IfIXMLHttpRequest2
hits a recoverable error - in my caseERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED
when POST'ing to a server that accepts but doesn't require a client certificate - it will attempt to retry the send. In order to do soIXMLHttpRequest2
needs to seek the stream back to the start (having already read the buffer once for the original request), butISequentialStream
doesn't support seeking. If theISequentialStream
can be QI'd forIStream
, thenIXMLHttpRequest2
will use that to seek back to the start, and the request will be retried.The implementation of
IStream
is very basic, everything butSeek
returnsE_NOTIMPL
. TheSeek
implementation itself is relatively straight-forward, since the constructs map directly through to the underlying buffer.