Uncaught exceptions in http.py

I’m using the Home Assistant Raspberry PI image. I noticed a lot of uncaught exceptions in the home-assistant.log file. It was in the ~/.homeassistant/deps/websockets/http.py file. Changing read_line() to the below code seems to have fixed it. The webpage loads noticeably faster now too. Especially the History section. I’m not sure how they’re related though.

def read_line(stream):
    """
    Read a single line from ``stream``.

    """
    try:
        line = yield from stream.readline()
    except:
        line = str("")
    if len(line) > MAX_LINE:
        raise ValueError("Line too long")
    if not line.endswith('\r\n'):
        raise ValueError("Line without CRLF")
    return line

websockets is a dependency of Home Assistant. I guess that it would be better to talk to the upstream author at https://github.com/aaugustin/websockets.

Thanks, I’m still figuring out how the HA code is organized.