[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Buffered reading in LuaSocket..
- From: Duck <duck@...>
- Date: Mon, 17 Mar 2008 19:12:14 +1100 (EST)
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
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
Thanks for the speedy response.