Use discriminated union for HTTP response; and check for keep-alive once per loop