Add tracing statements to WinHTTP code too
This again can be very useful for debugging.
This commit is contained in:
		@@ -149,6 +149,9 @@ wxWebRequestWinHTTP::HandleCallback(DWORD dwInternetStatus,
 | 
				
			|||||||
                                    LPVOID lpvStatusInformation,
 | 
					                                    LPVOID lpvStatusInformation,
 | 
				
			||||||
                                    DWORD dwStatusInformationLength)
 | 
					                                    DWORD dwStatusInformationLength)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    wxLogTrace(wxTRACE_WEBREQUEST, "Request %p: callback %08x, len=%zu",
 | 
				
			||||||
 | 
					               this, dwInternetStatus, dwStatusInformationLength);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    switch ( dwInternetStatus )
 | 
					    switch ( dwInternetStatus )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        case WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE:
 | 
					        case WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE:
 | 
				
			||||||
@@ -194,6 +197,8 @@ wxWebRequestWinHTTP::HandleCallback(DWORD dwInternetStatus,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void wxWebRequestWinHTTP::WriteData()
 | 
					void wxWebRequestWinHTTP::WriteData()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    wxLogTrace(wxTRACE_WEBREQUEST, "Request %p: writing data", this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    int dataWriteSize = wxWEBREQUEST_BUFFER_SIZE;
 | 
					    int dataWriteSize = wxWEBREQUEST_BUFFER_SIZE;
 | 
				
			||||||
    if ( m_dataWritten + dataWriteSize > m_dataSize )
 | 
					    if ( m_dataWritten + dataWriteSize > m_dataSize )
 | 
				
			||||||
        dataWriteSize = m_dataSize - m_dataWritten;
 | 
					        dataWriteSize = m_dataSize - m_dataWritten;
 | 
				
			||||||
@@ -224,6 +229,8 @@ void wxWebRequestWinHTTP::WriteData()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void wxWebRequestWinHTTP::CreateResponse()
 | 
					void wxWebRequestWinHTTP::CreateResponse()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    wxLogTrace(wxTRACE_WEBREQUEST, "Request %p: creating response", this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ( !::WinHttpReceiveResponse(m_request, NULL) )
 | 
					    if ( !::WinHttpReceiveResponse(m_request, NULL) )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        SetFailedWithLastError();
 | 
					        SetFailedWithLastError();
 | 
				
			||||||
@@ -269,6 +276,17 @@ void wxWebRequestWinHTTP::SetFailed(DWORD errorCode)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void wxWebRequestWinHTTP::Start()
 | 
					void wxWebRequestWinHTTP::Start()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    wxString method;
 | 
				
			||||||
 | 
					    if ( !m_method.empty() )
 | 
				
			||||||
 | 
					        method = m_method;
 | 
				
			||||||
 | 
					    else if ( m_dataSize )
 | 
				
			||||||
 | 
					        method = "POST";
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					        method = "GET";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    wxLogTrace(wxTRACE_WEBREQUEST, "Request %p: start \"%s %s\"",
 | 
				
			||||||
 | 
					               this, method, m_url);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Parse the URL
 | 
					    // Parse the URL
 | 
				
			||||||
    URL_COMPONENTS urlComps;
 | 
					    URL_COMPONENTS urlComps;
 | 
				
			||||||
    wxZeroMemory(urlComps);
 | 
					    wxZeroMemory(urlComps);
 | 
				
			||||||
@@ -298,14 +316,6 @@ void wxWebRequestWinHTTP::Start()
 | 
				
			|||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    wxString method;
 | 
					 | 
				
			||||||
    if ( !m_method.empty() )
 | 
					 | 
				
			||||||
        method = m_method;
 | 
					 | 
				
			||||||
    else if ( m_dataSize )
 | 
					 | 
				
			||||||
        method = "POST";
 | 
					 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
        method = "GET";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    wxString objectName(urlComps.lpszUrlPath, urlComps.dwUrlPathLength);
 | 
					    wxString objectName(urlComps.lpszUrlPath, urlComps.dwUrlPathLength);
 | 
				
			||||||
    if ( urlComps.dwExtraInfoLength )
 | 
					    if ( urlComps.dwExtraInfoLength )
 | 
				
			||||||
        objectName += "?" + wxString(urlComps.lpszExtraInfo, urlComps.dwExtraInfoLength);
 | 
					        objectName += "?" + wxString(urlComps.lpszExtraInfo, urlComps.dwExtraInfoLength);
 | 
				
			||||||
@@ -381,6 +391,8 @@ void wxWebRequestWinHTTP::SendRequest()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void wxWebRequestWinHTTP::Cancel()
 | 
					void wxWebRequestWinHTTP::Cancel()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    wxLogTrace(wxTRACE_WEBREQUEST, "Request %p: cancelling", this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    SetState(wxWebRequest::State_Cancelled);
 | 
					    SetState(wxWebRequest::State_Cancelled);
 | 
				
			||||||
    if ( m_request != NULL )
 | 
					    if ( m_request != NULL )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
@@ -403,6 +415,9 @@ wxWebResponseWinHTTP::wxWebResponseWinHTTP(wxWebRequestWinHTTP& request):
 | 
				
			|||||||
            !contentLengthStr.ToLongLong(&m_contentLength) )
 | 
					            !contentLengthStr.ToLongLong(&m_contentLength) )
 | 
				
			||||||
        m_contentLength = -1;
 | 
					        m_contentLength = -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    wxLogTrace(wxTRACE_WEBREQUEST, "Request %p: receiving %llu bytes",
 | 
				
			||||||
 | 
					               &request, m_contentLength);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Init();
 | 
					    Init();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -444,6 +459,8 @@ wxString wxWebResponseWinHTTP::GetStatusText() const
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
bool wxWebResponseWinHTTP::ReadData()
 | 
					bool wxWebResponseWinHTTP::ReadData()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    wxLogTrace(wxTRACE_WEBREQUEST, "Request %p: reading data", &m_request);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return ::WinHttpReadData
 | 
					    return ::WinHttpReadData
 | 
				
			||||||
             (
 | 
					             (
 | 
				
			||||||
                m_requestHandle,
 | 
					                m_requestHandle,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user