Added IPv6 check to HeaderUtil::setCookie + refactored for readability