Set-Cookie: <name>=<value>[; <name>=<value>]...
[; expires=<date>][; domain=<domain_name>]
[; path=<some_path>][; secure][; httponly]
168871
@Override
    public void addSSOCookiesToResponse(Subject subject, HttpServletRequest req, HttpServletResponse resp) {
        if (!allowToAddCookieToResponse(req))
            return;

        addJwtSsoCookiesToResponse(subject, req, resp);

        if (!JwtSSOTokenHelper.shouldAlsoIncludeLtpaCookie()) {
            return;
        }

        SingleSignonToken ssoToken = getDefaultSSOTokenFromSubject(subject);
        if (ssoToken == null) {
            return;
        }

        byte[] ssoTokenBytes = ssoToken.getBytes();
        if (ssoTokenBytes == null) {
            return;
        }

        ByteArray cookieBytes = new ByteArray(ssoTokenBytes);
        String cookieByteString = cookieByteStringCache.get(cookieBytes);
        if (cookieByteString == null) {
            cookieByteString = StringUtil.toString(Base64Coder.base64Encode(ssoTokenBytes));
            updateCookieCache(cookieBytes, cookieByteString);
        }

        Cookie ssoCookie = createCookie(req, cookieByteString);
        resp.addCookie(ssoCookie);
    }
1340976
function Cookie(
  name,
  value,
  pathOrDomain,
  dateOrPath,
  date,
  isSecure
  ) {
  var _name = '';
  var _value = '';
  var _domain = null;
  var _path = '/';
  var _date = null;
  var _expiry = null;
  var _isSecure = false;

  var cookie;
  var numOfArgs = arguments.length > 6 ? 6 : arguments.length;

  if (assert(name).extends(Instance).isValid) {
    cookie = name._instance;
    _name = cookie.getNameSync();
    _value = cookie.getValueSync();
    _domain = cookie.getDomainSync();
    _path = cookie.getPathSync();
    _expiry = cookie.getExpirySync() ?
      new Date(cookie.getExpirySync().getTimeSync()) :
      null;
    _isSecure = cookie.isSecureSync();
  } else {
    validateArgIsString(name, 'name');
    validateArgIsString(value, 'value');
    _name = name;
    _value = value;
    switch (numOfArgs) {
      case 2:
        cookie = new Class(_name, _value);
        break;
      case 3:
        validateArgIsString(pathOrDomain, 'path');
        _path = pathOrDomain;
        cookie = new Class(_name, _value, _path);
        break;
      case 4:
        validateArgIsString(pathOrDomain, 'path');
        _path = pathOrDomain;
        if (dateOrPath instanceof Date) {
          dateOrPath = roundDateToSeconds(dateOrPath);
          _date = createDate(dateOrPath);
          _expiry = dateOrPath;
        }
        cookie = new Class(_name, _value, _path, _date);
        break;
      case 5:
        validateArgIsString(pathOrDomain, 'domain');
        validateArgIsString(dateOrPath, 'path');
        _domain = pathOrDomain;
        _path = dateOrPath;
        if (date instanceof Date) {
          date = roundDateToSeconds(date);
          _date = createDate(date);
          _expiry = date;
        }
        cookie = new Class(_name, _value, _domain, _path, _date);
        break;
      case 6:
        validateArgIsString(pathOrDomain, 'domain');
        validateArgIsString(dateOrPath, 'path');
        validateArgIsBoolean(isSecure, 'isSecure');
        _domain = pathOrDomain;
        _path = dateOrPath;
        if (date instanceof Date) {
          date = roundDateToSeconds(date);
          _date = createDate(date);
          _expiry = date;
        }
        _isSecure = isSecure;
        cookie = new Class(
          _name,
          _value,
          _domain,
          _path,
          _date ? _date : null,
          _isSecure
          );
        break;
      default:
        throw new Error('cookies require a name and a value at minimum.');
    }
  }

  addFinalProp(this, '_instance', cookie);
  addFinalProp(this, '_name', _name);
  addFinalProp(this, '_value', _value);
  addFinalProp(this, '_domain', _domain);
  addFinalProp(this, '_path', _path);
  addFinalProp(this, '_expiry', _expiry);
  addFinalProp(this, '_isSecure', _isSecure);
}
1216348
public function set($key, $value, $time = 86400, $path = '/', $domain = null, $secure = false, $httpOnly = true)
    {
        if ($domain === null) {
            $domain = $this->domain;
        }
        $key = $this->prefix . $key;
        if (!is_cli()) {
            setcookie($key, $value, time() + $time, $path, $domain, $secure, $httpOnly);
        }
        $_COOKIE[$key] = $value;

        return $this;
    }
316551
def create_cookie(
        key: str,
        value: str='',
        max_age: Optional[Union[int, timedelta]]=None,
        expires: Optional[Union[int, float, datetime]]=None,
        path: str='/',
        domain: Optional[str]=None,
        secure: bool=False,
        httponly: bool=False,
) -> SimpleCookie:
    
    cookie = SimpleCookie()
    cookie[key] = value
    cookie[key]['path'] = path
    cookie[key]['httponly'] = httponly  # type: ignore
    cookie[key]['secure'] = secure  # type: ignore
    if isinstance(max_age, timedelta):
        cookie[key]['max-age'] = f"{max_age.total_seconds():d}"
    if isinstance(max_age, int):
        cookie[key]['max-age'] = str(max_age)
    if expires is not None and isinstance(expires, (int, float)):
        cookie[key]['expires'] = format_date_time(int(expires))
    elif expires is not None and isinstance(expires, datetime):
        cookie[key]['expires'] = format_date_time(expires.replace(tzinfo=timezone.utc).timestamp())
    if domain is not None:
        cookie[key]['domain'] = domain
    return cookie
317923
public static void setCookie(HttpServletResponse response, String name, String value, String path) {

		Cookie cookie = new Cookie(name, value);
		cookie.setSecure(false);
		cookie.setPath(path);
		cookie.setMaxAge(3600 * 24 * 30); // 30 days

		response.addCookie(cookie);
	}
1057558
public function set(
        $name = '',
        $value = '',
        $expire = 0,
        $path = '/',
        $domain = '',
        $secure = false,
        $httpOnly = false
    ) {
        if (empty($value)) {
            Craft::$app->response->cookies->remove($name);
        } else {
            $domain = empty($domain) ? Craft::$app->getConfig()->getGeneral()->defaultCookieDomain : $domain;
            $expire = (int)$expire;
            setcookie($name, $value, $expire, $path, $domain, $secure, $httpOnly);
            $_COOKIE[$name] = $value;
        }
    }
1007963
public function set($name, $value, $expire=0, $path='', $domain='', $secure=FALSE, $httponly=FALSE) {
		$_COOKIE[$name] = $this->encrypt( $value );
		return setcookie($name, $_COOKIE[$name], $expire, $path, $domain, $secure, $httponly);
	}
1086741
public function setCookie($name, $value, $expire = 0, $path = null, $domain = null, $secure = false, $httpOnly = true)
    {
        $context = $this->_context;

        if ($expire > 0) {
            $current = time();
            if ($expire < $current) {
                $expire += $current;
            }
        }

        $context->cookies[$name] = [
            'name' => $name,
            'value' => $value,
            'expire' => $expire,
            'path' => $path,
            'domain' => $domain,
            'secure' => $secure,
            'httpOnly' => $httpOnly
        ];

        $globals = $this->request->getGlobals();

        $globals->_COOKIE[$name] = $value;

        return $this;
    }
782753
public function rawcookie($name, $value = null, $expire = null, $path = '/', $domain = null, $secure = null, $httponly = null)
    {
        $cookie = [];
        foreach (['name', 'value', 'expire', 'path', 'domain', 'secure', 'httponly'] as $key) {
            $cookie[$key] = $$key;
        }
        $this->cookie[] = $cookie;
    }
853499
function set(key, value, options) {
    options = typeof options ==='object' ? options : { expires: options };

    let expires = options.expires != null ? options.expires : defaults.expires;

    if (typeof expires === 'string' && expires !== '') {
        expires = new Date(expires);
    } else if (typeof expires === 'number') {
        expires = new Date(+new Date + (1000 * day * expires));
    }

    if (expires && 'toGMTString' in expires) {
        expires = ';expires=' + expires.toGMTString();
    }

    let path = ';path=' + (options.path || defaults.path);

    let domain = options.domain || defaults.domain;
    domain = domain ? ';domain=' + domain : '';

    let secure = options.secure || defaults.secure ? ';secure' : '';

    if (typeof value == 'object') {
        if (Array.isArray(value) || isPlainObject(value)) {
            value = JSON.stringify(value);
        } else {
            value = '';
        }
    }

    document.cookie = encodeCookie(key) + '=' + encodeCookie(value) + expires + path + domain + secure;
}
200460
public static void setCookie(HttpServletResponse response, String name,
                                 String value, String domain, int maxAge) {
        if (value == null) {
            value = "";
        }
        Cookie cookie = new Cookie(name, value);
        cookie.setMaxAge(maxAge);
        if (domain != null && !"".equals(domain)) {
            cookie.setDomain(domain);
        }
        cookie.setPath("/");
        response.addCookie(cookie);
    }
567816
public function setCookie($name, $value, $expires, $domain)
	{
		setcookie($name, $value, $expires, $domain);
		$_COOKIE[$name] = $value;
	}
952010
def create_cookie(name, value, **kwargs):
    
    result = {
        'version': 0,
        'name': name,
        'value': value,
        'port': None,
        'domain': '',
        'path': '/',
        'secure': False,
        'expires': None,
        'discard': True,
        'comment': None,
        'comment_url': None,
        'rest': {'HttpOnly': None},
        'rfc2109': False,
    }

    badargs = set(kwargs) - set(result)
    if badargs:
        err = 'create_cookie() got unexpected keyword arguments: %s'
        raise TypeError(err % list(badargs))

    result.update(kwargs)
    result['port_specified'] = bool(result['port'])
    result['domain_specified'] = bool(result['domain'])
    result['domain_initial_dot'] = result['domain'].startswith('.')
    result['path_specified'] = bool(result['path'])

    return cookielib.Cookie(**result)
1179390
public static function set($key, $value = '', $time = 0, $path = '/', $domain = '', $secure = FALSE, $httponly = FALSE) {
        return setcookie($key, self::encode($value), time() + $time, $path, $domain, $secure, $httponly);
    }
60174
function setCookie (key, value, expires) {
  var domain = document.domain
  let date = new Date()
  date.setTime(Date.now() + expires)
  document.cookie = `${key}=${escape(value)};path=/;expires=${date.toGMTString()};domain=${domain};`
}
515208
public function setCookieParams($lifetime, $path=NULL, $domain=NULL, $secure=FALSE, $httponly= FALSE){
        session_set_cookie_params($lifetime, $path, $domain, $secure, $httponly);
    }
1134304
protected function setCookie($name, $value = null, $expire = null, $domainPath = null, $https = null, $httpOnly = null)
    {
        return setcookie($name, $value, $expire, $domainPath, $https, $httpOnly);
    }