Fix POST messages

Fixes rich presence in RetroAchievements
This commit is contained in:
Silent 2021-07-12 20:36:33 +02:00
parent 309169d14c
commit 382595ff71
No known key found for this signature in database
GPG Key ID: AE53149BB0C45AF1
2 changed files with 7 additions and 7 deletions

View File

@ -56,10 +56,9 @@ bool HTTPDownloaderUWP::StartRequest(HTTPDownloader::Request* request)
if (req->type == Request::Type::Post)
{
const winrt::Windows::Storage::Streams::Buffer post_buf(static_cast<u32>(req->post_data.size()));
std::memcpy(post_buf.data(), req->post_data.data(), req->post_data.size());
const HttpBufferContent post_content(post_buf);
const HttpStringContent post_content(StringUtil::UTF8StringToWideString(req->post_data),
winrt::Windows::Storage::Streams::UnicodeEncoding::Utf8,
L"application/x-www-form-urlencoded");
req->request_async = req->client.PostAsync(uri, post_content);
}
else

View File

@ -255,9 +255,10 @@ bool HTTPDownloaderWinHttp::StartRequest(HTTPDownloader::Request* request)
BOOL result;
if (req->type == HTTPDownloader::Request::Type::Post)
{
result = WinHttpSendRequest(req->hRequest, WINHTTP_NO_ADDITIONAL_HEADERS, 0, req->post_data.data(),
static_cast<DWORD>(req->post_data.size()), static_cast<DWORD>(req->post_data.size()),
reinterpret_cast<DWORD_PTR>(req));
const std::wstring_view additionalHeaders(L"Content-Type: application/x-www-form-urlencoded\r\n");
result = WinHttpSendRequest(req->hRequest, additionalHeaders.data(), additionalHeaders.size(),
req->post_data.data(), static_cast<DWORD>(req->post_data.size()),
static_cast<DWORD>(req->post_data.size()), reinterpret_cast<DWORD_PTR>(req));
}
else
{