more fixes for keep_alive

The 3.8 already had lots of fixed but I merged some of my own I used for
further security while adding it myself to 3.7

Also description in user manual

The thing I'am not sure about, why send 500 Server error when connection
closed, it will not be sent anyways right?