BR 79813: KIO bug

Dawit A. adawit at
Sun Aug 1 18:11:42 BST 2004

On Sunday 01 August 2004 11:27, Waldo Bastian wrote:
> On Saturday 31 July 2004 19:41, Dawit A. wrote:
> > Waldo,
> >
> > Can please take a look at BR 79813 when you get a chance ? This is a
> > problem with a POST request that returns data to be saved into a file. If
> > you pick an existing file to save the data into, the file io-slave
> > correctly correctly an error (ERR_FILE_ALREADY_EXIST). However, this
> > seems to cause the other end (http io-slave) to be disconnected and
> > returned to the scheduler there by getting rid of our data. I think we
> > need to do something to prevent this in TransferJob::slotFinished.
> > Otherwise, we end up doing a new GET which will not work. See the test
> > case provided in comment #3 of the bug report.
> >
> > Could we check what the error message and not disconnect io-slave so we
> > won't lose our data ? Would that even work ?
> See my comments to the bugreport. Returning ERR_FILE_ALREADY_EXIST in the
> "put" io-slave before doing the first dataReq actually seems to solve the
> problem and in general seems to be the Right Thing To Do (tm).

Ahh... I did not even see that. I will try that.

> PS: I do wonder what the behavior should be if there is both a partial file
> and the destination file, looking at the code it first seems to ask for
> resumption and then later asks whether to overwrite?? Isn't that a bit too
> much?

Yes, it is. Unfortunately this scenario is handled differently from io-slave 
to io-slave. There is no consistency. In the sftp io-slave I give much more 
weight to the actual file instead of the partial one ; so if for some reason, 
both the original and partial files exist, it skips resumption just like it 
would if the size of the partial file is zero. In the ftp io-slave the 
reverse seems to be true. If both exist, it seems to delete the original and 
tries to resume on the partial file. IMHO that can lead into problems if the 
file being download has changed since the time the partial file was created.
Other than that both io-slaves at least check for existence and return the 
error before doing the data request. Dunno how it is handled in all the other 

Dawit A.
"Preach what you practice, practice what you preach"

More information about the kde-core-devel mailing list