BUG/MAJOR: lua: send function fails and return bad bytes

In some cases the Lua "send" function fails. This is caused by the
return of "buffer_replace2()" is not tested. I checked avalaible space
in the buffer and I supposed than "buffer_replace2()" took all the
data. In some cases, "buffer_replace2()" cannot take the incoming
data, it returns the amount of data copied.

This patch check the amount of data really copied by "buffer_replace2()"
and advance the buffer with taking this value in account.
1 file changed