curl-library
Re: Issue with partial file transfer
Date: Fri, 20 Apr 2012 17:51:30 +0200
Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Fri, 20 Apr 2012, Grzegorz Sikorski wrote:
>
> >> It is not OK since it changes behavior for existing application in a very
> >> drastic way.
> >
> > I do not agree. If libcurl always assume the file is sought back to the
> > start, it is no change anyway.
>
> That's not a correct interpretation.
>
> libcurl assumes that the application provides the stream from exactly the
> point where it should be. It can be from the start or it can be from the
> middle, it is all fine for libcurl. What is the correct place is only known by
> the application.
>
> > The only thing it might brake is situation, when user tries to put on the
> > server part of the file and seeks the pointer to the middle before transfer.
> > This is rather strange request and I am not sure if it really could success
> > anyway.
>
> I disagree with that definition of how libcurl works and what its role is.
>
> libcurl does not upload specific files from specific seek points. It uploads
> what the application tells it to upload and it obeys what is getting passed to
> it.
>
Grzegorz provides libcurl with two parameters: CURLOPT_SEEKFUNCTION, CURLOPT_SEEKDATA. This is why he expects libcurl to perform all seeks by itself. How about resuming upload after part of the file is already on the server? Libcurl obtains the remote file size by SIZE command and performs seek on CURLOPT_SEEKDATA using CURLOPT_SEEKFUNCTION, because only libcurl knows the correct position in file to begin the transfer with. So you can't say "What is the correct place is only known by the application".
Regards
Marcin Adamski
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-04-20