QNetworkProxy
-
Hello
I just don't know what I do wrong, when I tried to use QNetworkProxy
I have a QTcpSockets
And I have a QNetworkProxy
Sometimes (when settings was changed) I do this
@m_networkProxy.setType(QNetworkProxy::HttpProxy);
m_networkProxy.setHostName(proxyAddress);
m_networkProxy.setPort(proxyPort);
if (proxyAuthEnabled)
{
m_networkProxy.setUser(proxyUser);
m_networkProxy.setPassword(proxyPassword);
}
else
{
m_networkProxy.setUser("");
m_networkProxy.setPassword("");
}
QNetworkProxy::setApplicationProxy(m_networkProxy);@
But for proxy with authorization - authorization doesn't work ( -
If you work with QTcpSockets, you will probably have to use a SOCKS5 proxy.
An HTTP proxy is only for use with QNetworkAccessManager, as it is a protocol proxy.
Are you really sure, you work with QTcpSocket?
-
Of course I'm sure. I transfering valid http trafic over QTcpSocket.
-
Then, as I wrote, QNetworkProxy::HttpProxy is probably the wrong type of proxy for you. You can use it, but the proxy you connect to must support the CONNECT protocol.
If the connect fails, what is the output of the sockets "error() ":http://doc.qt.nokia.com/4.7/qabstractsocket.html#error method?
-
But, when I'll use the Socks5 - not all proxy servers supports Socks5
-
So it is.
You provide us nearly no information about what you're doing and expect a solution?
-
I'm making a simple proxy (very simple, without auth., etc), which connect browser and remote server.
I have QTcpServer. When new connection came - create a QTcpSocket to remote host (from parsed header).
And I need to add support of external proxy (browser - my_proxy - external_proxy - remote_server)
Till I work with external proxies, without auth. - the QNetworkProxy(HttpProtocol mode) works fine, but when the auth requestes it just doesn't work.
I thank I need to make proxy support manually... )= -
If the connect fails, what is the output of the sockets error() [doc.qt.nokia.com] method?
QAbstractSocket::ProxyConnectionClosedError
"Proxy connection closed prematurely"