Using a proxy for certain URL calls made by app
-
@Pablo-J.-Rogina When I downloaded qt-master/tests/auto/qnetworkproxyfactory/qnetworkproxyfactory.pro, and tried to look at it in Qt Creator, I got an error: Cannot find feature qttest_p4. What am I missing? What is qttest_p4 for? Thanks!
-
Hi,
@AtoZ said in Using a proxy for certain URL calls made by app:
qt-master
Where does that come from ?
-
Hi,
@AtoZ said in Using a proxy for certain URL calls made by app:
qt-master
Where does that come from ?
-
@AtoZ Try to comment out
load(qttest_p4)
in pro file.
Maybe you need to addCONFIG+=testcase
to the pro file instead.
-
@jsulm Thanks for your reply. After I comment out load(qttest_p4) and build again, I get unsolved externals issue. Adding CONFIG+=testcase does not solve the issue. I still miss some pieces. Can you please help again?
@AtoZ my suggestion was to look at the test code and figure out how the QNetworkProxyFactory is being used, not to run the test itself. I'm not sure but you may need to start one or two levels up for actually running the test(s)
-
@AtoZ my suggestion was to look at the test code and figure out how the QNetworkProxyFactory is being used, not to run the test itself. I'm not sure but you may need to start one or two levels up for actually running the test(s)
@Pablo-J.-Rogina Thanks for your tips and quick reply, Pablo. I'd like to see how test is done because it is hard to track network traffic, isn't it? The code you referred does give a good example on how to test a running networkproxyfactory, even if it does not build successfully because of missing libraries, I think.
-
@jsulm Thanks for your reply. After I comment out load(qttest_p4) and build again, I get unsolved externals issue. Adding CONFIG+=testcase does not solve the issue. I still miss some pieces. Can you please help again?
-
@jsulm @Pablo-J-Rogina Yes, you are right. I think QT += network testlib needs to be added in the .pro file. Since I realized there may be some missing pieces, I created a new unit test project in Qt Creator and migrated the tst_qnetworkproxyfactory code over, and then I was able to run it through Q Creator. Thanks for all your help. My next endeavor will be actually using qnetworkproxyfactory to direct networkflow to use proxy server for external http/s calls and not to use it for internal http/s calls. The project I am working on is a Q Quick project, which mostly built upon qml and javascript, so I am wondering where I should add the networkproxyfactory piece. Shall I create a subclass of qnetworkproxyfactory and use it in main.cpp (this is the way I am trying) or actually I have to modify and recompile network module (which I am trying to avoid) - because I am unsure of how to use qnetworkproxyfactory to track the http/https calls which are actually set in qml. Do you have any suggestions? Thanks again.
-
@jsulm @Pablo-J-Rogina Yes, you are right. I think QT += network testlib needs to be added in the .pro file. Since I realized there may be some missing pieces, I created a new unit test project in Qt Creator and migrated the tst_qnetworkproxyfactory code over, and then I was able to run it through Q Creator. Thanks for all your help. My next endeavor will be actually using qnetworkproxyfactory to direct networkflow to use proxy server for external http/s calls and not to use it for internal http/s calls. The project I am working on is a Q Quick project, which mostly built upon qml and javascript, so I am wondering where I should add the networkproxyfactory piece. Shall I create a subclass of qnetworkproxyfactory and use it in main.cpp (this is the way I am trying) or actually I have to modify and recompile network module (which I am trying to avoid) - because I am unsure of how to use qnetworkproxyfactory to track the http/https calls which are actually set in qml. Do you have any suggestions? Thanks again.
@AtoZ said in Using a proxy for certain URL calls made by app:
migrated the tst_qnetworkproxyfactory code over, and then I was able to run it through Q Creator
Glad you have advanced so far.
how to use qnetworkproxyfactory to track the http/https calls which are actually set in qml
May I suggest you open another post on its own since that question is slightly more specific (QML + proxies)?
-
@AtoZ said in Using a proxy for certain URL calls made by app:
migrated the tst_qnetworkproxyfactory code over, and then I was able to run it through Q Creator
Glad you have advanced so far.
how to use qnetworkproxyfactory to track the http/https calls which are actually set in qml
May I suggest you open another post on its own since that question is slightly more specific (QML + proxies)?
@Pablo-J.-Rogina Sure will do.