[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: [POSSIBLE PATCH] Fix KDE4 Konqueror proxy settings
From: "Eduardo Robles" <edulix () gmail ! com>
Date: 2007-09-20 11:55:15
Message-ID: 9e2d3ad60709200455v624d235dib63775c7b5950ef6 () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
I had this bug on my private list of TODOs because I also noticed the
problem when trying to use Konqueror of KDE4 at work. Thanks for your patch,
I'll test it =)
2007/9/20, Dmitry Ivanov <vonami@gmail.com>:
>
> Hello KDE team!
>
> I have been following the KDE4 development since a couple
> of months and recently decided to give KDE 4 a try as my default
> desktop environment.
>
> Tried Konqueror but couldn't setup it to use a proxy server.
> Whatever I type in the manual proxy configuration dialog
> it complains "The proxy settings you specified are invalid".
>
> The patch in the attached file fixed it for me. I'm not sure
> whether I got it right so I'll comment on my changes.
>
>
> ===================================================================
> --- settings/kio/kmanualproxydlg.cpp (revision 713920)
> +++ settings/kio/kmanualproxydlg.cpp (working copy)
> @@ -78,6 +78,8 @@
>
> connect( mDlg->leHttp, SIGNAL(textChanged(const QString&)),
> SLOT(textChanged(const QString&)) );
> connect( mDlg->sbHttp, SIGNAL(valueChanged(int)), SLOT(valueChanged
> (int)) );
> +
> + connect( this, SIGNAL(okClicked()), this, SLOT(slotOk()));
> }
>
> void KManualProxyDlg::setProxyData( const KProxyData &data )
>
>
> Comment: This one is trivial. Possibly the orphaned slot is a result of
> porting to KDE/Qt4.
>
>
> @@ -93,7 +95,7 @@
> if ( port <= 0 )
> port = DEFAULT_PROXY_PORT;
>
> - url.setPort( 0 );
> + url.setPort( -1 );
> mDlg->leHttp->setText( url.url() );
> mDlg->sbHttp->setValue( port );
> }
> @@ -124,7 +126,7 @@
> if ( port <= 0 )
> port = DEFAULT_PROXY_PORT;
>
> - url.setPort( 0 );
> + url.setPort( -1 );
> mDlg->leHttps->setText( url.url () );
> mDlg->sbHttps->setValue( port );
> }
> @@ -138,7 +140,7 @@
> if ( port <= 0 )
> port = DEFAULT_PROXY_PORT;
>
> - url.setPort( 0 );
> + url.setPort( -1 );
> mDlg->leFtp->setText( url.url() );
> mDlg->sbFtp->setValue( port );
> }
>
> Comment: The Qt4 docs state it clearly: -1 means the port is unspecified.
> One more result of porting?
>
>
> @@ -412,8 +414,8 @@
>
> // If the typed URL is malformed, and the filters cannot filter it
> // then it must be an invalid entry.
> - if( !(url.isValid() || KUriFilter::self()->filterUri(url, filters))
> &&
> - !url.hasHost() )
> + if( !(url.isValid() && KUriFilter::self()->filterUri(url, filters) &&
> + url.hasHost()) )
> return false;
>
> QString host (url.host());
>
> Comment: This logic turned out to be broken. Let me explain.
>
> If I type "10.242.100.5" in the http proxy field this function
> ( isValidURL( const QString& _url, KUrl* result ) ) constructs a KUrl
> object from the entered text:
>
> KUrl url(_url);
>
> If you add a few debug lines like
>
> kDebug() << "got url = " << url;
> kDebug() << "got url.url = " << url.url();
> kDebug() << "got url.scheme = " << url.scheme();
> kDebug() << "got url.host = " << url.host();
> kDebug() << "got url.port = " << url.port ();
> kDebug() << "got url.fragment = " << url.fragment();
> kDebug() << "got url.path = " << url.path();
>
> you will get:
>
> konqueror(25730) KManualProxyDlg::isValidURL: got url.url = "
> 10.242.100.5"
> konqueror(25730) KManualProxyDlg::isValidURL: got url.scheme = ""
> konqueror(25730) KManualProxyDlg::isValidURL: got url.host = ""
> konqueror(25730) KManualProxyDlg::isValidURL: got url.port = -1
> konqueror(25730) KManualProxyDlg::isValidURL: got url.fragment = ""
> konqueror(25730) KManualProxyDlg::isValidURL: got url.path = "
> 10.242.100.5"
>
> Note that the host part is empty and "10.242.100.5" actually became the
> path part
> of the url. Nonetheless url.isValid () in the "if" statement returns true
> and therefore KUriFilter::self()->filterUri(url, filters) is not executed.
> We end
> up with a broken url.
>
> I guess that KDE/Qt3's KUrl class returns false in this case and then
> KUriFilter::self()->filterUri(url, filters) converts the url to canonical
> form.
> So I have changed the logic the way you see above.
>
> With this patch Konqueror accepts proxy settings and works fine via
> a proxy server.
>
> Best regards,
> Dmitry Ivanov
>
> --
> A: Because it destroys the flow of the conversation
> Q: Why is top-posting bad?
>
> >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to
> unsubscribe <<
>
>
>
[Attachment #5 (text/html)]
I had this bug on my private list of TODOs because I also noticed the problem when \
trying to use Konqueror of KDE4 at work. Thanks for your patch, I'll test it \
=)<br><br><div><span class="gmail_quote">2007/9/20, Dmitry Ivanov < <a \
href="mailto:vonami@gmail.com">vonami@gmail.com</a>>:</span><blockquote \
class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt \
0pt 0.8ex; padding-left: 1ex;">Hello KDE team!<br><br>I have been following the KDE4 \
development since a couple <br>of months and recently decided to give KDE 4 a try as \
my default<br>desktop environment.<br><br>Tried Konqueror but couldn't setup it \
to use a proxy server. <br>Whatever I type in the manual proxy configuration \
dialog<br>it complains "The proxy settings you specified are \
invalid".<br><br>The patch in the attached file fixed it for me. I'm not \
sure<br>whether I got it right so I'll comment on my changes. \
<br><br><br>===================================================================<br>--- \
settings/kio/kmanualproxydlg.cpp (revision 713920)<br>+++ \
settings/kio/kmanualproxydlg.cpp (working copy)<br>@@ -78,6 +78,8 \
@@<br>
<br> connect( mDlg->leHttp, SIGNAL(textChanged(const \
QString&)), SLOT(textChanged(const QString&)) );<br> \
connect( mDlg->sbHttp, SIGNAL(valueChanged(int)), SLOT(valueChanged (int)) \
);<br>+<br>+ connect( this, SIGNAL(okClicked()), this, \
SLOT(slotOk())); <br> }<br><br> void KManualProxyDlg::setProxyData( const \
KProxyData &data )<br><br><br>Comment: This one is trivial. Possibly the orphaned \
slot is a result of porting to KDE/Qt4.<br><br><br>@@ -93,7 +95,7 \
@@<br> if ( port <= 0 ) \
<br> port = \
DEFAULT_PROXY_PORT;<br><br>- url.setPort( 0 \
);<br>+ url.setPort( -1 \
);<br> mDlg->leHttp->setText( \
url.url() );<br> \
mDlg->sbHttp->setValue( port );<br> } <br>@@ -124,7 \
+126,7 @@<br> if ( port \
<= 0 )<br> \
port = DEFAULT_PROXY_PORT;<br><br>- \
url.setPort( 0 );<br>+ \
url.setPort( -1 );<br> \
mDlg->leHttps->setText( url.url
() );<br> \
mDlg->sbHttps->setValue( port );<br> \
}<br>@@ -138,7 +140,7 \
@@<br> if ( port <= 0 \
)<br> \
port = DEFAULT_PROXY_PORT;<br><br>- \
url.setPort( 0 );<br>+ \
url.setPort( -1 );<br> \
mDlg->leFtp->setText( url.url() \
);<br> \
mDlg->sbFtp->setValue( port );<br> \
}<br><br>Comment: The Qt4 docs state it clearly: -1 means the port is \
unspecified.<br>
One more result of porting?<br><br><br>@@ -412,8 +414,8 \
@@<br><br> // If the typed URL is malformed, and the filters \
cannot filter it<br> // then it must be an invalid \
entry.<br>- if( !(url.isValid() || \
KUriFilter::self()->filterUri(url, filters)) && \
<br>- !url.hasHost() \
)<br>+ if( !(url.isValid() && \
KUriFilter::self()->filterUri(url, filters) \
&&<br>+ url.hasHost()) \
)<br> return \
false;<br><br> QString host (url.host());<br>
<br>Comment: This logic turned out to be broken. Let me explain.<br><br>If I type \
"<a href="http://10.242.100.5" target="_blank" onclick="return \
top.js.OpenExtLink(window,event,this)">10.242.100.5</a>" in the http proxy field \
this function <br>( isValidURL( const QString& _url, KUrl* result ) ) constructs \
a KUrl <br>object from the entered text:<br><br>KUrl url(_url);<br><br>If you add a \
few debug lines like<br><br> kDebug() << "got url = " << \
url;<br> kDebug() << "got url.url = " << \
url.url();<br> kDebug() << "got url.scheme = " << \
url.scheme();<br> kDebug() << "got url.host = " << \
url.host();<br> kDebug() << "got url.port = " << url.port
();<br> kDebug() << "got url.fragment = " << \
url.fragment();<br> kDebug() << "got url.path = " << \
url.path();<br><br>you will get:<br><br> konqueror(25730) \
KManualProxyDlg::isValidURL: got url.url = "<a href="http://10.242.100.5" \
target="_blank" onclick="return \
top.js.OpenExtLink(window,event,this)">10.242.100.5</a>"<br> \
konqueror(25730) KManualProxyDlg::isValidURL: got url.scheme = "" \
<br> konqueror(25730) KManualProxyDlg::isValidURL: got url.host = \
"" <br> konqueror(25730) KManualProxyDlg::isValidURL: got url.port \
= -1<br> konqueror(25730) KManualProxyDlg::isValidURL: got url.fragment \
= ""<br> konqueror(25730) KManualProxyDlg::isValidURL: got \
url.path = " <a href="http://10.242.100.5" target="_blank" onclick="return \
top.js.OpenExtLink(window,event,this)">10.242.100.5</a>"<br><br>Note that the \
host part is empty and "<a href="http://10.242.100.5" target="_blank" \
onclick="return top.js.OpenExtLink(window,event,this)"> 10.242.100.5</a>" \
actually became the path part<br>of the url. Nonetheless url.isValid () in the \
"if" statement returns true<br>and therefore \
KUriFilter::self()->filterUri(url, filters) is not executed. We end<br>up with a \
broken url.<br><br>I guess that KDE/Qt3's KUrl class returns false in this case \
and then <br>KUriFilter::self()->filterUri(url, filters) converts the url to \
canonical form.<br>So I have changed the logic the way you see above.<br><br>With \
this patch Konqueror accepts proxy settings and works fine via<br>a proxy server. \
<br><br>Best regards,<br>Dmitry Ivanov<br clear="all"><span class="sg"><br>-- <br>A: \
Because it destroys the flow of the conversation<br>Q: Why is top-posting bad? \
</span><br><br>>> Visit <a onclick="return \
top.js.OpenExtLink(window,event,this)" \
href="http://mail.kde.org/mailman/listinfo/kde-devel#unsub" \
target="_blank">http://mail.kde.org/mailman/listinfo/kde-devel#unsub</a> to \
unsubscribe <<<br><br><br clear="all"></blockquote></div><br>
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic