Review Request: kio_http: fix keepalive timeout parsing
Andreas Hartmetz
ahartmetz at gmail.com
Thu Oct 13 00:02:47 BST 2011
> On Oct. 12, 2011, 10:58 p.m., Andreas Hartmetz wrote:
> > kioslave/http/http.cpp, line 3107
> > <http://git.reviewboard.kde.org/r/102822/diff/1/?file=38514#file38514line3107>
> >
> > I guess the parser just lowercases the key ("keep-alive"), not the values. Lowercasing the keys is okay because per the spec they are case-insensitive, and it has the advantage that you can look up keys in more or less constant time when using a hashtable.
> > In many cases the values are case sensitive (usernames, something Base64-encoded for example), so the parser better leaves them alone. So you need to normalize the case yourself.
Small addition: The values are key-value pairs again here, but that isn't universally so in HTTP headers. The header parser simply doesn't know about such details.
- Andreas
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/102822/#review7283
-----------------------------------------------------------
On Oct. 10, 2011, 10:35 p.m., Andrea Iacovitti wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/102822/
> -----------------------------------------------------------
>
> (Updated Oct. 10, 2011, 10:35 p.m.)
>
>
> Review request for kdelibs, Andreas Hartmetz and Dawit Alemayehu.
>
>
> 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
> -----
>
> 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/20111012/ff99f5a3/attachment.htm>
More information about the kde-core-devel
mailing list