7#ifndef QT_NO_NETWORKPROXY
9#include <QtCore/QByteArray>
10#include <QtCore/QMutex>
11#include <QtCore/QSemaphore>
13#include <QtCore/private/qeventdispatcher_unix_p.h>
14#include <QtCore/private/qthread_p.h>
38 sym = dlsym(RTLD_DEFAULT,
"_ZTVN8libproxy19pacrunner_extensionE");
43 sym = dlsym(RTLD_DEFAULT,
"mm_info_ignore_hostname");
46 return sym !=
nullptr;
68 pxProxyFactory *factory;
83 factory = px_proxy_factory_new();
91 requestInterruption();
95 px_proxy_factory_free(factory);
121 data.replyReady.acquire();
124 data.proxies = px_proxy_factory_get_proxies(factory,
data.url);
130 for (
int i = 0;
data.proxies[
i];
i++) {
132 free(
data.proxies[
i]);
141 factory = px_proxy_factory_new();
146 if (isInterruptionRequested())
148 request->proxies = px_proxy_factory_get_proxies(factory, request->url);
149 request->replyReady.release();
152 px_proxy_factory_free(factory);
160 QNetworkProxy::Capabilities requiredCapabilities(0);
161 switch (
query.queryType()) {
184 const QList<QUrl> rawProxies = libProxyWrapper()->getProxies(queryUrl);
186 bool haveDirectConnection =
false;
187 for (
const QUrl&
url : rawProxies) {
190 if (scheme ==
"http"_L1) {
192 }
else if (scheme ==
"socks"_L1 || scheme ==
"socks5"_L1) {
194 }
else if (scheme ==
"ftp"_L1) {
196 }
else if (scheme ==
"direct"_L1) {
198 haveDirectConnection =
true;
214 if (proxyList.
isEmpty() || !haveDirectConnection)
222#include "qnetworkproxy_libproxy.moc"
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
QList< QUrl > getProxies(const QUrl &url)
bool isEmpty() const noexcept
void append(parameter_type t)
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...
The QNetworkProxyQuery class is used to query the proxy settings for a socket.
The QNetworkProxy class provides a network layer proxy.
ProxyType
This enum describes the types of network proxying provided in Qt.
Capabilities capabilities() const
void acquire(int n=1)
Tries to acquire n resources guarded by the semaphore.
void release(int n=1)
Releases n resources guarded by the semaphore.
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString url(FormattingOptions options=FormattingOptions(PrettyDecoded)) const
Returns a string representation of the URL.
QString userName(ComponentFormattingOptions options=FullyDecoded) const
Returns the user name of the URL if it is defined; otherwise an empty string is returned.
QString host(ComponentFormattingOptions=FullyDecoded) const
Returns the host of the URL if it is defined; otherwise an empty string is returned.
QByteArray toEncoded(FormattingOptions options=FullyEncoded) const
Returns the encoded representation of the URL if it's valid; otherwise an empty QByteArray is returne...
QString password(ComponentFormattingOptions=FullyDecoded) const
Returns the password of the URL if it is defined; otherwise an empty string is returned.
QString scheme() const
Returns the scheme of the URL.
void setScheme(const QString &scheme)
Sets the scheme of the URL to scheme.
void setHost(const QString &host, ParsingMode mode=DecodedMode)
Sets the host of the URL to host.
int port(int defaultPort=-1) const
static QUrl fromEncoded(QByteArrayView input, ParsingMode mode=TolerantMode)
Parses input and returns the corresponding QUrl.
void setPort(int port)
Sets the port of the URL to port.
Combined button and popup list for selecting options.
#define Q_GLOBAL_STATIC(TYPE, NAME,...)
static bool isThreadingNeeded()
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
#define QStringLiteral(str)
Q_CHECK_PTR(a=new int[80])
QUrl url("example.com")
[constructor-url-reference]