lua-http icon indicating copy to clipboard operation
lua-http copied to clipboard

Issue with get_next_chunk() function in get_body_chars()

Open obulesu458 opened this issue 1 year ago • 0 comments

Sometines,the get_next_chunk() function and the get_body_chars() function in lua-http stream does not return full body of the request. Currently, when I make a request with a content length of 1.1MB, the get_next_chunk() function only returns 1MB of data. This results in an incomplete body being processed. Due to this in "get_body_chars(n, timeout)", a condition is met where the block size( n ) exceeds the available body size, causing an infinite loop. No error is thrown in this case, and the timeout does not work. below is the Lua pseudo code how did I use :

` function (http_stream)

    return coroutine :

            for chunk in http_stream:get_body_chars():

                    get chunk

                    yield chunk

            end

end

`

but it works as expected and gives all chunks of data when I do the same outside the coroutine. Any reason?

obulesu458 avatar Jan 27 '24 09:01 obulesu458