lua-users home
lua-l archive

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



Input is buffered in LuaSocket, so I don't
understand the subject of the message.

I should have said something like: "Buffered reading in Lua atop LuaSocket."

The current API does not support a limit on the size of
the input when you use patterns "*l" or "*a".

If you really need to limit the amount of input

I can't write a safe (DoS-resistant) line-oriented server without it, esp. for SMTP, not least because there are still SMTP clients which send large emails as one huge line of text. I want to be able to detect that the amount of SMTP data has exceeded some user-defined maximum _as it exceeds_ that maximum, rather than (possily long) after having already received (possibly much) more than the maximum.

you'd have to do something similar to what you suggested,
although you'd need something slightly more sophisticated.

I assume you are not using coroutines with non-blocking I/O,
so I'd implement something like this:

Thanks. Is it better to use select() than to use receive(1) with a timeout followed by receive(bytesleft) without one? Errr, yes. I think it is. Much clearer, anyway.

Thanks for the speedy response.