refine code, donot listen if not enabled http