Review Request 127077: kio_http: fix mimetype determination when URL ends with '/'.
David Faure
faure at kde.org
Sun Feb 14 19:29:49 UTC 2016
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/127077/
-----------------------------------------------------------
Review request for KDE Frameworks, Dawit Alemayehu, Andreas Hartmetz, and Rolf Eike Beer.
Repository: kio
Description
-------
When no Content-Type is sent by the server, we determine mimetype from
the URL and the contents. In the switch from KMimeType (which
took the fileName of the URL) and QMimeDatabase (which takes the full path),
we hit a difference: if the path ends with '/' then QMimeDatabase
assumes it's a directory, which isn't the case over HTTP.
So remove the trailing slash.
This commit introduces a test harness for kio_http: a basic HTTP server
running in a separate thread, which I wrote for KDSoap (LGPL).
REVIEW: 127076
kio_http: read and discard body after a 404 with errorPage=false.
When getting a 404 error with some content, the job succeeds and returns content
(good for webbrowsers).
The metadata "errorPage" can be set to false so that the job fails instead
(useful for other cases, like favicon download, file copy etc.)
However the rest of the headers, as well as the body must still be read and
discarded, otherwise they clobber the next request (kio_http then starts
parsing in the middle of some headers and says "DO NOT WANT").
This is not a porting bug, I could reproduce it with kdelibs4 too.
Diffs
-----
autotests/CMakeLists.txt 107263820136c599df84c7beb06a29a1c52898ae
autotests/http_jobtest.cpp PRE-CREATION
autotests/httpserver_p.h PRE-CREATION
autotests/httpserver_p.cpp PRE-CREATION
src/ioslaves/http/http.cpp e1013c8705e6588729d61ed45c43dc564415c41e
Diff: https://git.reviewboard.kde.org/r/127077/diff/
Testing
-------
Unittest.
Please review this patch carefully, I don't have much experience with this code in kio_http, and the potential for regressions in cases that I didn't test is likely high.
Thanks,
David Faure
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20160214/cd21eb0f/attachment.html>
More information about the Kde-frameworks-devel
mailing list