Implement wxWebRequestCURL::GetBytesSent

This commit is contained in:
Tobias Taschner
2018-11-04 14:46:03 +01:00
parent 127b596ada
commit fe4a5343f7
2 changed files with 11 additions and 5 deletions

View File

@@ -70,6 +70,7 @@ private:
struct curl_slist *m_headerList; struct curl_slist *m_headerList;
wxScopedPtr<wxWebResponseCURL> m_response; wxScopedPtr<wxWebResponseCURL> m_response;
wxScopedPtr<wxWebAuthChallengeCURL> m_authChallenge; wxScopedPtr<wxWebAuthChallengeCURL> m_authChallenge;
wxFileOffset m_bytesSent;
void DestroyHeaderList(); void DestroyHeaderList();

View File

@@ -227,6 +227,8 @@ void wxWebRequestCURL::Start()
bool wxWebRequestCURL::StartRequest() bool wxWebRequestCURL::StartRequest()
{ {
m_bytesSent = 0;
if ( static_cast<wxWebSessionCURL&>(GetSession()).StartRequest(*this) ) if ( static_cast<wxWebSessionCURL&>(GetSession()).StartRequest(*this) )
{ {
SetState(State_Active); SetState(State_Active);
@@ -271,7 +273,12 @@ wxString wxWebRequestCURL::GetError() const
size_t wxWebRequestCURL::ReadData(char* buffer, size_t size) size_t wxWebRequestCURL::ReadData(char* buffer, size_t size)
{ {
if ( m_dataStream ) if ( m_dataStream )
return m_dataStream->Read((void*)buffer, size).LastRead(); {
m_dataStream->Read((void*)buffer, size);
size_t readSize = m_dataStream->LastRead();
m_bytesSent += readSize;
return readSize;
}
else else
return 0; return 0;
} }
@@ -292,14 +299,12 @@ wxWebResponse* wxWebRequestCURL::GetResponse() const
wxFileOffset wxWebRequestCURL::GetBytesSent() const wxFileOffset wxWebRequestCURL::GetBytesSent() const
{ {
wxFAIL_MSG("not implemented"); return m_bytesSent;
return 0;
} }
wxFileOffset wxWebRequestCURL::GetBytesExpectedToSend() const wxFileOffset wxWebRequestCURL::GetBytesExpectedToSend() const
{ {
wxFAIL_MSG("not implemented"); return m_dataSize;
return 0;
} }
// //