Skip to content

Commit 1e0d072

Browse files
committed
update to test changes
1 parent bec8f2c commit 1e0d072

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

src/aws-cpp-sdk-core/source/http/windows/WinHttpSyncHttpClient.cpp

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -629,8 +629,11 @@ uint64_t WinHttpSyncHttpClient::DoWriteData(void* hHttpRequest, char* streamBuff
629629
{
630630
AWS_UNREFERENCED_PARAM(isChunked);
631631
DWORD bytesWritten = 0;
632-
if (!AzCallWinHttp("WinHttpWriteData", WinHttpWriteData, hHttpRequest, streamBuffer, (DWORD)bytesRead, &bytesWritten))
632+
if (!WinHttpWriteData(hHttpRequest, streamBuffer, (DWORD)bytesRead, &bytesWritten))
633633
{
634+
DWORD lastError = GetLastError();
635+
AWS_LOGSTREAM_ERROR(GetLogTag(), "WinHttpWriteData failed. Error: " << lastError << " (0x" << std::hex << lastError << std::dec << "), bytesToWrite: " << bytesRead);
636+
AzWinHttpLogLastError("WinHttpWriteData");
634637
return 0;
635638
}
636639
return bytesWritten;
@@ -704,19 +707,21 @@ bool WinHttpSyncHttpClient::DoSendRequest(void* hHttpRequest) const
704707

705708
bool WinHttpSyncHttpClient::DoSendRequest(void* hHttpRequest, const std::shared_ptr<HttpRequest>& request) const
706709
{
707-
DWORD totalLength = 0;
708-
709710
// Check if this is a Transfer-Encoding: chunked request
710711
if (request->HasTransferEncoding() && request->GetTransferEncoding() == "chunked") {
711-
totalLength = 0xFFFFFFFF; // WINHTTP_IGNORE_REQUEST_TOTAL_LENGTH
712-
}
713-
714-
bool success = WinHttpSendRequest(hHttpRequest, NULL, 0, NULL, 0, totalLength, 0) != 0;
715-
if (!success)
716-
{
717-
AzWinHttpLogLastError("WinHttpSendRequest");
712+
// For chunked requests, use WINHTTP_IGNORE_REQUEST_TOTAL_LENGTH
713+
bool success = WinHttpSendRequest(hHttpRequest, NULL, 0, NULL, 0, 0xFFFFFFFF, 0) != 0;
714+
if (!success)
715+
{
716+
DWORD lastError = GetLastError();
717+
AWS_LOGSTREAM_ERROR(GetLogTag(), "WinHttpSendRequest failed for chunked request. Error: " << lastError << " (0x" << std::hex << lastError << std::dec << ")");
718+
AzWinHttpLogLastError("WinHttpSendRequest");
719+
}
720+
return success;
721+
} else {
722+
// For regular requests, use the original method
723+
return DoSendRequest(hHttpRequest);
718724
}
719-
return success;
720725
}
721726

722727
bool WinHttpSyncHttpClient::DoQueryDataAvailable(void* hHttpRequest, uint64_t& available) const

0 commit comments

Comments
 (0)