Closed SergeyRyabinin closed 5 months ago
Issue #, if available:
Unlike in lib curl,
WinHTTP expects a pointer + size to where Windows is going to write us a reply:
WINHTTPAPI BOOL WinHttpReadData( [in] HINTERNET hRequest, [out] LPVOID lpBuffer, [in] DWORD dwNumberOfBytesToRead, [out] LPDWORD lpdwNumberOfBytesRead );
https://learn.microsoft.com/en-us/windows/win32/api/winhttp/nf-winhttp-winhttpreaddata while C++'s iostream (it the central point of requests/response handling in the SDK from the initial design) manipulates C++'s streams:
// inserts blocks of characters basic_ostream& write( const char_type* s, std::streamsize count );
https://en.cppreference.com/w/cpp/io/basic_iostream and can't provide raw pre-allocated buffer that WinHTTP wants.
Should WinHTTP provide std::iostream interface - this would not be an issue.
Description of changes:
Create a hack-y class to access raw pointers of the underlying buffer of the streambuffer to perform writes directly to the pptr pointer.
pptr
Check all that applies:
Check which platforms you have built SDK on to verify the correctness of this PR.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Issue #, if available:
Unlike in lib curl,
WinHTTP expects a pointer + size to where Windows is going to write us a reply:
https://learn.microsoft.com/en-us/windows/win32/api/winhttp/nf-winhttp-winhttpreaddata while C++'s iostream (it the central point of requests/response handling in the SDK from the initial design) manipulates C++'s streams:
https://en.cppreference.com/w/cpp/io/basic_iostream and can't provide raw pre-allocated buffer that WinHTTP wants.
Should WinHTTP provide std::iostream interface - this would not be an issue.
Description of changes:
Create a hack-y class to access raw pointers of the underlying buffer of the streambuffer to perform writes directly to the
pptr
pointer.Check all that applies:
Check which platforms you have built SDK on to verify the correctness of this PR.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.