add pac support
fix http gateway
ensure connection close