Apply the current proxy prefs to the shared wxWebSession. wxWebProxy / wxWebSession::SetProxy are wx 3.3+ only. On wx 3.2 there is no programmatic way to set a proxy on wxWebRequest, so we rely on the backend defaults: on Linux wxWebRequest is backed by libcurl, which honours the standard http_proxy / https_proxy / all_proxy environment variables. Users of the aMule Proxy pref on wx 3.2 are no wo
| 170 | // wx 3.3's wxWebProxy is HTTP-only. A libcurl backend would be required if |
| 171 | // SOCKS support mattered — that is out of scope for this fix. |
| 172 | static void ApplyProxyToDefaultSession() |
| 173 | { |
| 174 | #if wxCHECK_VERSION(3, 3, 0) |
| 175 | wxWebSession& session = wxWebSession::GetDefault(); |
| 176 | const CProxyData* pd = thePrefs::GetProxyData(); |
| 177 | if (!pd || !pd->m_proxyEnable || pd->m_proxyType == PROXY_NONE) { |
| 178 | session.SetProxy(wxWebProxy::FromURL(wxString())); // clear |
| 179 | return; |
| 180 | } |
| 181 | if (pd->m_proxyType != PROXY_HTTP) { |
| 182 | AddDebugLogLineN(logHTTP, "wxWebRequest: SOCKS proxies are not supported; startup HTTP will be made direct."); |
| 183 | session.SetProxy(wxWebProxy::FromURL(wxString())); |
| 184 | return; |
| 185 | } |
| 186 | wxString url; |
| 187 | if (pd->m_enablePassword && !pd->m_userName.IsEmpty()) { |
| 188 | url = CFormat("http://%s:%s@%s:%u") |
| 189 | % pd->m_userName % pd->m_password |
| 190 | % pd->m_proxyHostName % pd->m_proxyPort; |
| 191 | } else { |
| 192 | url = CFormat("http://%s:%u") |
| 193 | % pd->m_proxyHostName % pd->m_proxyPort; |
| 194 | } |
| 195 | session.SetProxy(wxWebProxy::FromURL(url)); |
| 196 | #endif |
| 197 | } |
| 198 | |
| 199 | |
| 200 | CHTTPDownloadThread::CHTTPDownloadThread(const wxString& url, const wxString& filename, const wxString& oldfilename, HTTP_Download_File file_id, |
no test coverage detected