Another pass at making the HTTP_X_FORWARDED_FOR and REMOTE_ADDR access as safe as possible.