Review Request: kio_http: fix keepalive timeout parsing

Andrea Iacovitti aiacovitti at libero.it
Thu Oct 13 18:59:47 BST 2011


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/102822/
-----------------------------------------------------------

(Updated Oct. 13, 2011, 5:59 p.m.)


Review request for kdelibs, Andreas Hartmetz and Dawit Alemayehu.


Changes
-------

Small improvements:
. update m_request.keepAliveTimeout only if converted int  > 0
. added a break to save while cycles on values we are not interested to


Description
-------

Keep-alive header can specify multiple, comma-separated, value pairs.
For example what apache web server normally sends is something like that:

"Keep-Alive: timeout=5, max=99"

Actually kio_http fails to extract timeout value because it assumes
keep-alive header can contain only a single value pair.
In the case of example above what it end up to do is
m_request.keepAliveTimeout = QString("5, max=99").toInt(), that returns 0 (wrong!).


Diffs (updated)
-----

  kioslave/http/http.cpp 2862707 
  kioslave/http/parsinghelpers.cpp fc75d68 

Diff: http://git.reviewboard.kde.org/r/102822/diff/diff


Testing
-------

-Patched code compiles
-Hacked a web server and made tests against following keep-alive header variants:
 "Keep-Alive: timeout=5, max=99"
 "Keep-Alive: Timeout=5, max=99"     (uppercase 'T')
 "Keep-Alive: Timeout=5 , max=99"    (extra space before comma)


Thanks,

Andrea Iacovitti

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20111013/468d9347/attachment.htm>


More information about the kde-core-devel mailing list