Revision 856450

Go back to digest for 7th September 2008

Other in KDE Base

Andreas Hartmetz committed changes in /trunk/KDE/kdelibs/kioslave:

- parse headers in a systematic way using a header parser written for the purpose.
this makes keeping header parsing free of bugs much less of a hassle.

with simple unittest - it actually helped me *a lot* so it's better than nothing.

it should be pretty fast, too.
in a test it parsed ~13 MB of headers per second on my phenom at 2GHz; this indicates that the old ad-hoc parser was likely not a bottleneck ;)

- some "safe" parsing helpers that know not to overflow a buffer and with clear semantics (advancing the read pointer if they recognize what they are made to recognize).
- dump the gets() / rewind() / setRewindMarker() business and replace it by unread() which puts data back into the input stream with less head-scratching about what exactly it does.
unread is both less complex and requires less variables in the already crowded HTTProtocol class.

- do not override read() because it's confusing. call the method to achieve the same goal (mainly unread support) readBuffered() instead.
- adapt getAuthorization() to pre-parsed headers
- small improvements like collapsing of switch cases and kdelibs-style formatting in significantly changed methods
- some explanatory comments
- some performance tweaking - real-world performance (i.e. loading websites) is hopefully better than before. mainly experimenting with buffer sizes and how exactly to read incoming data.
IIRC this included the funny new code in readChunked().
- probably something I forgot
- fix some small behavior bugs in header parsing, mainly in case of somehow incorrect headers though
- quite some testing to kill any bugs introduced. we'll see about the bugs...
- primitive multi-get support, not completely ready to use though. easier to commit it than to remove it for the checkin.

File Changes

Added 6 files
  • /trunk/KDE/kdelibs/kioslave
  •   /tests
  •   /http/parsinghelpers.cpp
  •   /http/parsinghelpers.h
  •   /tests/CMakeLists.txt
  •   /tests/httpheadertokenizetest.cpp
  •   /tests/httpheadertokenizetest.h
Modified 3 files
  • /trunk/KDE/kdelibs/kioslave
  •   /CMakeLists.txt
  •   /http/http.cpp
  •   /http/http.h
9 files changed in total