From 591d02c97922c67ff9f3af6304142b5019d204f0 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 12 Jan 2021 03:00:35 +0100 Subject: [PATCH] Increase default buffer size for wxWebRequest operations Use 64KiB rather than 8KiB, as the latter seems rather small nowadays. Also add a symbolic constant for this number. --- include/wx/private/webrequest.h | 3 +++ src/common/webrequest.cpp | 2 +- src/msw/webrequest_winhttp.cpp | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/wx/private/webrequest.h b/include/wx/private/webrequest.h index 3f3bca6158..4a515daa02 100644 --- a/include/wx/private/webrequest.h +++ b/include/wx/private/webrequest.h @@ -18,6 +18,9 @@ WX_DECLARE_STRING_HASH_MAP(wxString, wxWebRequestHeaderMap); +// Default buffer size when a fixed-size buffer must be used. +const int wxWEBREQUEST_BUFFER_SIZE = 64 * 1024; + // ---------------------------------------------------------------------------- // wxWebAuthChallengeImpl // ---------------------------------------------------------------------------- diff --git a/src/common/webrequest.cpp b/src/common/webrequest.cpp index 5de8f13949..7193786731 100644 --- a/src/common/webrequest.cpp +++ b/src/common/webrequest.cpp @@ -509,7 +509,7 @@ wxWebAuthChallenge::SetCredentials(const wxWebCredentials& cred) wxWebResponseImpl::wxWebResponseImpl(wxWebRequestImpl& request) : m_request(request), - m_readSize(8 * 1024) + m_readSize(wxWEBREQUEST_BUFFER_SIZE) { } diff --git a/src/msw/webrequest_winhttp.cpp b/src/msw/webrequest_winhttp.cpp index a097f5d144..75ec43edb2 100644 --- a/src/msw/webrequest_winhttp.cpp +++ b/src/msw/webrequest_winhttp.cpp @@ -194,7 +194,7 @@ wxWebRequestWinHTTP::HandleCallback(DWORD dwInternetStatus, void wxWebRequestWinHTTP::WriteData() { - int dataWriteSize = 8 * 1024; + int dataWriteSize = wxWEBREQUEST_BUFFER_SIZE; if ( m_dataWritten + dataWriteSize > m_dataSize ) dataWriteSize = m_dataSize - m_dataWritten; if ( !dataWriteSize )