Set length on cURL write
This commit is contained in:
@@ -611,7 +611,7 @@ namespace lime {
|
|||||||
value _bytes = bytes->Value ((value)bytesRoot->Get ());
|
value _bytes = bytes->Value ((value)bytesRoot->Get ());
|
||||||
|
|
||||||
curl_gc_mutex.Unlock ();
|
curl_gc_mutex.Unlock ();
|
||||||
length = val_int ((value)writeCallback->Call (_bytes));
|
length = val_int ((value)writeCallback->Call (_bytes, alloc_int (position)));
|
||||||
curl_gc_mutex.Lock ();
|
curl_gc_mutex.Lock ();
|
||||||
|
|
||||||
if (length == CURL_WRITEFUNC_PAUSE) {
|
if (length == CURL_WRITEFUNC_PAUSE) {
|
||||||
@@ -715,7 +715,7 @@ namespace lime {
|
|||||||
writeBufferPosition[easy_handle] = 0;
|
writeBufferPosition[easy_handle] = 0;
|
||||||
|
|
||||||
curl_gc_mutex.Unlock ();
|
curl_gc_mutex.Unlock ();
|
||||||
length = *((int*)writeCallback->Call (bytes));
|
length = *((int*)writeCallback->Call (bytes, &position));
|
||||||
curl_gc_mutex.Lock ();
|
curl_gc_mutex.Lock ();
|
||||||
|
|
||||||
if (length == CURL_WRITEFUNC_PAUSE) {
|
if (length == CURL_WRITEFUNC_PAUSE) {
|
||||||
|
|||||||
@@ -203,9 +203,13 @@ class CURL {
|
|||||||
case CURLOption.WRITEFUNCTION:
|
case CURLOption.WRITEFUNCTION:
|
||||||
|
|
||||||
var callback:CURL->Bytes->Int = cast parameter;
|
var callback:CURL->Bytes->Int = cast parameter;
|
||||||
parameter = function (bytes:Bytes) {
|
parameter = function (bytes:Bytes, length:Int) {
|
||||||
|
|
||||||
return callback (this, bytes);
|
var cacheLength = bytes.length;
|
||||||
|
@:privateAccess bytes.length = length;
|
||||||
|
var read = callback (this, bytes);
|
||||||
|
@:privateAccess bytes.length = cacheLength;
|
||||||
|
return read;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user