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>
15#include <QtCore/qapplicationstatic.h>
39 sym = dlsym(RTLD_DEFAULT,
"_ZTVN8libproxy19pacrunner_extensionE");
44 sym = dlsym(RTLD_DEFAULT,
"mm_info_ignore_hostname");
47 return sym !=
nullptr;
69 pxProxyFactory *factory;
84 factory = px_proxy_factory_new();
92 requestInterruption();
96 px_proxy_factory_free(factory);
122 data.replyReady.acquire();
125 data.proxies = px_proxy_factory_get_proxies(factory,
data.url);
131 for (
int i = 0;
data.proxies[
i];
i++) {
133 free(
data.proxies[
i]);
142 factory = px_proxy_factory_new();
147 if (isInterruptionRequested())
149 request->proxies = px_proxy_factory_get_proxies(factory, request->url);
153 px_proxy_factory_free(factory);
158 QList<QNetworkProxy> proxyList;
161 QNetworkProxy::Capabilities requiredCapabilities(0);
162 switch (
query.queryType()) {
165 queryUrl =
query.url();
169 if (queryUrl.scheme().isEmpty())
171 queryUrl.setHost(
query.peerHostName());
172 queryUrl.setPort(
query.peerPort());
176 if (queryUrl.scheme().isEmpty())
178 queryUrl.setHost(
query.peerHostName());
179 queryUrl.setPort(
query.peerPort());
187 const QList<QUrl> rawProxies = libProxyWrapper()->getProxies(queryUrl);
189 bool haveDirectConnection =
false;
190 for (
const QUrl&
url : rawProxies) {
193 if (scheme ==
"http"_L1) {
195 }
else if (scheme ==
"socks"_L1 || scheme ==
"socks5"_L1) {
197 }
else if (scheme ==
"ftp"_L1) {
199 }
else if (scheme ==
"direct"_L1) {
201 haveDirectConnection =
true;
213 proxyList.append(
proxy);
217 if (proxyList.isEmpty() || !haveDirectConnection)
225#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)
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 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.
int port(int defaultPort=-1) const
static QUrl fromEncoded(QByteArrayView input, ParsingMode mode=TolerantMode)
Parses input and returns the corresponding QUrl.
Combined button and popup list for selecting options.
#define Q_APPLICATION_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]
QItemEditorFactory * factory