- wxIPV4address addr;
- wxInputStream *the_i_stream = NULL;
-
- if (!m_protocol)
- if (!ParseURL())
- return NULL;
-
- if (!m_protocol) {
- m_error = wxURL_NOPROTO;
- return NULL;
- }
-
- m_error = wxURL_NOERR;
- if (m_user != _T("")) {
- m_protocol->SetUser(m_user);
- m_protocol->SetPassword(m_password);
- }
-
- if (m_protoinfo->m_needhost) {
- if (!addr.Hostname(m_hostname)) {
- m_error = wxURL_NOHOST;
- return NULL;
+ if ( !url_proxy )
+ {
+ if ( ms_proxyDefault )
+ {
+ ms_proxyDefault->Close();
+ delete ms_proxyDefault;
+ ms_proxyDefault = NULL;
+ }
+ }
+ else
+ {
+ wxString tmp_str = url_proxy;
+ int pos = tmp_str.Find(wxT(':'));
+ if (pos == wxNOT_FOUND)
+ return;
+
+ wxString hostname = tmp_str(0, pos),
+ port = tmp_str(pos+1, tmp_str.length()-pos);
+ wxIPV4address addr;
+
+ if (!addr.Hostname(hostname))
+ return;
+ if (!addr.Service(port))
+ return;
+
+ if (ms_proxyDefault)
+ // Finally, when all is right, we connect the new proxy.
+ ms_proxyDefault->Close();
+ else
+ ms_proxyDefault = new wxHTTP();
+ ms_proxyDefault->Connect(addr, true); // Watcom needs the 2nd arg for some reason