[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Review Request: Using KWallet to store Cookies
From:       "Dawit Alemayehu" <adawit () kde ! org>
Date:       2010-11-16 18:41:15
Message-ID: 20101116184115.8398.60088 () vidsolbach ! de
[Download RAW message or body]

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://svn.reviewboard.kde.org/r/4927/#review8357
-----------------------------------------------------------


For the record I too share David's concern with nested event loops...
Also please try to use QL1S macro defined in kcookiejar for all literal str=
ing you pass to QString...


/trunk/KDE/kdelibs/kioslave/http/kcookiejar/kcookiejar.cpp
<http://svn.reviewboard.kde.org/r/4927/#comment8638>

    isn't this supposed to be "!wallet->readMap"... ?



/trunk/KDE/kdelibs/kioslave/http/kcookiejar/kcookiejar.cpp
<http://svn.reviewboard.kde.org/r/4927/#comment9365>

    This can be const...



/trunk/KDE/kdelibs/kioslave/http/kcookiejar/kcookiejar.cpp
<http://svn.reviewboard.kde.org/r/4927/#comment9364>

    All the variables here can be made const as well...



/trunk/KDE/kdelibs/kioslave/http/kcookiejar/kcookieserver.h
<http://svn.reviewboard.kde.org/r/4927/#comment8637>

    Is this flag really necessary now ? Since you have a new QTimer, why no=
t simply check the the validity and state of that tmer variable instead ?



/trunk/KDE/kdelibs/kioslave/http/kcookiejar/kcookieserver.cpp
<http://svn.reviewboard.kde.org/r/4927/#comment8636>

    this can be made const...


- Dawit


On 2010-10-26 01:24:01, Jos=C3=A9 Mill=C3=A1n Soto wrote:
> =

> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://svn.reviewboard.kde.org/r/4927/
> -----------------------------------------------------------
> =

> (Updated 2010-10-26 01:24:01)
> =

> =

> Review request for kdelibs.
> =

> =

> Summary
> -------
> =

> Currently cookies are stored in a plain text file. This patch allows KCoo=
kieJar to store the cookies securely using KWallet.
> =

> The main problem I had writing this patch was that when a web page is req=
uested, KIO ask for the cookies to kded using dbus. In the first implementa=
tions that I wrote, if the user took too long to open the wallet, KIO recei=
ved a dbus timeout.
> =

> To prevent this, if it takes more than 10 seconds to open the wallet, the=
 web page will be requested without sending the cookies (or sending the ava=
ilable cookies if there's still the plain text cookie file). If the wallet =
is opened after that, the cookies stored in the wallet will be available si=
nce then.
> =

> Because of this, the feature is disabled by default.
> =

> =

> Diffs
> -----
> =

>   /trunk/KDE/kdebase/apps/konqueror/settings/kio/kcookiespolicies.cpp 118=
9829 =

>   /trunk/KDE/kdebase/apps/konqueror/settings/kio/kcookiespoliciesdlg.ui 1=
189829 =

>   /trunk/KDE/kdelibs/kioslave/http/kcookiejar/kcookiejar.h 1189787 =

>   /trunk/KDE/kdelibs/kioslave/http/kcookiejar/kcookiejar.cpp 1189787 =

>   /trunk/KDE/kdelibs/kioslave/http/kcookiejar/kcookieserver.h 1189787 =

>   /trunk/KDE/kdelibs/kioslave/http/kcookiejar/kcookieserver.cpp 1189787 =

> =

> Diff: http://svn.reviewboard.kde.org/r/4927/diff
> =

> =

> Testing
> -------
> =

> =

> Thanks,
> =

> Jos=C3=A9
> =

>


[Attachment #3 (text/html)]

<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;">  <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="http://svn.reviewboard.kde.org/r/4927/">http://svn.reviewboard.kde.org/r/4927/</a>
  </td>
    </tr>
   </table>
   <br />





 <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">For the record I too \
share David&#39;s concern with nested event loops... Also please try to use QL1S \
macro defined in kcookiejar for all literal string you pass to QString...</pre>  <br \
/>





<div>




<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="http://svn.reviewboard.kde.org/r/4927/diff/4/?file=40255#file40255line1521" \
style="color: black; font-weight: bold; text-decoration: \
underline;">/trunk/KDE/kdelibs/kioslave/http/kcookiejar/kcookiejar.cpp</a>  <span \
style="font-weight: normal;">

     (Diff revision 4)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
"></pre></td>  <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: \
0; ">bool KCookieJar::loadCookies(KWallet::Wallet *wallet)</pre></td>

  </tr>
 </tbody>




 
 



 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">1521</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span \
class="k">if</span> <span class="p">(</span> <span class="n">wallet</span><span \
class="o">-&gt;</span><span class="n">readMap</span><span class="p">(</span><span \
class="n">domainName</span><span class="p">,</span> <span \
class="n">cookieInfo</span><span class="p">)</span> <span class="o">||</span> <span \
class="o">!</span><span class="n">cookieInfo</span><span class="p">.</span><span \
class="n">contains</span><span class="p">(</span><span \
class="s">&quot;cookies&quot;</span><span class="p">)</span> <span \
class="p">)</span></pre></td>  </tr>

 </tbody>

</table>

<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">isn&#39;t \
this supposed to be &quot;!wallet-&gt;readMap&quot;... ?</pre> </div>
<br />

<div>




<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="http://svn.reviewboard.kde.org/r/4927/diff/4/?file=40255#file40255line1524" \
style="color: black; font-weight: bold; text-decoration: \
underline;">/trunk/KDE/kdelibs/kioslave/http/kcookiejar/kcookiejar.cpp</a>  <span \
style="font-weight: normal;">

     (Diff revision 4)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
"></pre></td>  <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: \
0; ">bool KCookieJar::loadCookies(KWallet::Wallet *wallet)</pre></td>

  </tr>
 </tbody>




 
 



 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">1524</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span \
class="n">QStringList</span> <span class="n">cookieNames</span> <span \
class="o">=</span> <span class="n">cookieInfo</span><span class="p">[</span><span \
class="s">&quot;cookies&quot;</span><span class="p">].</span><span \
class="n">split</span><span class="p">(</span><span \
class="sc">&#39;\n&#39;</span><span class="p">);</span></pre></td>  </tr>

 </tbody>

</table>

<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">This can be \
const...</pre> </div>
<br />

<div>




<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="http://svn.reviewboard.kde.org/r/4927/diff/4/?file=40255#file40255line1526" \
style="color: black; font-weight: bold; text-decoration: \
underline;">/trunk/KDE/kdelibs/kioslave/http/kcookiejar/kcookiejar.cpp</a>  <span \
style="font-weight: normal;">

     (Diff revision 4)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
"></pre></td>  <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: \
0; ">bool KCookieJar::loadCookies(KWallet::Wallet *wallet)</pre></td>

  </tr>
 </tbody>




 
 



 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">1526</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span \
class="n">Q_FOREACH</span><span class="p">(</span><span class="k">const</span> <span \
class="n">QString</span><span class="o">&amp;</span> <span class="n">name</span><span \
class="p">,</span> <span class="n">cookieNames</span><span \
class="p">)</span></pre></td>  </tr>

 </tbody>

</table>

<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">All the \
variables here can be made const as well...</pre> </div>
<br />

<div>




<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="http://svn.reviewboard.kde.org/r/4927/diff/4/?file=40256#file40256line103" \
style="color: black; font-weight: bold; text-decoration: \
underline;">/trunk/KDE/kdelibs/kioslave/http/kcookiejar/kcookieserver.h</a>  <span \
style="font-weight: normal;">

     (Diff revision 4)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
">public:</pre></td>

  </tr>
 </tbody>




 
 



 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">103</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">  <span \
class="n">bool</span> <span class="n">mTryingToObtainWallet</span><span \
class="p">;</span></pre></td>  </tr>

 </tbody>

</table>

<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Is this \
flag really necessary now ? Since you have a new QTimer, why not simply check the the \
validity and state of that tmer variable instead ?</pre> </div>
<br />

<div>




<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="http://svn.reviewboard.kde.org/r/4927/diff/4/?file=40257#file40257line128" \
style="color: black; font-weight: bold; text-decoration: \
underline;">/trunk/KDE/kdelibs/kioslave/http/kcookiejar/kcookieserver.cpp</a>  <span \
style="font-weight: normal;">

     (Diff revision 4)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
">KCookieServer::KCookieServer(QObject* parent, const \
QList&lt;QVariant&gt;&amp;)</pre></td>

  </tr>
 </tbody>




 
 



 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">126</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span \
class="n">QString</span> <span class="n">filename</span> <span class="o">=</span> \
<span class="n">KStandardDirs</span><span class="o">::</span><span \
class="n">locateLocal</span><span class="p">(</span><span \
class="s">&quot;data&quot;</span><span class="p">,</span> <span \
class="s">&quot;kcookiejar/cookies&quot;</span><span class="p">);</span></pre></td>  \
</tr>

 </tbody>

</table>

<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">this can be \
made const...</pre> </div>
<br />



<p>- Dawit</p>


<br />
<p>On October 26th, 2010, 1:24 a.m., José Millán Soto wrote:</p>






<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('http://svn.reviewboard.kde.orgrb/images/review_request_box_top_bg.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;">  <tr>
  <td>

<div>Review request for kdelibs.</div>
<div>By José Millán Soto.</div>


<p style="color: grey;"><i>Updated 2010-10-26 01:24:01</i></p>




<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">Currently cookies are stored in a plain text file. This patch allows \
KCookieJar to store the cookies securely using KWallet.

The main problem I had writing this patch was that when a web page is requested, KIO \
ask for the cookies to kded using dbus. In the first implementations that I wrote, if \
the user took too long to open the wallet, KIO received a dbus timeout.

To prevent this, if it takes more than 10 seconds to open the wallet, the web page \
will be requested without sending the cookies (or sending the available cookies if \
there&#39;s still the plain text cookie file). If the wallet is opened after that, \
the cookies stored in the wallet will be available since then.

Because of this, the feature is disabled by default.</pre>
  </td>
 </tr>
</table>





<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>/trunk/KDE/kdebase/apps/konqueror/settings/kio/kcookiespolicies.cpp <span \
style="color: grey">(1189829)</span></li>

 <li>/trunk/KDE/kdebase/apps/konqueror/settings/kio/kcookiespoliciesdlg.ui <span \
style="color: grey">(1189829)</span></li>

 <li>/trunk/KDE/kdelibs/kioslave/http/kcookiejar/kcookiejar.h <span style="color: \
grey">(1189787)</span></li>

 <li>/trunk/KDE/kdelibs/kioslave/http/kcookiejar/kcookiejar.cpp <span style="color: \
grey">(1189787)</span></li>

 <li>/trunk/KDE/kdelibs/kioslave/http/kcookiejar/kcookieserver.h <span style="color: \
grey">(1189787)</span></li>

 <li>/trunk/KDE/kdelibs/kioslave/http/kcookiejar/kcookieserver.cpp <span \
style="color: grey">(1189787)</span></li>

</ul>

<p><a href="http://svn.reviewboard.kde.org/r/4927/diff/" style="margin-left: \
3em;">View Diff</a></p>




  </td>
 </tr>
</table>








  </div>
 </body>
</html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic