Add wxWebSession::GetLibraryVersionInfo()
This commit is contained in:
@@ -115,6 +115,8 @@ public:
|
||||
|
||||
wxWebRequest* CreateRequest(const wxString& url, int id = wxID_ANY) wxOVERRIDE;
|
||||
|
||||
wxVersionInfo GetLibraryVersionInfo() wxOVERRIDE;
|
||||
|
||||
HINTERNET GetHandle() const { return m_handle; }
|
||||
|
||||
private:
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#include "wx/sharedptr.h"
|
||||
#include "wx/stream.h"
|
||||
#include "wx/vector.h"
|
||||
#include "wx/versioninfo.h"
|
||||
|
||||
class wxWebResponse;
|
||||
class wxWebSession;
|
||||
@@ -223,6 +224,8 @@ public:
|
||||
|
||||
virtual wxWebRequest* CreateRequest(const wxString& url, int id = wxID_ANY) = 0;
|
||||
|
||||
virtual wxVersionInfo GetLibraryVersionInfo() = 0;
|
||||
|
||||
virtual void SetHeader(const wxString& name, const wxString& value)
|
||||
{ m_headers[name] = value; }
|
||||
|
||||
|
@@ -116,6 +116,8 @@ public:
|
||||
|
||||
wxWebRequest* CreateRequest(const wxString& url, int id = wxID_ANY) wxOVERRIDE;
|
||||
|
||||
wxVersionInfo GetLibraryVersionInfo() wxOVERRIDE;
|
||||
|
||||
bool StartRequest(wxWebRequestCURL& request);
|
||||
|
||||
void CancelRequest(wxWebRequestCURL* request);
|
||||
|
@@ -484,6 +484,12 @@ public:
|
||||
*/
|
||||
wxWebRequest* CreateRequest(const wxString& url, int id = wxID_ANY);
|
||||
|
||||
/**
|
||||
Retrieve the version information about the implementation library used
|
||||
by this session.
|
||||
*/
|
||||
virtual wxVersionInfo GetLibraryVersionInfo();
|
||||
|
||||
/**
|
||||
Sets a request header in every wxWebRequest created from this session
|
||||
after is has been set.
|
||||
|
@@ -165,6 +165,8 @@ public:
|
||||
|
||||
CreateStatusBar();
|
||||
|
||||
GetStatusBar()->SetStatusText(wxWebSession::GetDefault().GetLibraryVersionInfo().ToString());
|
||||
|
||||
m_downloadProgressTimer.Bind(wxEVT_TIMER,
|
||||
&WebRequestFrame::OnProgressTimer, this);
|
||||
|
||||
|
@@ -479,6 +479,19 @@ void wxWebSessionCURL::CancelRequest(wxWebRequestCURL* request)
|
||||
m_cancelledRequests.push_back(wxObjectDataPtr<wxWebRequestCURL>(request));
|
||||
}
|
||||
|
||||
wxVersionInfo wxWebSessionCURL::GetLibraryVersionInfo()
|
||||
{
|
||||
const curl_version_info_data* vi = curl_version_info(CURLVERSION_NOW);
|
||||
wxString desc = wxString::Format("libcurl/%s", vi->version);
|
||||
if (vi->ssl_version[0])
|
||||
desc += " " + wxString(vi->ssl_version);
|
||||
return wxVersionInfo("libcurl",
|
||||
vi->version_num >> 16 & 0xff,
|
||||
vi->version_num >> 8 & 0xff,
|
||||
vi->version_num & 0xff,
|
||||
desc);
|
||||
}
|
||||
|
||||
// static
|
||||
void wxWebSessionCURL::InitializeCURL()
|
||||
{
|
||||
|
@@ -524,4 +524,12 @@ wxWebRequest* wxWebSessionWinHTTP::CreateRequest(const wxString& url, int id)
|
||||
return new wxWebRequestWinHTTP(id, *this, url);
|
||||
}
|
||||
|
||||
wxVersionInfo wxWebSessionWinHTTP::GetLibraryVersionInfo()
|
||||
{
|
||||
int verMaj, verMin, verMicro;
|
||||
wxGetOsVersion(&verMaj, &verMin, &verMicro);
|
||||
return wxVersionInfo("WinHTTP", verMaj, verMin, verMicro);
|
||||
}
|
||||
|
||||
|
||||
#endif // wxUSE_WEBREQUEST_WINHTTP
|
||||
|
Reference in New Issue
Block a user