Make wxWebResponse::Init() and Finalize() non-public

The former can be called from the derived class ctors while the latter
only needs to be called from wxWebRequest itself, so just make it a
friend: this is not ideal, but still better than leaving this public and
simpler than any alternatives.
This commit is contained in:
Vadim Zeitlin
2020-12-13 01:33:01 +01:00
parent 1c61fe6baf
commit 8ea4f38689
5 changed files with 21 additions and 11 deletions

View File

@@ -220,8 +220,11 @@ void wxWebRequestWinHTTP::CreateResponse()
if ( ::WinHttpReceiveResponse(m_request, NULL) )
{
m_response.reset(new wxWebResponseWinHTTP(*this));
if ( !m_response->Init() )
// wxWebResponseWinHTTP ctor could have changed the state if its
// initialization failed, so check for this.
if ( GetState() == State_Failed )
return;
int status = m_response->GetStatus();
if ( status == 401 || status == 407)
{
@@ -364,6 +367,8 @@ wxWebResponseWinHTTP::wxWebResponseWinHTTP(wxWebRequestWinHTTP& request):
if ( contentLengthStr.empty() ||
!contentLengthStr.ToLongLong(&m_contentLength) )
m_contentLength = -1;
Init();
}
wxString wxWebResponseWinHTTP::GetURL() const