Implement WinHTTP authentication
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
|
||||
class wxWebResponse;
|
||||
class wxWebSession;
|
||||
class wxWebAuthChallenge;
|
||||
|
||||
WX_DECLARE_STRING_HASH_MAP(wxString, wxWebRequestHeaderMap);
|
||||
|
||||
@@ -33,19 +34,12 @@ public:
|
||||
{
|
||||
State_Idle,
|
||||
State_Unauthorized,
|
||||
State_UnauthorizedProxy,
|
||||
State_Active,
|
||||
State_Completed,
|
||||
State_Failed,
|
||||
State_Cancelled
|
||||
};
|
||||
|
||||
enum CredentialTarget
|
||||
{
|
||||
CredentialTarget_Server,
|
||||
CredentialTarget_Proxy
|
||||
};
|
||||
|
||||
virtual ~wxWebRequest() { }
|
||||
|
||||
virtual void SetHeader(const wxString& name, const wxString& value)
|
||||
@@ -57,9 +51,6 @@ public:
|
||||
|
||||
void SetData(wxSharedPtr<wxInputStream> dataStream, const wxString& contentType, wxFileOffset dataSize = wxInvalidOffset);
|
||||
|
||||
void SetCredentials(const wxString& user, const wxString& password,
|
||||
CredentialTarget target);
|
||||
|
||||
void SetIgnoreServerErrorStatus(bool ignore) { m_ignoreServerErrorStatus = ignore; }
|
||||
|
||||
virtual void Start() = 0;
|
||||
@@ -68,6 +59,8 @@ public:
|
||||
|
||||
virtual wxWebResponse* GetResponse() = 0;
|
||||
|
||||
virtual wxWebAuthChallenge* GetAuthChallenge() const = 0;
|
||||
|
||||
int GetId() const { return m_id; }
|
||||
|
||||
State GetState() const { return m_state; }
|
||||
@@ -125,6 +118,30 @@ private:
|
||||
wxDECLARE_NO_COPY_CLASS(wxWebResponse);
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_NET wxWebAuthChallenge
|
||||
{
|
||||
public:
|
||||
enum Source
|
||||
{
|
||||
Source_Server,
|
||||
Source_Proxy
|
||||
};
|
||||
|
||||
virtual ~wxWebAuthChallenge() { }
|
||||
|
||||
Source GetSource() const { return m_source; }
|
||||
|
||||
virtual void SetCredentials(const wxString& user, const wxString& password) = 0;
|
||||
|
||||
protected:
|
||||
wxWebAuthChallenge(Source source): m_source(source) { }
|
||||
|
||||
private:
|
||||
Source m_source;
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(wxWebAuthChallenge);
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_NET wxWebSessionFactory
|
||||
{
|
||||
public:
|
||||
|
Reference in New Issue
Block a user