Mohammed Sameer wrote: >Hi, >I'm not sure whether this is the right list or not. Sorry if it's not.
It is. >Currently, QNetworkAccessManager allows setting a global proxy but what > if I wanted to use a different proxy per connection ? Set the proxy, send one request, then set another proxy, send another request. My goal for Qt 4.5 is to allow you to set a "proxy factory" class, so that you can determine which proxy to use based on the connection parameters (protocol, host and port). >My current use case is a browser that is using a PAC file to configure > the proxy. Which means that one might use a different proxy per > connection. Maybe even a different proxy per protocol (HTTP/HTTPS/FTP)! > >Any ideas how to implement this ? That's exactly what I want to solve in Qt 4.5. You keep the PAC script pre-parsed inside QtScript and you evaluate at every connection. Right you, you need to roll out your own solution. A simple way is to derive from QNetworkAccessManager and override the protected createRequest() function. You set the proxy on the manager before calling the base implementation of the function. >I can subclass QNetworkProxy and return a different proxy HostName but > the problem is that QNetworkProxy is not aware of the host we are > connecting to. QNetworkAccessManager::createRequest() is. -- Thiago José Macieira - thiago.macieira AT trolltech.com Trolltech ASA - Sandakerveien 116, NO-0402 Oslo, Norway
signature.asc
Description: This is a digitally signed message part.
