diff --git a/gb.net.curl/src/CCurl.c b/gb.net.curl/src/CCurl.c index 8496265cf..fae0c86c9 100644 --- a/gb.net.curl/src/CCurl.c +++ b/gb.net.curl/src/CCurl.c @@ -187,13 +187,14 @@ void CURL_raise_connect(void *_object) void CURL_raise_read(void *_object) { - int len = GB.StringLength(THIS->data); GB.Raise(THIS, EVENT_READ, 0); - if (THIS->data && GB.StringLength(THIS->data) != len) + + if (!GB.Stream.Eof(&THIS->stream)) { GB.Ref(THIS); GB.Post(CURL_raise_read, (intptr_t)THIS); } + GB.Unref(POINTER(&_object)); } diff --git a/main/gbx/gbx_api.c b/main/gbx/gbx_api.c index a1f8c75b1..59b7f94ca 100644 --- a/main/gbx/gbx_api.c +++ b/main/gbx/gbx_api.c @@ -273,6 +273,7 @@ const void *const GAMBAS_Api[] = (void *)GB_StreamRead, (void *)GB_StreamWrite, (void *)STREAM_get_readable, + (void *)STREAM_eof, (void *)STRING_start_len, (void *)STRING_end, diff --git a/main/share/gambas.h b/main/share/gambas.h index 43e6b3de4..585fe9e90 100644 --- a/main/share/gambas.h +++ b/main/share/gambas.h @@ -1102,6 +1102,7 @@ typedef int (*Read)(GB_STREAM *stream, void *addr, int len); int (*Write)(GB_STREAM *stream, void *addr, int len); int (*GetReadable)(GB_STREAM *stream, int *len); + bool (*Eof)(GB_STREAM *stream); } Stream;