<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://git.reviewboard.kde.org/r/100516/">http://git.reviewboard.kde.org/r/100516/</a>
     </td>
    </tr>
   </table>
   <br />








<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On February 9th, 2011, 9:59 a.m., <b>David Faure</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  



<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://git.reviewboard.kde.org/r/100516/diff/3/?file=8819#file8819line3809" style="color: black; font-weight: bold; text-decoration: underline;">kioslave/http/http.cpp</a>
    <span style="font-weight: normal;">

     (Diff revision 3)

    </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; ">void HTTPProtocol::setCacheabilityMetadata(bool cachingAllowed)</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">3803</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">      <span class="c1">// FIXME: Might consume huge memory when uploading large content!</span></pre></td>
  </tr>

 </tbody>

</table>

  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Hmm, yeah, doesn't this make this all useless, if we end up making a QByteArray with the whole data in it anyway? I thought the whole point was for kio_http to read in chunks and send along the way, rather than read it all upfront.</pre>
 </blockquote>





</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Well it is not completely useless since it fixes one portion of this issue. There are a couple of ways to solve the problem in kio_http as well. It is just that both of the solutions I could think of have their own particular downsides.

The first solution is to simply save the POST data into a temporary file and re-post from there if necessary or delete the file when the request is done. However, besides being inefficient (saving to file), this approach also has a potential to leave behind sensitive data in a temporary file if the kio_http happens to crash or exit abnormally. I doubt we want to take this risk, specially if the information we saved to a temporary file is for example bank account or credit card information.

The second potential solution does not rely on saving information to disk. Instead we add a new message the ioslave can send to the job to reset and start over (MSG_DATA_REQ_RESET). The ioslave then would simply call dataReq() again to obtain the same data from scratch. The problem with this solution is that it not only requires changes in slavebase.*, slaveinterface.* to send the new message and emit the necessary signal, but also modifications to how the current KIO::http_post API works. The slotDataReq function can no longer delete the data to be POST'd once it sends it to the ioslave. Instead it would have to keep it until it receives the result of the POST request. The most glaring down side however is the fact that with the new http_post API. If the QIODevice passed to it is sequential, i.e. a network socket, then it simply cannot be reset to restart to process all over again.

I personally think the second solution is the way to go since it absolves the ioslave from having to do anything other than calling something like SlaveBase::dataReqReset() to start over. The downside of course is whether or not we care about sequential devices. If not, then this is our solution.</pre>
<br />




<p>- Dawit</p>


<br />
<p>On February 9th, 2011, 1:28 a.m., Dawit Alemayehu wrote:</p>






<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('http://git.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 Dawit Alemayehu.</div>


<p style="color: grey;"><i>Updated Feb. 9, 2011, 1:28 a.m.</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;">The attached patch is the first portion a set of patches to make uploading data through HTTP more efficient without affecting the existing implementation. Right now the amount of memory consumed when uploading large files through http or webdav is really not acceptable because only a QByteArray based API is available. That means if you want to upload a file of say 50 or 100 MB to a server, then you have to read the entire thing first before you can call KIO::http_post!</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </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;">Used by changing kdewebkit to use the new API. </pre>
  </td>
 </tr>
</table>



<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>


 <a href="http://bugs.kde.org/show_bug.cgi?id=34578">34578</a>


</div>


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

 <li>kio/kio/job_p.h <span style="color: grey">(daac895)</span></li>

 <li>kio/kio/jobclasses.h <span style="color: grey">(e9bd191)</span></li>

 <li>kioslave/http/http.h <span style="color: grey">(be08d7b)</span></li>

 <li>kioslave/http/http.cpp <span style="color: grey">(187e3c7)</span></li>

 <li>kio/kio/accessmanager.cpp <span style="color: grey">(722203f)</span></li>

 <li>kio/kio/job.h <span style="color: grey">(632dfc8)</span></li>

 <li>kio/kio/job.cpp <span style="color: grey">(7d4a849)</span></li>

</ul>

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




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








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