44 #ifndef QT_NO_NETWORKPROXY 55 #include <private/qsystemlibrary_p.h> 93 #define WINHTTP_AUTOPROXY_AUTO_DETECT 0x00000001 94 #define WINHTTP_AUTOPROXY_CONFIG_URL 0x00000002 96 #define WINHTTP_AUTO_DETECT_TYPE_DHCP 0x00000001 97 #define WINHTTP_AUTO_DETECT_TYPE_DNS_A 0x00000002 99 #define WINHTTP_ACCESS_TYPE_DEFAULT_PROXY 0 100 #define WINHTTP_ACCESS_TYPE_NO_PROXY 1 101 #define WINHTTP_ACCESS_TYPE_NAMED_PROXY 3 103 #define WINHTTP_NO_PROXY_NAME NULL 104 #define WINHTTP_NO_PROXY_BYPASS NULL 106 #define WINHTTP_ERROR_BASE 12000 107 #define ERROR_WINHTTP_LOGIN_FAILURE (WINHTTP_ERROR_BASE + 15) 108 #define ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT (WINHTTP_ERROR_BASE + 167) 109 #define ERROR_WINHTTP_AUTODETECTION_FAILED (WINHTTP_ERROR_BASE + 180) 114 typedef HINTERNET (WINAPI *
PtrWinHttpOpen)(LPCWSTR, DWORD, LPCWSTR, LPCWSTR,DWORD);
118 typedef SC_HANDLE (WINAPI *
PtrOpenSCManager)(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess);
119 typedef BOOL (WINAPI *
PtrEnumServicesStatusEx)(SC_HANDLE hSCManager,
SC_ENUM_TYPE InfoLevel, DWORD dwServiceType, DWORD dwServiceState, LPBYTE lpServices, DWORD cbBufSize, LPDWORD pcbBytesNeeded,
120 LPDWORD lpServicesReturned, LPDWORD lpResumeHandle, LPCWSTR pszGroupName);
142 ULONG nbServices = 0;
147 bool foundService =
false;
149 DWORD currProcId = GetCurrentProcessId();
150 for (ULONG i = 0; i < nbServices && !foundService; i++) {
151 if (info[i].ServiceStatusProcess.dwProcessId == currProcId)
170 if (semicolon != -1 && (end == -1 || semicolon < end))
174 if (start != source.
length())
179 list.
append(source.
mid(start, end - start));
193 bool isIpAddress = ipAddress.
setAddress(host);
200 foreach (
const QString &entry, bypassList) {
231 QNetworkProxy::Capabilities requiredCaps;
259 for (
int i=0; i < result.
count(); i++) {
289 foreach (
const QString &entry, proxyList) {
299 scheme = protocolTag = entry.
leftRef(pos);
304 scheme = entry.
midRef(server, pos - server);
328 if (!ok || value > 65535)
341 if (checkTags && taggedProxies.
contains(requiredTag)) {
355 for (
int i = 0; i < result.
count(); i++) {
356 if (httpProxy == result.
at(i))
528 DWORD getProxyError = GetLastError();
530 if (!getProxySucceeded
545 getProxyError = GetLastError();
549 if (!getProxySucceeded
558 getProxyError = GetLastError();
561 if (!getProxySucceeded
568 if (getProxySucceeded) {
static QString fromWCharArray(const wchar_t *, int size=-1)
Returns a copy of the string, where the encoding of string depends on the size of wchar...
QNetworkProxy::ProxyType type() const
Returns the proxy type for this instance.
QBool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
#define WINHTTP_NO_PROXY_NAME
static QList< QNetworkProxy > filterProxyListByCapabilities(const QList< QNetworkProxy > &proxyList, const QNetworkProxyQuery &query)
QString toString() const
Returns a copy of the string reference as a QString object.
static QList< QNetworkProxy > parseServerList(const QNetworkProxyQuery &query, const QStringList &proxyList)
static mach_timebase_info_data_t info
static PtrEnumServicesStatusEx ptrEnumServicesStatusEx
#define QT_END_NAMESPACE
This macro expands to.
QHostAddress ip() const
This function returns one IPv4 or IPv6 address found, that was found in a network interface...
The QMutex class provides access serialization between threads.
LPCWSTR lpszAutoConfigUrl
static QStringList splitSpaceSemicolon(const QString &source)
static PtrCloseServiceHandle ptrCloseServiceHandle
BOOL(WINAPI * PtrWinHttpGetProxyForUrl)(HINTERNET, LPCWSTR, WINHTTP_AUTOPROXY_OPTIONS *, WINHTTP_PROXY_INFO *)
The QRegExp class provides pattern matching using regular expressions.
QString toString(FormattingOptions options=None) const
Returns the human-displayable string representation of the URL.
static PtrWinHttpCloseHandle ptrWinHttpCloseHandle
QString peerHostName() const
Returns the host name or IP address being of the outgoing connection being requested, or an empty string if the remote hostname is not known.
int length() const
Returns the number of characters in this string.
BOOL(WINAPI * PtrWinHttpCloseHandle)(HINTERNET)
#define SC_MANAGER_ENUMERATE_SERVICE
static QList< QNetworkProxy > systemProxyForQuery(const QNetworkProxyQuery &query=QNetworkProxyQuery())
This function takes the query request, query, examines the details of the type of socket or request a...
#define WINHTTP_AUTOPROXY_AUTO_DETECT
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
BOOL(WINAPI * PtrEnumServicesStatusEx)(SC_HANDLE hSCManager, SC_ENUM_TYPE InfoLevel, DWORD dwServiceType, DWORD dwServiceState, LPBYTE lpServices, DWORD cbBufSize, LPDWORD pcbBytesNeeded, LPDWORD lpServicesReturned, LPDWORD lpResumeHandle, LPCWSTR pszGroupName)
int count(const T &t) const
Returns the number of occurrences of value in the list.
The QUrl class provides a convenient interface for working with URLs.
The QString class provides a Unicode character string.
The QHash class is a template class that provides a hash-table-based dictionary.
bool load(bool onlySystemDirectory=true)
bool contains(const Key &key) const
Returns true if the hash contains an item with the key; otherwise returns false.
#define WINHTTP_AUTO_DETECT_TYPE_DHCP
const T value(const Key &key) const
Returns the value associated with the key.
static QList< QNetworkProxy > removeDuplicateProxies(const QList< QNetworkProxy > &proxyList)
static bool currentProcessIsService()
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
QList< QNetworkProxy > defaultResult
QStringRef leftRef(int n) const Q_REQUIRED_RESULT
Returns a substring reference to the n leftmost characters of the string.
SC_HANDLE(WINAPI * PtrOpenSCManager)(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess)
static bool isBypassed(const QString &host, const QStringList &bypassList)
#define WINHTTP_ACCESS_TYPE_NAMED_PROXY
BOOL(WINAPI * PtrWinHttpGetIEProxyConfigForCurrentUser)(WINHTTP_CURRENT_USER_IE_PROXY_CONFIG *)
WINHTTP_AUTOPROXY_OPTIONS autoProxyOptions
The QNetworkProxy class provides a network layer proxy.
QueryType queryType() const
Returns the query type.
void append(const T &t)
Inserts value at the end of the list.
#define ERROR_WINHTTP_AUTODETECTION_FAILED
#define QT_BEGIN_NAMESPACE
This macro expands to.
QString protocolTag() const
Returns the protocol tag for this QNetworkProxyQuery object, or an empty QString in case the protocol...
Capabilities capabilities() const
Returns the capabilities of this proxy server.
HINTERNET(WINAPI * PtrWinHttpOpen)(LPCWSTR, DWORD, LPCWSTR, LPCWSTR, DWORD)
#define WINHTTP_ACCESS_TYPE_NO_PROXY
QStringList proxyServerList
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
static QPair< QHostAddress, int > parseSubnet(const QString &subnet)
Parses the IP and subnet information contained in subnet and returns the network prefix for that netw...
#define Q_GLOBAL_STATIC(TYPE, NAME)
Declares a global static variable with the given type and name.
void prepend(const T &t)
Inserts value at the beginning of the list.
const T & at(int i) const
Returns the item at index position i in the list.
The QStringList class provides a list of strings.
bool isEmpty() const
Returns true if the string reference has no characters; otherwise returns false.
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
#define SC_MANAGER_CONNECT
#define WINHTTP_AUTO_DETECT_TYPE_DNS_A
static PtrOpenSCManager ptrOpenSCManager
void clear()
Removes all items from the list.
BOOL fAutoLogonIfChallenged
BOOL(WINAPI * PtrWinHttpGetDefaultProxyConfiguration)(WINHTTP_PROXY_INFO *)
bool isInSubnet(const QHostAddress &subnet, int netmask) const
Returns true if this IP is in the subnet described by the network prefix subnet and netmask netmask...
The QStringRef class provides a thin wrapper around QString substrings.
#define ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT
The QNetworkProxyQuery class is used to query the proxy settings for a socket.
#define TRUE
Synonym for true.
QStringRef midRef(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a substring reference to n characters of this string, starting at the specified position...
BOOL(WINAPI * PtrCloseServiceHandle)(SC_HANDLE hSCObject)
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
static QAuServer & server()
QString scheme() const
Returns the scheme of the URL.
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
void * resolve(const char *symbol)
static PtrWinHttpGetDefaultProxyConfiguration ptrWinHttpGetDefaultProxyConfiguration
void setAddress(quint32 ip4Addr)
Set the IPv4 address specified by ip4Addr.
static QList< QNetworkInterface > allInterfaces()
Returns a listing of all the network interfaces found on the host machine.
T & last()
Returns a reference to the last item in the list.
quint16 port() const
Returns the port of the proxy host.
uint toUInt(bool *ok=0, int base=10) const
Returns the string converted to an unsigned int using base base, which is 10 by default and must be b...
if(void) toggleToolbarShown
void setScheme(const QString &scheme)
Sets the scheme of the URL to scheme.
QUrl url() const
Returns the URL component of this QNetworkProxyQuery object in case of a query of type QNetworkProxyQ...
bool exactMatch(const QString &str) const
Returns true if str is matched exactly by this regular expression; otherwise returns false...
#define WINHTTP_AUTOPROXY_CONFIG_URL
static PtrWinHttpOpen ptrWinHttpOpen
The QNetworkInterface class provides a listing of the host's IP addresses and network interfaces...
The QHostAddress class provides an IP address.
#define WINHTTP_NO_PROXY_BYPASS
static PtrWinHttpGetIEProxyConfigForCurrentUser ptrWinHttpGetIEProxyConfigForCurrentUser
static const KeyPair *const end
enum _SC_ENUM_TYPE SC_ENUM_TYPE
#define ERROR_WINHTTP_LOGIN_FAILURE
QList< QNetworkAddressEntry > addressEntries() const
Returns the list of IP addresses that this interface possesses along with their associated netmasks a...
static PtrWinHttpGetProxyForUrl ptrWinHttpGetProxyForUrl
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
The QNetworkAddressEntry class stores one IP address supported by a network interface, along with its associated netmask and broadcast address.
int prefixLength() const
Returns the prefix length of this IP address.
ProxyType
This enum describes the types of network proxying provided in Qt.
const ushort * utf16() const
Returns the QString as a '\0\'-terminated array of unsigned shorts.
QString hostName() const
Returns the host name of the proxy host.