Adding check_connection function

This function is used by the web server modules to ensure that the
connection has not been interrupted.