git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1077
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
{
DECLARE_CLASS(wxSocketHandler)
protected:
{
DECLARE_CLASS(wxSocketHandler)
protected:
- static wxSocketHandler *master;
#if defined(__WINDOWS__)
wxList *smsg_list;
struct wxSockHandlerInternal *internal;
#if defined(__WINDOWS__)
wxList *smsg_list;
struct wxSockHandlerInternal *internal;
public:
enum SockStatus { SOCK_NONE, SOCK_DATA, SOCK_CONNECT, SOCK_DISCONNECT,
SOCK_ERROR };
public:
enum SockStatus { SOCK_NONE, SOCK_DATA, SOCK_CONNECT, SOCK_DISCONNECT,
SOCK_ERROR };
+ static wxSocketHandler *master;
wxSocketHandler();
virtual ~wxSocketHandler();
wxSocketHandler();
virtual ~wxSocketHandler();
(wxSocketBase::wxSockFlags flags = wxSocketBase::NONE);
// Create or reuse a socket handler
(wxSocketBase::wxSockFlags flags = wxSocketBase::NONE);
// Create or reuse a socket handler
- static wxSocketHandler& Master()
- { return *((master) ? (master) : (master = new wxSocketHandler())); }
+ static wxSocketHandler& Master() { return *master; }
#if defined(WXSOCK_INTERNAL) && defined(__WINDOWS__)
#if defined(WXSOCK_INTERNAL) && defined(__WINDOWS__)
DECLARE_DYNAMIC_CLASS(wxURL)
protected:
static wxProtoInfo *g_protocols;
DECLARE_DYNAMIC_CLASS(wxURL)
protected:
static wxProtoInfo *g_protocols;
+ static wxHTTP *g_proxy;
wxProtoInfo *m_protoinfo;
wxProtocol *m_protocol;
wxHTTP m_proxy;
wxProtoInfo *m_protoinfo;
wxProtocol *m_protocol;
wxHTTP m_proxy;
bool FetchProtocol();
friend class wxProtoInfo;
bool FetchProtocol();
friend class wxProtoInfo;
+ friend class wxProtocolModule;
public:
wxURL(const wxString& url);
public:
wxURL(const wxString& url);
#include "wx/protocol/protocol.h"
#include "wx/url.h"
#include "wx/protocol/protocol.h"
#include "wx/url.h"
/////////////////////////////////////////////////////////////////
// wxProtoInfo
/////////////////////////////////////////////////////////////////
// wxProtoInfo
return wxPROTO_NOERR;
#undef PROTO_BSIZE
}
return wxPROTO_NOERR;
#undef PROTO_BSIZE
}
+
+// ----------------------------------------------------------------------
+// Module
+// ----------------------------------------------------------------------
+
+class wxProtocolModule: public wxModule {
+ DECLARE_DYNAMIC_CLASS(wxProtocolModule)
+public:
+ wxProtocolModule() {}
+ bool OnInit();
+ void OnExit();
+};
+
+#if !USE_SHARED_LIBRARY
+IMPLEMENT_DYNAMIC_CLASS(wxProtocolModule, wxModule)
+#endif
+
+bool wxProtocolModule::OnInit()
+{
+ wxURL::g_proxy = new wxHTTP();
+ return TRUE;
+}
+
+void wxProtocolModule::OnExit()
+{
+ delete wxURL::g_proxy;
+ wxURL::g_proxy = NULL;
+}
/////////////////////////////////////////////////////////////////////////////
// wxSocket headers
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// wxSocket headers
/////////////////////////////////////////////////////////////////////////////
#define WXSOCK_INTERNAL
#include "wx/sckaddr.h"
#include "wx/socket.h"
#define WXSOCK_INTERNAL
#include "wx/sckaddr.h"
#include "wx/socket.h"
// Some patch ///// END
/////////////////////////////////////////////////////////////////////////////
// Some patch ///// END
/////////////////////////////////////////////////////////////////////////////
+// --------------------------------------------------------------
+// Module
+// --------------------------------------------------------------
+class wxSocketModule: public wxModule {
+ DECLARE_DYNAMIC_CLASS(wxSocketModule)
+public:
+ wxSocketModule() {}
+ bool OnInit();
+ void OnExit();
+};
+
// --------------------------------------------------------------
// ClassInfos
// --------------------------------------------------------------
// --------------------------------------------------------------
// ClassInfos
// --------------------------------------------------------------
IMPLEMENT_CLASS(wxSocketClient, wxSocketBase)
IMPLEMENT_CLASS(wxSocketHandler, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxSocketEvent, wxEvent)
IMPLEMENT_CLASS(wxSocketClient, wxSocketBase)
IMPLEMENT_CLASS(wxSocketHandler, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxSocketEvent, wxEvent)
+IMPLEMENT_DYNAMIC_CLASS(wxSocketModule, wxModule)
#endif
class wxSockWakeUp : public wxTimer {
#endif
class wxSockWakeUp : public wxTimer {
+bool wxSocketModule::OnInit() {
+ wxSocketHandler::master = new wxSocketHandler();
+ return TRUE;
+}
+
+void wxSocketModule::OnExit() {
+ delete wxSocketHandler::master;
+ wxSocketHandler::master = NULL;
+}
+
// Protocols list
wxProtoInfo *wxURL::g_protocols = NULL;
// Protocols list
wxProtoInfo *wxURL::g_protocols = NULL;
/////////////////////////////////////////////////////////////////
// wxURL ////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// wxURL ////////////////////////////////////////////////////////
wxURL::wxURL(const wxString& url)
{
m_protocol = NULL;
wxURL::wxURL(const wxString& url)
{
m_protocol = NULL;
- if (g_proxy.IsConnected()) {
- m_protocol = &g_proxy;
+ if (g_proxy->IsConnected()) {
+ m_protocol = g_proxy;
m_protoname = "proxy";
m_path = url;
return;
m_protoname = "proxy";
m_path = url;
return;
void wxURL::SetDefaultProxy(const wxString& url_proxy)
{
void wxURL::SetDefaultProxy(const wxString& url_proxy)
{
if (url_proxy.IsNull())
return;
if (url_proxy.IsNull())
return;
addr.Hostname(hostname);
addr.Service(port);
addr.Hostname(hostname);
addr.Service(port);
+ g_proxy->Connect(addr);
}
void wxURL::SetProxy(const wxString& url_proxy)
}
void wxURL::SetProxy(const wxString& url_proxy)