fix NULL access
turn down the keepalive flag if impossible to determine the end of the response
add config vars related to keepalive
close the downstream response when upstream closes with no data