cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl tftp (was: problem with large files)

From: <koettermarkus_at_gmx.de>
Date: Fri, 07 Aug 2009 00:34:06 +0200

Hi,

NCarolina 350 wrote:
> Hi,
> This is a followup to my message last week. The tftp client in libcurl
> 7.19.5 does not transfer files larger than 32MB correctly. After some
> investigation, I found:

Sorry to hijack your thread, but ...

I had a look on curls tftp myself lately, and found it in a hard-to-use
state, as it is blocking code.
I had a look on the archive, and for 7.16.2 there was a great patch
which rewrote major parts of the tftp client code, to make it useable
within a curl_multi environment.
Due to changes, the patch did not apply when it was delivered, was
discarded therefore, and nobody took care to provide an updated version.

I just gave it a shot, copying the patched tftp.c version from 7.16.2 to
7.16.6, adjusting the Curl_handler, patched urldata.h CLOSEACTION.
As I was unable to figure out how keywords are meant to work, I had to
grep the tftp test numbers ...
For the record:

/usr/bin/perl -I. ./runtests.pl -a -v 271 283 284 285 296 1007 1009 1049
1093 1094 1099 2002 2004

1099 failed initially, as the tftp connections were reused, as I was
unable to figure out where to reset the tftp_state data, I decided not
to reuse connections for tftp for now.

The initial patch had many warnings for invalid casts, I took care of
them, changed some data types to workaround problems like:
size_t sbytes
(int *)&sbytes

as on 64bit:
sizeof int is 4
sizeof size_t is 8

Patch for curl-7.19.6-20090806 is attached, I'd be glad if you could
manage to apply it after 7.19.6 release, and take care of tftp large
file support afterwards, taking the new tftp code.

I'm pretty confident it may cause some regression initially, but I think
its better to move the tftp code to a curlish state now, than later, as
later will cause even more regression.

For me, curls current tftp code is not useable, therefore I took the
time to adjust the patch.

Markus

Received on 2009-08-07