resolve missing last proxy in proxy detection

master
Marc Wäckerlin 16 years ago
parent 6a2e2031c1
commit ecfced822e
  1. 13
      proxyface/windoze.hxx

@ -11,11 +11,7 @@
#include <windows.h>
#include <winhttp.h>
#ifdef QT_NETWORK_LIB
#include <QtCore/QDebug> // debug
#else
#include <iostream> // debug
#endif
namespace proxy {
@ -54,14 +50,10 @@ namespace proxy {
throw exc::error();
std::wstring list(proxyInfo.lpszProxy);
#ifdef QT_NETWORK_LIB
qDebug()<<"LIST=\""<<proxyInfo.lpszProxy<<"\"";
#else
std::wcout<<"LIST=\""<<list<<"\""<<std::endl;
#endif
for (std::wstring::size_type oldpos(0), pos(0);
(pos=list.find(L";", oldpos))!=std::wstring::npos;
oldpos=++pos) {
(pos=list.find(L";", oldpos)), oldpos!=std::wstring::npos;
oldpos=(pos!=std::wstring::npos?pos+1:pos)) {
std::wstring proxy(list.substr(oldpos, pos-oldpos));
std::wstring port((oldpos=proxy.rfind(L":"))!=std::wstring::npos
?proxy.substr(oldpos+1):std::wstring());
@ -72,6 +64,7 @@ namespace proxy {
case WINHTTP_ACCESS_TYPE_DEFAULT_PROXY: type=DEFAULT; break;
case WINHTTP_ACCESS_TYPE_NAMED_PROXY: type=HTTP; break;
}
if (host.size()>0)
res.push_back(Proxy(type,
std::string(host.begin(), host.end()),
std::string(port.begin(), port.end())));

Loading…
Cancel
Save