Sends the HTTP cookies to the client.
Causes output!
483044
protected function sendCookies()
    {
        foreach ($this->cookies as $cookie) {
            setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpireTimestamp(), $cookie->getPath(),
                $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly());
        }
    }
1321174
public function sendHeaders()
    {
        if (!headers_sent()) {
            header(
                sprintf(
                    'HTTP/%s %s %s',
                    $this->getProtocolVersion(),
                    $this->getStatusCode(),
                    ($this->isOk() ? '' : $this->getReasonPhrase())
                ),
                true,
                $this->getStatusCode()
            );

            foreach ($this->header as $name => $value) {
                $name = str_replace(' ', '-', ucwords(str_replace('-', ' ', $name)));
                header(sprintf('%s: %s', $name, implode(',', $value)), false, $this->statusCode);
            }

            foreach ($this->cookie as $cookie) {
                header(sprintf('Set-Cookie: %s', $cookie->asString()), false, $this->getStatusCode());
            }
        }
    }
242511
def cookies(self):
        """"""
        if self._cookies is None:
            c = SimpleCookie(self.environ.get('HTTP_COOKIE'))
            self._cookies = dict([
                (k.decode('utf-8'), v.value.decode('utf-8'))
                for k, v in c.items()
            ])
        return self._cookies
527393
def send(self, url, data, headers):
        
        eventlet.spawn(self._send_payload, (url, data, headers))
910244
def _set_cookies(self, cookies):
        
        cookie_dict = helpers.parse_cookies_str(cookies)
        self.s.cookies.update(cookie_dict)
1187871
@SuppressWarnings("unchecked")
	private void saveToCookie(IExtendedRequest req, String reqURL, AuthenticationResult result, boolean keepInput) {

		String strParam = null;
		try {
			strParam = serializePostParam(req, reqURL, keepInput);
		} catch (Exception e) {
			if (tc.isDebugEnabled()) {
				Tr.debug(tc, "IO Exception storing POST parameters onto a cookie: ", new Object[] { e });
			}
		}

		if (strParam != null) {
			Cookie paramCookie = new Cookie(POSTPARAM_COOKIE, strParam);
			paramCookie.setMaxAge(-1);
			paramCookie.setPath(reqURL);
			if (webAppSecurityConfig.getHttpOnlyCookies()) {
				paramCookie.setHttpOnly(true);
			}
			if (webAppSecurityConfig.getSSORequiresSSL()) {
				paramCookie.setSecure(true);
			}
			result.setCookie(paramCookie);
		}

		if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
			Tr.debug(tc, "encoded POST parameters: " + strParam);
		}
	}
20444
@Override
    public void dumpRequest(Map<String, Object> result) {
        Map<String, Cookie> cookiesMap = exchange.getRequestCookies();
        dumpCookies(cookiesMap, "requestCookies");
        this.putDumpInfoTo(result);

    }
98546
def fix_webpy_cookies():
    

    try:
        web.webapi.parse_cookies('a="test"')  # make the bug occur
    except NameError:
        # monkeypatch web.py
        SimpleCookie.iteritems = SimpleCookie.items
        web.webapi.Cookie = namedtuple('Cookie', ['SimpleCookie', 'CookieError'])(SimpleCookie, CookieError)

    web.webapi.parse_cookies('a="test"')
371617
public void sendCookie(String name, String value) {
        context.addCookie(Cookie.builder(name, value).build());
    }
1204049
@SuppressWarnings("unused")
  private static final void dump(HttpClient client, HttpUriRequest req) {
    if (logger.isTraceEnabled()) {
      StringBuilder sb = new StringBuilder("\n=== Request ===");
      sb.append("\n").append(req.getRequestLine());
      for (Header h : req.getAllHeaders()) {
        sb.append("\n").append(h.getName()).append(": ").append(h.getValue());
      }
      logger.trace(sb.toString());
      
      HttpResponse resp = null;
      try {
        resp = client.execute(req);
      } catch (Exception e) {
        logger.trace("Error executing request", e);
        return;
      }
      
      sb = new StringBuilder("\n=== Response ===");
      sb.append("\n").append(resp.getStatusLine());
      for (Header h : resp.getAllHeaders()) {
        sb.append("\n").append(h.getName()).append(": ").append(h.getValue());
      }
      logger.trace(sb.toString());
      
      HttpEntity entity = resp.getEntity();
      if (entity != null) {
        sb = new StringBuilder("\n=== Content ===");
        try {
          int len = (int) entity.getContentLength();
          if (len < 0) len = 100;
          ByteArrayOutputStream baos = new ByteArrayOutputStream(len);
          entity.writeTo(baos);
          sb.append("\n").append(baos.toString("UTF-8"));
          logger.trace(sb.toString());
        } catch (IOException e) {
          logger.trace("Error reading content", e);
        }
      }
    }
  }
235813
def update_cookies(self, cookies: Optional[LooseCookies]) -> None:
        """"""
        if not cookies:
            return

        c = SimpleCookie()
        if hdrs.COOKIE in self.headers:
            c.load(self.headers.get(hdrs.COOKIE, ''))
            del self.headers[hdrs.COOKIE]

        if isinstance(cookies, Mapping):
            iter_cookies = cookies.items()
        else:
            iter_cookies = cookies  # type: ignore
        for name, value in iter_cookies:
            if isinstance(value, Morsel):
                # Preserve coded_value
                mrsl_val = value.get(value.key, Morsel())
                mrsl_val.set(value.key, value.value, value.coded_value)  # type: ignore  # noqa
                c[name] = mrsl_val
            else:
                c[name] = value  # type: ignore

        self.headers[hdrs.COOKIE] = c.output(header='', sep=';').strip()
947346
public function sendCookies()
    {
        foreach ($this->cookies as $name => $c) {
            setcookie(
                $name,
                $c['value'], // encryptValue
                $c['expire'],
                $c['path'],
                $c['domain'],
                $c['secure'],
                $c['httpOnly']
            );
        }

        return $this;
    }
533069
public void setCookies(List<HttpCookie> cookies) {
		Map<String, HttpCookie> map = new HashMap<String, HttpCookie>();
		for (HttpCookie cookie : cookies) {
			map.put(cookie.getName(), cookie);
		}
		this.cookies = map;
	}
1065094
function(httpMethod, xhrURL){
			var cookie = headers["cookie"] || "";

			// Monkey patch URL onto xhr for cookie origin checking in the send method.
			var reqURL = url.parse(xhrURL);
			this.__url = reqURL;

			if (options.auth && cookie) {
				var domainIsApproved = options.auth.domains.reduce(function(prev, domain){
					return prev || reqURL.host.indexOf(domain) >= 0;
				}, false);
			}

			// fix: if proxy is specified, use proxy-hostname instead of request-hostname for xhrURL
			var args = Array.prototype.slice.call(arguments);
			if (
				options &&
				options.proxy &&
				options.proxyTo &&
				(xhrURL.indexOf(options.proxyTo) === 0)
			) {
				args[1] = url.resolve(options.proxy, xhrURL);
			}
			var res = oldOpen.apply(this, args);

			// If on an approved domain copy the jwt from a cookie to the request headers.
			if (domainIsApproved) {
				var jwtCookie = cookieReg.exec(cookie);
				if(jwtCookie && !this.getRequestHeader('authorization')){
					this.setRequestHeader('authorization', 'Bearer ' + jwtCookie[1]);
				}
			}

			return res;
		}
1126079
public function send()
    {
        // Check if headers are sent already.
        if (headers_sent() === false) {

            // Determine reason phrase
            if ($this->reasonPhrase === null) {
                $this->reasonPhrase = self::$messages[$this->statusCode];
            }

            // Send status code.
            header(sprintf('%s %s', $this->protocolVersion, $this->reasonPhrase), true, $this->statusCode);

            // Send headers.
            foreach ($this->headers as $header => $value) {
                header(sprintf('%s: %s', $header, $value), true, $this->statusCode);
            }

            // Send cookies.
            foreach ($this->cookies as $cookie) {
                setcookie($cookie['name'], $cookie['value'], $cookie['expire'],
                    $cookie['path'], $cookie['domain'], $cookie['secure'], $cookie['httponly']);
            }

            // Send body.
            echo $this->body;
        }

        return $this;
    }
409467
def setCookies(browser, domain, cookieJar):
        
        return BrowserCookies.browsers[browser].writeCookies(domain, cookieJar)
1137756
protected function send_header() {
        global $CFG;

        if (defined('BEHAT_SITE_RUNNING')) {
            // For text based formats - we cannot test the output with behat if we force a file download.
            return;
        }
        if (is_https()) { // HTTPS sites - watch out for IE! KB812935 and KB316431.
            header('Cache-Control: max-age=10');
            header('Pragma: ');
        } else { //normal http - prevent caching at all cost
            header('Cache-Control: private, must-revalidate, pre-check=0, post-check=0, max-age=0');
            header('Pragma: no-cache');
        }
        header('Expires: '. gmdate('D, d M Y H:i:s', 0) .' GMT');
        header("Content-Type: $this->mimetype\n");
        header("Content-Disposition: attachment; filename=\"$this->filename\"");
    }