lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


2017-04-18 13:15 GMT+02:00 Alexey Melnichuk <alexeymelnichuck@gmail.com>:
> Здравствуйте, Dirk.
>
> Вы писали 17 апреля 2017 г., 17:23:47:
>
>> If the server sends >16363 bytes, some bytes are lost.
>
>> It looks as if all completed blocks of 16384 bytes are overwritten
>> and only the remnant is passed through to to the user.
>
>> I'll have a read in the source but I am sure bigger experts
>> than me will beat me to the punch.
>
>
> Just tested this code with download ~9M zip archive.
> It has several sequence chunks series with size 16384.
> All seems correct.
>
>> local curl = require "cURL"
>> local url = "https://github.com/fusionpbx/fusionpbx/archive/4.2.2.zip";
>> local c = curl.easy{
>>   url = url,
>>   ssl_verifypeer = false,
>>   ssl_verifyhost = false,
>>   followlocation = true,
>> }
>> print(curl._NAME, curl._VERSION)
>> print(curl.version())
>> local f, i = assert(io.open('test.zip', 'w+b')), 0;
>> c:setopt_writefunction(function(chunk)
>>   i = i + 1
>>   if (#chunk > 4096) then print(i, #chunk) end
>>   f:write(chunk)
>> end)
>> c:perform()
>> f:close()
>
> PS. Versions is:
>  * Lua-cURL 0.3.6-dev
>  * libcurl/7.49.0 OpenSSL/1.0.1c zlib/1.2.7 WinIDN

I am (in principle for this project) using what I get from LuaRocks.

$ luarocks show lua-curl

Lua-cURL 0.3.6-1 - Lua binding to libcurl

License:     MIT/X11
Homepage:     https://github.com/Lua-cURL
Installed in:     /usr/local

Modules:
    cURL (/usr/local/share/lua/5.3/cURL.lua)
    cURL.impl.cURL (/usr/local/share/lua/5.3/cURL/impl/cURL.lua)
    cURL.safe (/usr/local/share/lua/5.3/cURL/safe.lua)
    cURL.utils (/usr/local/share/lua/5.3/cURL/utils.lua)
    lcurl (/usr/local/lib/lua/5.3/lcurl.so)

I have verified that the problem is present also if I require 'lcurl'
rather than 'cURL'.

My system is Ubuntu 16.04.2 LTS .