def _findMessageBytes ( self, data ):
<EOL>self.syncBuffer()<EOL>try:<EOL><INDENT>i = data.index ( '<STR_LIT>' )<EOL><DEDENT>except ValueError:<EOL><INDENT>return ( <NUM_LIT:0>, <NUM_LIT:0> )<EOL><DEDENT>_hdr = self.buffer[:i]<EOL>match = content_length_re.search ( _hdr )<EOL>if match:<EOL><INDENT>content_length = int ( match.groups()[<NUM_LIT:0>] )<EOL>req_len = i + len_sep + content_length + len_footer<EOL>if len ( data ) < req_len:<EOL><INDENT>return ( <NUM_LIT:0>, <NUM_LIT:0> )<EOL><DEDENT>else:<EOL><INDENT>return ( req_len, i )<EOL><DEDENT><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>j = data.index ( '<STR_LIT>' )<EOL><DEDENT>except ValueError:<EOL><INDENT>return ( <NUM_LIT:0>, <NUM_LIT:0> )<EOL><DEDENT>return ( j + <NUM_LIT:2>, i )<EOL><DEDENT>
I examine the data passed to me and return a 2-tuple of the form:

  ( message_length, header_length )

where message_length is the length in bytes of the first complete
message, if it contains at least one message, or 0 if it
contains no message.

If message_length is non-zero, header_length contains the length in
bytes of the header. If message_length is zero, header_length should
be ignored.

You should probably not call me directly. Call getOneMessage instead.