Return the content of a cookie. To read a `Signed Cookies`, use the
            same `secret` as used to create the cookie (see
            :meth:`Response.set_cookie`). If anything goes wrong, None is
            returned.
178101
def get_cookie(self, key, secret=None):
        
        value = self.COOKIES.get(key)
        if secret and value:
            dec = cookie_decode(value, secret) # (key, value) tuple or None
            return dec[1] if dec and dec[0] == key else None
        return value or None
492303
def _get_token_from_cookies(self, request, refresh_token):
        
        if refresh_token:
            cookie_token_name_key = "cookie_refresh_token_name"
        else:
            cookie_token_name_key = "cookie_access_token_name"
        cookie_token_name = getattr(self.config, cookie_token_name_key)
        return request.cookies.get(cookie_token_name(), None)
1254611
def COOKIES(self):
        
        raw_dict = SimpleCookie(self.headers.get('Cookie',''))
        cookies = {}
        for cookie in six.itervalues(raw_dict):
            cookies[cookie.key] = cookie.value
        return cookies
416074
def get_decoded_jwt(request):
    
    jwt_cookie = request.COOKIES.get(jwt_cookie_name(), None)

    if not jwt_cookie:
        return None
    return jwt_decode_handler(jwt_cookie)
1337796
def parse_cookie cookie_content
      out = {}
      CGI::Cookie::parse(cookie_content).each do |key, cookie|
        unless ['expires', 'path'].include? key
          out[CGI::escape(key)] = cookie.value[0] ? (CGI::escape(cookie.value[0]) || '') : ''
        end
      end
      out
    end
1120895
function getCookieToken(res) {
		var value = res.req.cookies[cookieName(res.req)];
		if (!value)
			return false;

		var parts = value.split('|');

		// If the existing cookie is invalid, reject it.
		if (parts.length !== 3)
			return false;

		// If the user data doesn't match this request's user, reject the cookie
		if (parts[1] !== getUserData(res.req))
			return false;

		var hasher = crypto.createHmac(options.algorithm, cookieKey);
		hasher.update(parts[0]);
		hasher.update("|");	// Don't confuse longer or shorter userDatas
		hasher.update(parts[1]);

		// If the hash doesn't match, reject the cookie
		if (parts[2] !== hasher.digest('base64'))
			return false;

		return parts[0];
	}
1043313
def wsgiheader(self):
        '''  '''
        for c in self.COOKIES.values():
            if c.OutputString() not in self.headers.getall('Set-Cookie'):
                self.headers.append('Set-Cookie', c.OutputString())
        # rfc2616 section 10.2.3, 10.3.5
        if self.status in (204, 304) and 'content-type' in self.headers:
            del self.headers['content-type']
        if self.status == 304:
            for h in ('allow', 'content-encoding', 'content-language',
                      'content-length', 'content-md5', 'content-range',
                      'content-type', 'last-modified'): # + c-location, expires?
                if h in self.headers:
                     del self.headers[h]
        return list(self.headers.iterallitems())
1229231
def _get_cookie(self, name, domain):
        ''' 
        '''
        for c in self.session.cookies:
            if c.name==name and c.domain==domain:
                return c
        return None
686250
def parse_cookies(response, host):
    
    cookie_pie = []
    try:
        for cookie in response.headers['set-cookie']:
            cookie_jar = {}
            name_val, *rest = cookie.split(';')
            name, value = name_val.split('=', 1)
            cookie_jar['name'] = name.strip()
            cookie_jar['value'] = value
            for item in rest:
                try:
                    name, value = item.split('=')
                    if value.startswith('.'):
                        value = value[1:]
                    cookie_jar[name.lower().lstrip()] = value
                except ValueError:
                    cookie_jar[item.lower().lstrip()] = True
            cookie_pie.append(cookie_jar)
        response.cookies = [Cookie(host, x) for x in cookie_pie]
    except KeyError:
        pass
142852
def _polling_cookie(self):
        
        parsed_url = urlparse(self._response.request.url)
        host = parsed_url.hostname.strip('.')
        if host == 'localhost':
            return {'cookie': self._response.headers.get('set-cookie', '')}
        return {}
1115638
def extract_cookies_to_jar(jar, request, response):
    
    if not (hasattr(response, '_original_response') and
            response._original_response):
        return
    # the _original_response field is the wrapped httplib.HTTPResponse object,
    req = MockRequest(request)
    # pull out the HTTPMessage with the headers and put it in the mock:
    res = MockResponse(response._original_response.msg)
    jar.extract_cookies(res, req)
190368
def copy(self):
		
		copy_cookie = WHTTPCookie(self.__name, self.__value)
		copy_cookie.__attrs = self.__attrs.copy()
		return copy_cookie
1275846
def bake(self, start_response):
        
        if isinstance(self._content, six.text_type):
            self._content = self._content.encode('utf8')

        if self._content_length is None:
            self._content_length = len(self._content)

        self._headers[HttpResponseHeaders.CONTENT_LENGTH] = \
            str(self._content_length)
        headers = list(self._headers.items())
        cookies = [(HttpResponseHeaders.SET_COOKIE, v.OutputString())
                   for _, v in self._cookies.items()]

        if len(cookies):
            headers = list(headers) + cookies
        start_response(self._status_code, headers)

        if isinstance(self._content, six.binary_type):
            return [self._content]

        return self._content
1150916
def get_secure_cookie_key_version(
        self, name: str, value: str = None
    ) -> Optional[int]:
        
        self.require_setting("cookie_secret", "secure cookies")
        if value is None:
            value = self.get_cookie(name)
        if value is None:
            return None
        return get_signature_key_version(value)
347491
def process_response(self, request, response):
        

        if hasattr(request, 'COUNTRY_CODE'):
            response.set_cookie(
                key=constants.COUNTRY_COOKIE_NAME,
                value=request.COUNTRY_CODE,
                max_age=settings.LANGUAGE_COOKIE_AGE,
                path=settings.LANGUAGE_COOKIE_PATH,
                domain=settings.LANGUAGE_COOKIE_DOMAIN
            )
        return response
1150744
def parse_cookie(name, seed, kaka):
    
    if not kaka:
        return None

    cookie_obj = SimpleCookie(kaka)
    morsel = cookie_obj.get(name)

    if morsel:
        parts = morsel.value.split("|")
        if len(parts) != 3:
            return None
            # verify the cookie signature
        sig = cookie_signature(seed, parts[0], parts[1])
        if sig != parts[2]:
            raise SAMLError("Invalid cookie signature")

        try:
            return parts[0].strip(), parts[1]
        except KeyError:
            return None
    else:
        return None
1005933
def process_response(self, request, response):
        """"""
        if COOKIE_KEY not in request.COOKIES:
        # Unknown user, set cookie and go on...
            response.set_cookie(COOKIE_KEY, COOKIE_PASS, httponly=True,
                                expires=datetime.now()+timedelta(days=30))
            # Only logged if we have to set the PASS cookie
            if DJANGOSPAM_LOG:
                logger.log("PASS RESPONSE", request.method, request.path_info,
                           request.META.get("HTTP_USER_AGENT", "undefined"))                
        return response