IP Aliasing with QWebView (Qt / C++)
Asked Answered
M

1

7

Let’s see if you can shed some light on my problem. [C++ with Qt 5.2, using Qt Creator]

Situation: I’ve got a PC with several local IP addresses assigned to the same interface (IP Aliases). The router has different configurations regarding bandwidth, NAT, connections, etc., for each local IP. I’m integrating this Local IP-switching to some Qt apps, in particular to an app that offers a nice browsing experience using QWebView.

What I need I : To be able to change which local IP QWebView uses to get its requests out.

The only thing I've managed to do -just a patch- is to use STUNNEL to map localhost ports to remote hosts through different local IPs, and using QNetworkProxy to make QWebView use those localhost ports as proxies. Thing is, for some reason proxying like this apparently spawns some problems: The user can't see several YouTuve videos, only seeing static background and "An error has occurred". This doesn't happen when using NetworkProxyFactory::setUseSystemConfiguration(true), as every video can be seen perfectly.

The question would be: How can I manage IP aliases with Qt? If that's not possible, do you have any idea why proxying through STUNNEL is failing? Maybe other transparent tunneling software to try out?

In input is appreciated. Thanks in advance!

Mosra answered 22/1, 2014 at 16:24 Comment(4)
IIRC plugins (e.g. video playback, flash, etc.) may ignore routing/proxy settings. Thats why flash and Co. can nullify anonymizing techniques. They may try to use the global device route instead of your application wide setting.Education
That's actually very helpful regarding one of my issues, thank you!Mosra
@Mosra Check: #8024180, #20801350, qt-project.org/forums/viewthread/34849, serverfault.com/questions/542530/ip-alias-and-port-bridgingGreaser
@KhaledAKhunaifer I don't really see how any of those question has anything to do with this one. Maybe the last one a little, but doesn't really help. Are you human?Mosra
U
2

QWebView using QNetworkAccessManager to deal with requests/responses. Only useful thing you can override is a virtual

QNetworkReply * QNetworkAccessManager::createRequest(Operation op, 
const QNetworkRequest & req, QIODevice * outgoingData = 0) [virtual protected]

which unfortunately is not really useful for your purposes..

As well I don't think the Bearer thing will work either.

So, depending on how bad you need this functionality I would look into making changes in QNetworkAccessManager to be able to pass list of allowed interfaces/ip addresses, so QTcpSocket it will bind itself to specified IP address.. and then set this AccessManager to WebView.

As far as I know specifying bind address is not supported for QNetworkAccessManager

Undertrick answered 16/5, 2014 at 13:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.