def find_double_newline(s):
    """Returns the position just after a double newline in the given string."""
    pos1 = s.find(b"\n\r\n")  # One kind of double newline
    if pos1 >= 0:
        pos1 += 3
    pos2 = s.find(b"\n\n")  # Another kind of double newline
    if pos2 >= 0:
        pos2 += 2

    if pos1 >= 0:
        if pos2 >= 0:
            return min(pos1, pos2)
        else:
            return pos1
    else:
        return pos2
The product acts as an intermediary HTTP agent
         (such as a proxy or firewall) in the data flow between two
         entities such as a client and server, but it does not
         interpret malformed HTTP requests or responses in ways that
         are consistent with how the messages will be processed by
         those entities that are at the ultimate destination.