Version: (using KDE KDE 3.5.0) Installed from: Ubuntu Packages OS: Linux Ok, I spend ages trying to find a bug in my code but it turns out to be a bug in the cgi kioslave. Useful as it is, GRRRRRRRRRRRRR! The problem is that it adds a random space somewhere in the output, which breaks the HTML if it is in the wrong place, and is almost impossible to debug.
I can confirm this. The problem is that there is code to try and extract the Content-Type, which uses QCString (a subclass of QByteArray). The QCString has the property that it always ends in '\0'. (i.e. [ d, a, t, a, \0 ]). When the QCString buffer is later transferred to KIO, KIO sends all of it, including the trailing '\0' which was not there before. I will attach a patch which fixes the issue (at least in my testing). At first I was just going to convert back to a QByteArray and send the plain QByteArray, but the underlying issue is that QCString is designed for text, not binary data, so I decided to fix that instead. It is understandably more invasive that way so I would like to get the patch reviewed before committing.
Created attachment 16733 [details] Fix slightly corrupted output in CGI kioslave. This patch fixes the issue by using QByteArray for everything dealing with the data from the buffer we're reading into.
This is fixed in KDE 3.5, fix will be included in the next release. KDE 4 seems to be unaffected thanks to the API changes in Qt, so no patch was applied there.