Correct way to setup proxy of QNetworkAccessManager
-
Is this a correct way to setup the proxy?I found the proxies list at here, I only pick the proxy do not need password and username
QNetworkProxy proxy; proxy.setType(QNetworkProxy::HttpProxy); proxy.setHostName("82.207.118.163"); proxy.setPort(3128); manager->setProxy(proxy);
The manager can download the images(those links all start with http) and the speed become much slower compare with the cases without proxy setting(sounds like it really go through the proxy?), is this a correct sign?
If this is correct solution, how could I download/access websites with more than one proxy?
my pc->proxy A->proxy B
proxy B->proxy A->my pcIs this possible to be done by Qt5?Thanks
-
Hi,
You'd have to use several QNAM each with its own proxy.
-
No, i mean use several QNetworkAccessManager (guess based on your variable name) objects. And you change the proxy for each of them.
-
No, i mean use several QNetworkAccessManager (guess based on your variable name) objects. And you change the proxy for each of them.
@SGaist said in Correct way to setup proxy of QNetworkAccessManager:
No, i mean use several QNetworkAccessManager (guess based on your variable name) objects. And you change the proxy for each of them
According to the document of setProxy(QNetworkAccessManager)
the proxy to be used in future requests to be proxy. This does not affect requests that have already been sent.
I think It should be fine even I change the proxy every time I open a new request based on the doc?
-
IIRC, QNAM handles up to 6 request at the same time, the others are then queued and processed as soon as one finishes. So I don't know whether "sent" means also queued for later or just the currently working request.
-
IIRC, QNAM handles up to 6 request at the same time, the others are then queued and processed as soon as one finishes. So I don't know whether "sent" means also queued for later or just the currently working request.
@SGaist said in Correct way to setup proxy of QNetworkAccessManager:
IIRC, QNAM handles up to 6 request at the same time, the others are then queued and processed as soon as one finishes. So I don't know whether "sent" means also queued for later or just the currently working request.
I see, thanks for this info, it is fine with me, because I can queue the settings of proxies by myself.