Get the base domain used for the cookie.
772617
protected function getBaseDomain() {
    // The base domain is stored in the metadata cookie if not we fallback
    // to the current hostname
    $metadata = $this->getMetadataCookie();
    if (array_key_exists('base_domain', $metadata) &&
        !empty($metadata['base_domain'])) {
      return trim($metadata['base_domain'], '.');
    }
    return $this->getHttpHost();
  }
1154529
public void getCookieData() {

        // get the PC type cookie
        Cookie pcTypeCookie = getCookie(getRequest(), COOKIE_PCTYPE);
        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(pcTypeCookie.getValue())) {
            // only set the data if needed
            if (m_pcType == null) {
                m_pcType = pcTypeCookie.getValue();
            }
        }
        if ("null".equals(m_pcType)) {
            m_pcType = null;
        }
        // get other cookies only on private PC types (or if security option is disabled)
        if ((m_pcType == null) || PCTYPE_PRIVATE.equals(m_pcType)) {
            // get the user name cookie
            Cookie userNameCookie = getCookie(getRequest(), COOKIE_USERNAME);
            if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(userNameCookie.getValue())) {
                // only set the data if needed
                if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_username)) {
                    m_username = userNameCookie.getValue();
                }
                if (m_pcType == null) {
                    // set PC type to private PC if the user cookie is found
                    m_pcType = PCTYPE_PRIVATE;
                }
            }
            if ("null".equals(m_username)) {
                m_username = null;
            }
            // get the organizational unit cookie
            Cookie ouFqnCookie = getCookie(getRequest(), COOKIE_OUFQN);
            if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(ouFqnCookie.getValue())) {
                // only set the data if needed
                if (m_oufqn == null) {
                    m_oufqn = ouFqnCookie.getValue();
                }
            }
            if ("null".equals(m_oufqn)) {
                m_oufqn = null;
            }
        }
    }
814668
def get_domain(self):
        
        if hasattr(self, 'domain'):
            return Domain(self.rest_client.make_request(self.domain), self.rest_client)
478955
def get_domain(self):
        
        points = np.vstack([place.get_domain() for place in self])
        return np.array([points.min(axis=0), points.max(axis=0)])
591941
def security(self, domain):
        '''
        '''
        uri = self._uris["security"].format(domain)
        return self.get_parse(uri)
860427
def base_url(self, value):
        """"""
        logger.debug('StackInABox({0}): Updating URL from {1} to {2}'
                     .format(self.__id, self.__base_url, value))
        self.__base_url = value
        for k, v in six.iteritems(self.services):
            matcher, service = v
            service.base_url = StackInABox.__get_service_url(value,
                                                             service.name)
            logger.debug('StackInABox({0}): Service {1} has url {2}'
                         .format(self.__id, service.name, service.base_url))
1129864
def parse_cookies(self, req: Request, name: str, field: Field) -> typing.Any:
        """"""
        return core.get_value(req.cookies, name, field)
256214
@Deprecated
	String getCookieString() {
		StringBuilder result = new StringBuilder();
		boolean first = true;
		for (Entry<String, String> entry : this.cookies.entrySet()) {
			if (first) {
				first = false;
			} else {
				result.append("; ");
			}
			result.append(entry.getKey());
			if (!"".equals(entry.getValue())) {
				result.append("=").append(entry.getValue());
			}

		}
		return result.toString();
	}
1022342
public function cookieDomain(UriInterface $uri): ?string
    {
        $host = $uri->getHost();
        if (empty($host)) {
            return null;
        }

        $pattern = $this->config['cookies']['domain'];
        if (preg_match("/^(\d{1,3}){4}:\d+$/", $host, $matches)) {
            // remove port
            $host = $matches[1];
        }

        if (filter_var($host, FILTER_VALIDATE_IP) || $host == 'localhost') {
            //We can't use sub-domains when website required by IP
            $pattern = ltrim($pattern, '.');
        }

        if (strpos($pattern, '%s') === false) {
            //Forced domain
            return $pattern;
        }

        return sprintf($pattern, $host);
    }
1236779
public Cookie get(String name, String domain) {
		for(Cookie cookie : this) {
			if(cookie.getName().equals(name) && cookie.getDomain().equals(domain))
				return cookie; 
		}
		return null;
	}
233041
public function getBaseUrl()
    {
        return $this->getScheme() . $this->getBasicAuth() . $this->getHost() . ":" . $this->getPort() . $this->getEndpoint();
    }
282273
def get_domain(self):
        
        if self.domain is None:
            return np.array([self.points.min(axis=0), 
                             self.points.max(axis=0)])
        return self.domain
398516
def find_cookie(self):
        
        return_cookies = []
        origin_domain = self.request_object.dest_addr
        for cookie in self.cookiejar:
            for cookie_morsals in cookie[0].values():
                cover_domain = cookie_morsals['domain']
                if cover_domain == '':
                    if origin_domain == cookie[1]:
                        return_cookies.append(cookie[0])
                else:
                    # Domain match algorithm
                    bvalue = cover_domain.lower()
                    hdn = origin_domain.lower()
                    nend = hdn.find(bvalue)
                    if nend is not False:
                        return_cookies.append(cookie[0])
        return return_cookies
1334961
public GetDomainCacheTTLResponse getDomainCacheTTL(String domain) {
        GetDomainCacheTTLRequest request = new GetDomainCacheTTLRequest().withDomain(domain);
        return getDomainCacheTTL(request);
    }
1215616
def return_ok(self, cookie, request):
        
        # Path has already been checked by .path_return_ok(), and domain
        # blocking done by .domain_return_ok().
        _debug(" - checking cookie %s=%s", cookie.name, cookie.value)

        for n in "version", "verifiability", "secure", "expires", "port", "domain":
            fn_name = "return_ok_"+n
            fn = getattr(self, fn_name)
            if not fn(cookie, request):
                return False
        return True
1044230
def set_cookie(self, cookie):
		'''
		
		'''

		# Function path: Network.setCookie
		# Domain: Network
		# Method name: setCookie
		# WARNING: This function is marked 'Experimental'!
		# Parameters:
		#         Required arguments:
		#                 'url' (type: string) -> The request-URI to associate with the setting of the cookie. This value can affect the default domain and path values of the created cookie.
		#                 'name' (type: string) -> The name of the cookie.
		#                 'value' (type: string) -> The value of the cookie.
		#         Optional arguments:
		#                 'domain' (type: string) -> If omitted, the cookie becomes a host-only cookie.
		#                 'path' (type: string) -> Defaults to the path portion of the url parameter.
		#                 'secure' (type: boolean) -> Defaults ot false.
		#                 'httpOnly' (type: boolean) -> Defaults to false.
		#                 'sameSite' (type: CookieSameSite) -> Defaults to browser default behavior.
		#                 'expirationDate' (type: Timestamp) -> If omitted, the cookie becomes a session cookie.
		# Returns:
		#         'success' (type: boolean) -> True if successfully set cookie.

		# Description: Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.

		assert isinstance(cookie, http.cookiejar.Cookie), 'The value passed to `set_cookie` must be an instance of http.cookiejar.Cookie().' + \
			' Passed: %s ("%s").' % (type(cookie), cookie)

		# Yeah, the cookielib stores this attribute as a string, despite it containing a
		# boolean value. No idea why.
		is_http_only = str(cookie.get_nonstandard_attr('httponly', 'False')).lower() == "true"


		# I'm unclear what the "url" field is actually for. A cookie only needs the domain and
		# path component to be fully defined. Considering the API apparently allows the domain and
		# path parameters to be unset, I think it forms a partially redundant, with some
		# strange interactions with mode-changing between host-only and more general
		# cookies depending on what's set where.
		# Anyways, given we need a URL for the API to work properly, we produce a fake
		# host url by building it out of the relevant cookie properties.
		fake_url = urllib.parse.urlunsplit((
				"http" if is_http_only else "https",  # Scheme
				cookie.domain,                        # netloc
				cookie.path,                          # path
				'',                                   # query
				'',                                   # fragment
			))

		params = {
				'url'      : fake_url,

				'name'     : cookie.name,
				'value'    : cookie.value if cookie.value else "",
				'domain'   : cookie.domain,
				'path'     : cookie.path,
				'secure'   : cookie.secure,
				'expires'  : float(cookie.expires) if cookie.expires else float(2**32),

				'httpOnly' : is_http_only,

				# The "sameSite" flag appears to be a chromium-only extension for controlling
				# cookie sending in non-first-party contexts. See:
				# https://bugs.chromium.org/p/chromium/issues/detail?id=459154
				# Anyways, we just use the default here, whatever that is.
				# sameSite       = cookie.xxx
			}

		ret = self.Network_setCookie(**params)

		return ret
96679
def get_domain_id_for_operation(request):
    

    domain_context = request.session.get('domain_context')
    if domain_context:
        return domain_context
    return api.keystone.get_effective_domain_id(request)