On Sunday December 14, 2003 07:49, Fergal Daly wrote: > On Saturday 13 December 2003 20:39, David Robins wrote: > > parse() will return: > > 0 on completion of request (call request() to get the request, call > > data() to get any extra data) > > >0 meaning we want (at least - may want more later if we're using chunked > > encoding) that many bytes > > -1 meaning we want an indeterminate amount of bytes > > -2 meaning we want (at least) a line of data > > parse() will also accept undef as a parameter > > That looks good. Is it ok to give less than n when the parser asks for n? > Also, is it ok to give less than a line when the parser asks for a line? If > not then every client will have write their own buffering code so they can > build up the necessary length, it would be much better for the parser to > handle that,
Yes, it is, the return values are just "hints". Of course if it asks for n and you give it m < n it'll return back n-m the next time, and if you give it less than a line and it asked for a line it will return the "line-hint" (-2) again. -- Dave Isa. 40:31
