Forgot to mention, this issue also affects Twitter online account. I can only get a blank page when I chose to add the Twitter account, without no any prompt/warnings.
My Analysis
----------------
1. I change loglevel of signond.conf and see the following from log:
Oct 10 10:46:01 kitt signonpluginprocess: plugin.cpp 126 userActionFinished :
Oct 10 10:46:01 kitt signonpluginprocess: oauth2plugin.cpp 310 userActionFinished :
Oct 10 10:46:01 kitt signonpluginprocess: oauth2plugin.cpp 323 userActionFinished : "https://wiki.ubuntu.com/?code=4/PMaxsE1yzBrszLJyMbF0gyYhX_Sx.ouuTe7vG4m0XEnp6UAPFm0EAeYdAgwI"
Oct 10 10:46:01 kitt signonpluginprocess: oauth2plugin.cpp 566 sendOAuth2PostRequest :
Oct 10 10:46:01 kitt signonpluginprocess: oauth2plugin.cpp 575 sendOAuth2PostRequest : Query string = "grant_type=authorization_code&client_id=759250720802-4sii0me9963n9fdqdmi7cepn6ub8luoh.apps.googleusercontent.com&client_secret=juFngKUcuhB7IRQqHtSLavqJ&code=4/PMaxsE1yzBrszLJyMbF0gyYhX_Sx.ouuTe7vG4m0XEnp6UAPFm0EAeYdAgwI&redirect_uri=https://wiki.ubuntu.com/"
Oct 10 10:46:01 kitt signonpluginprocess: ../../../../src/remotepluginprocess/remotepluginprocess.cpp 496 startTask operation is completed
After quite a whie:
Oct 10 10:51:06 kitt signonpluginprocess: base-plugin.cpp 151 handleNetworkError : error signal received: 99
Oct 10 10:51:06 kitt signonpluginprocess: ../../../../src/remotepluginprocess/remotepluginprocess.cpp 425 disableCancelThread Before the isFinished loop
Oct 10 10:51:06 kitt signonpluginprocess: ../../../../src/remotepluginprocess/remotepluginprocess.cpp 430 disableCancelThread Internal iteration 0
Oct 10 10:51:06 kitt signonpluginprocess: ../../../../src/remotepluginprocess/remotepluginprocess.cpp 249 error error is sent 307 "Connection to proxy closed prematurely"
Oct 10 10:51:06 kitt signonpluginprocess: base-plugin.cpp 133 onPostFinished : Finished signal received
So it appears the proxy isn't correctly used. But I did set the proxy correctly and the previous steps can go on well. Also I can succeed in adding Facebook account.
2. I added some logging in plugin.cpp and oauth2plugin.cpp and found the proxy in the QNetworkAccessManager is correctly:
proxy.foobar.com:3128. So it's really strange the connection cannot reach when proxy is correctly set. I tried to use Wireshark to see what happened but it's HTTPS so it's difficulty to do.
3. Then I accidentally commented the line in plugin.cpp:
void Plugin::process(const SignOn::SessionData &inData, ...)
{
...
//m_networkAccessManager->setProxy(networkProxy);
impl->setNetworkAccessManager(m_networkAccessManager);
...
}
And found it worked! Both Google account and Twitter account are added.
4. From my experiences, I believe it's due to HTTPS over HTTP proxy. In my company HTTPS should go to HTTPS proxy (https://proxy.foobar.com:3128).
From the code in Plugin::process, the proxy is set to QNetworkProxy::applicationProxy():
The signonpluginprocess has application proxy set, and it's a proxy factory. This means the HTTPS proxy will be selected if you make an HTTPS request.
5. My Fix
So I propose a fix for this issue. I'd like to set the proxy in plugin to the default proxy, which will pick up the application proxy factory, instead of selecting a steady HTTP proxy. I still keep the proxy override for parameters. Can you help to verify and merge it if necessary?
Forgot to mention, this issue also affects Twitter online account. I can only get a blank page when I chose to add the Twitter account, without no any prompt/warnings.
My Analysis
----------------
1. I change loglevel of signond.conf and see the following from log:
Oct 10 10:46:01 kitt signonpluginpro cess: plugin.cpp 126 userActionFinished : cess: oauth2plugin.cpp 310 userActionFinished : cess: oauth2plugin.cpp 323 userActionFinished : "https:/ /wiki.ubuntu. com/?code= 4/PMaxsE1yzBrsz LJyMbF0gyYhX_ Sx.ouuTe7vG4m0X Enp6UAPFm0EAeYd AgwI" cess: oauth2plugin.cpp 566 sendOAuth2PostR equest : cess: oauth2plugin.cpp 575 sendOAuth2PostR equest : Query string = "grant_ type=authorizat ion_code& client_ id=759250720802 -4sii0me9963n9f dqdmi7cepn6ub8l uoh.apps. googleuserconte nt.com& client_ secret= juFngKUcuhB7IRQ qHtSLavqJ& code=4/ PMaxsE1yzBrszLJ yMbF0gyYhX_ Sx.ouuTe7vG4m0X Enp6UAPFm0EAeYd AgwI&redirect_ uri=https:/ /wiki.ubuntu. com/" cess: ../../. ./../src/ remotepluginpro cess/remoteplug inprocess. cpp 496 startTask operation is completed
Oct 10 10:46:01 kitt signonpluginpro
Oct 10 10:46:01 kitt signonpluginpro
Oct 10 10:46:01 kitt signonpluginpro
Oct 10 10:46:01 kitt signonpluginpro
Oct 10 10:46:01 kitt signonpluginpro
After quite a whie:
Oct 10 10:51:06 kitt signonpluginpro cess: base-plugin.cpp 151 handleNetworkError : error signal received: 99 cess: ../../. ./../src/ remotepluginpro cess/remoteplug inprocess. cpp 425 disableCancelThread Before the isFinished loop cess: ../../. ./../src/ remotepluginpro cess/remoteplug inprocess. cpp 430 disableCancelThread Internal iteration 0 cess: ../../. ./../src/ remotepluginpro cess/remoteplug inprocess. cpp 249 error error is sent 307 "Connection to proxy closed prematurely" cess: base-plugin.cpp 133 onPostFinished : Finished signal received
Oct 10 10:51:06 kitt signonpluginpro
Oct 10 10:51:06 kitt signonpluginpro
Oct 10 10:51:06 kitt signonpluginpro
Oct 10 10:51:06 kitt signonpluginpro
So it appears the proxy isn't correctly used. But I did set the proxy correctly and the previous steps can go on well. Also I can succeed in adding Facebook account.
2. I added some logging in plugin.cpp and oauth2plugin.cpp and found the proxy in the QNetworkAccessM anager is correctly: com:3128. So it's really strange the connection cannot reach when proxy is correctly set. I tried to use Wireshark to see what happened but it's HTTPS so it's difficulty to do.
proxy.foobar.
3. Then I accidentally commented the line in plugin.cpp: :process( const SignOn::SessionData &inData, ...) networkAccessMa nager-> setProxy( networkProxy) ; >setNetworkAcce ssManager( m_networkAccess Manager) ;
void Plugin:
{
...
//m_
impl-
...
}
And found it worked! Both Google account and Twitter account are added.
4. From my experiences, I believe it's due to HTTPS over HTTP proxy. In my company HTTPS should go to HTTPS proxy (https:/ /proxy. foobar. com:3128).
From the code in Plugin::process, the proxy is set to QNetworkProxy: :applicationPro xy():
QNetworkProxy networkProxy = QNetworkProxy: :applicationPro xy(); cessManager- >setProxy( networkProxy) ; >setNetworkAcce ssManager( m_networkAccess Manager) ;
m_networkAc
impl-
applicationProxy() will only return the HTTP proxy when the system proxy has multiple proxy settings.
But why it worked if I don't set the proxy? I found in remotepluginpro cess.cpp (the signond package):
bool RemotePluginPro cess::setupProx ySettings( ) oxyFactory *proxyFactory = new MyNetworkProxyF actory( ); xyFactory: :setApplication ProxyFactory( proxyFactory) ;
{
...
MyNetworkPr
QNetworkPro
...
return true;
}
The signonpluginprocess has application proxy set, and it's a proxy factory. This means the HTTPS proxy will be selected if you make an HTTPS request.
5. My Fix
So I propose a fix for this issue. I'd like to set the proxy in plugin to the default proxy, which will pick up the application proxy factory, instead of selecting a steady HTTP proxy. I still keep the proxy override for parameters. Can you help to verify and merge it if necessary?
Thanks,
Shu