curl-library
Re: SMB long local write
Date: Mon, 8 Dec 2014 15:04:03 +0100 (CET)
On Mon, 8 Dec 2014, Patrick Monnerat wrote:
> Downloading a SMB file larger than 16K (CURL_MAX_WRITE_SIZE) with a
> DEBUGBUILD curl gives:
>
> Warning: Data size exceeds single call write limit!
>
> and the corresponding data is lost.
>
> Obviously, SMB writes data chunks larger than CURL_MAX_WRITE_SIZE! I don't
> know how (where) you want to fix it, thus I just report the problem to the
> list.
Thanks!
The problem is that a too large buffer is passed to Curl_client_write(), since
that is potentially done as a callback to the user and we have a defined
maximum size we must keep within. It must thus at least be converted into a
loop of calls.
It also makes me curious where the values for MAX_PAYLOAD_SIZE and
MAX_MESSAGE_SIZE come from? Also, if we could be happy with
CURL_MAX_WRITE_SIZE sized buffer we could aavoid the extra allocations in
smb.c compeletely! They are a bit disturbing since we already alloc two 16K
buffers that are just wasted when SMB is used.
Additionally: Curl_client_write() is used without checking the return code
which is a major nono [*]. It MUST check the return code and bail out on
errors.
[*] = I intend to work on adding a gcc specific warning for the functions that
we consider most important to check the return code for, to catch mistakes
like this easier.
-- / daniel.haxx.se ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2014-12-08