/* request - client cookies -> thread local
199046
public void init(HttpServletRequest request) {
		resetTimers();
		
		if (request != null) {
			String p = request.getPathInfo();
			final int pathLength = (p == null ? 0 : p.length());
			
			final StringBuffer urlSb = request.getRequestURL();
			String simpleUrl = urlSb.toString(); // without qs
			
			String qs = request.getQueryString();
			if (qs != null) urlSb.append("?").append(qs);
			final String fullUrl = urlSb.toString();
			contextUrl.set(fullUrl);
		
			requestCookies.remove();
			responseCookies.remove();
			
			StringBuilder cookiesDump = new StringBuilder();
			Map<String, Cookie> cookiez = requestCookies.get();
			for (javax.servlet.http.Cookie c : Check.ifNull(request.getCookies(), new javax.servlet.http.Cookie[0])) {
				cookiez.put(c.getName(), new BasicClientCookie(c.getName(), c.getValue()));
				cookiesDump.append(c.toString()).append(";");
			}
	
			String xForwardedFor = request.getHeader(HEADER_X_FORWARDED_FOR);
			clientIp.set(xForwardedFor != null ? xForwardedFor : request.getRemoteAddr());
			
			String xForwardedUrl = request.getHeader(HEADER_X_FORWARDED_URL);
			if (xForwardedUrl != null) {
				int i = xForwardedUrl.lastIndexOf("?");
				simpleUrl = (i == -1 ? xForwardedUrl : xForwardedUrl.substring(0, i));
			}
			
			try {
				simpleUrl = URLDecoder.decode(simpleUrl, "UTF-8"); // convert "%xx" stuff before working with lengths
			} catch (UnsupportedEncodingException e) {
				log.error(e.toString());
			}
			contextPath.set(simpleUrl.substring(0, simpleUrl.length() - pathLength));

			if (verbose) log.info(">>> Time 0 [" + fullUrl + "]. cookies from client: " + cookiesDump.toString());
		}
		
		initialized.set(true);
	}
1056964
@Override
    public void enlistInvocationCallback(InvocationCallback callback, Object cookie) {
        if (ivEJBMethodCallback == null) {
            ivEJBMethodCallback = new ArrayList<InvocationCallback>();
            ivEJBMethodCallbackCookie = new ArrayList<Object>();
        }

        ivEJBMethodCallback.add(callback);
        ivEJBMethodCallbackCookie.add(cookie);
    }
189753
private Cookie[] constructCookies(final TestContext context) {
        final List<Cookie> cookies = cookieEnricher.enrich(template.getCookies(), context);
        return cookies.toArray(new Cookie[0]);
    }
1283950
@Override
  public void requestPollRead()
  {
    /*
    if (log.isLoggable(Level.FINEST)) {
      log.finest("request-wake " + getName()
                 + " (count=" + _port.getThreadCount()
                 + ", idle=" + _port.getIdleThreadCount() + ")");
    }
    */

    try {
      requestLoop();
    } catch (Exception e) {
      log.log(Level.WARNING, e.toString(), e);
    }

    /*
    if (_stateRef.get().toWake(_stateRef)) {
      offer(getConnectionTask());
    }
    */
  }
503236
function ClientRequest(client, opts, endpoint, head, body, date, callback, middlewares) {
    this.client = client;
    this.opts = opts;
    this.endpoint = endpoint;
    this.head = head;
    this.body = body;
    this.date = date || Date;
    this.callback = callback;
    this.id = uuid.v4();
    this.isCanceled = false;
    this.state = ClientRequestStates.initialized;
    this.timestamp = this.date.now();
    this.middlewareStack = new middleware.MiddlewareStack(middlewares || []);
}
787719
function () {
        if (!('ActiveXObject' in window)) {
            if (clusterUrl && clusterUrl != null) {
                //clusterUrl = clusterUrl.replace('http://', 'https://');

                if (clusterUrl.indexOf('ssl/') < 0) {
                    var slashAtTheEnd = clusterUrl.search(/\/([\d.]*)\/$/);

                    if (slashAtTheEnd > -1) {
                        clusterUrl = clusterUrl.substring(0, slashAtTheEnd + 1) + 'ssl/' + clusterUrl.substring(slashAtTheEnd + 1, clusterUrl.length)
                    } else {
                        clusterUrl = clusterUrl.substring(0, clusterUrl.lastIndexOf('/') + 1) + 'ssl/' + clusterUrl.substring(clusterUrl.lastIndexOf('/') + 1);
                    }
                }
            }
            else {
                url = url.replace('http://', 'https://');
            }
        }
        // Create session cookie
        //createSessionCookie(sslSessionCookieName, 1);
    }
406399
@Skip
    @Override
    public void bind(ChannelHandlerContext ctx, SocketAddress localAddress,
                     ChannelPromise promise) throws Exception {
        ctx.bind(localAddress, promise);
    }
1077112
private void requestProcessed(FacesContext facesContext)
    {
        if(!_firstRequestProcessed)
        {
            // The order here is important. First it is necessary to put
            // the value on application map before change the value here.
            // If multiple threads reach this point concurrently, the
            // variable will be written on the application map at the same
            // time but always with the same value.
            facesContext.getExternalContext().getApplicationMap()
                .put(FIRST_REQUEST_PROCESSED_PARAM, Boolean.TRUE);
            
            _firstRequestProcessed = true;
        }        
    }
774351
def request(self, method, url, **kwargs):
        
        # The CookieJar API prevents callers from getting an individual Cookie
        # object by name.
        # We are forced to use the only exposed method of discarding expired
        # cookies from the CookieJar. Internally this involves iterating over
        # the entire CookieJar and calling `.is_expired()` on each Cookie
        # object.
        self.cookies.clear_expired_cookies()

        if self._auto_renew and 'IAMSession' not in self.cookies.keys():
            self.login()

        resp = super(IAMSession, self).request(method, url, **kwargs)

        if not self._auto_renew:
            return resp

        if resp.status_code == 401:
            self.login()
            resp = super(IAMSession, self).request(method, url, **kwargs)

        return resp
1244731
@SafeVarargs
    public final RequestBuilder cookies(Map.Entry<String, ?>... cookies) {
        cookies(Lists.of(cookies));
        return this;
    }
229046
private void parseIDFromCookies(RequestMessage request) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Looking for ID in cookies");
        }
        Enumeration<String> list = request.getHeaders("Cookie");
        while (list.hasMoreElements()) {
            String item = list.nextElement();
            int index = item.indexOf(getSessionConfig().getIDName());
            if (-1 != index) {
                index = item.indexOf('=', index);
                if (-1 != index) {
                    index++;
                    // TODO this is assuming that the full value is valid and
                    // grabbing just the 4 digit id...
                    if (item.length() >= (index + 4)) {
                        this.id = item.substring(index, index + 4);
                        this.fromCookie = true;
                        break;
                    }
                }
            }
        }
    }
1250970
private void cookieError(final OtpLocalNode local,
            final OtpErlangAtom cookie) throws OtpAuthException {
        try {
            @SuppressWarnings("resource")
            final OtpOutputStream header = new OtpOutputStream(headerLen);

            // preamble: 4 byte length + "passthrough" tag + version
            header.write4BE(0); // reserve space for length
            header.write1(passThrough);
            header.write1(version);

            header.write_tuple_head(4);
            header.write_long(regSendTag);
            header.write_any(local.createPid()); // disposable pid
            header.write_atom(cookie.atomValue()); // important: his cookie,
            // not mine...
            header.write_atom("auth");

            // version for payload
            header.write1(version);

            // the payload

            // the no_auth message (copied from Erlang) Don't change this
            // (Erlang will crash)
            // {$gen_cast, {print, "~n** Unauthorized cookie ~w **~n",
            // [foo@aule]}}
            final OtpErlangObject[] msg = new OtpErlangObject[2];
            final OtpErlangObject[] msgbody = new OtpErlangObject[3];

            msgbody[0] = new OtpErlangAtom("print");
            msgbody[1] = new OtpErlangString("~n** Bad cookie sent to " + local
                    + " **~n");
            // Erlang will crash and burn if there is no third argument here...
            msgbody[2] = new OtpErlangList(); // empty list

            msg[0] = new OtpErlangAtom("$gen_cast");
            msg[1] = new OtpErlangTuple(msgbody);

            @SuppressWarnings("resource")
            final OtpOutputStream payload = new OtpOutputStream(
                    new OtpErlangTuple(msg));

            // fix up length in preamble
            header.poke4BE(0, header.size() + payload.size() - 4);

            try {
                do_send(header, payload);
            } catch (final IOException e) {
            } // ignore
        } finally {
            close();
        }
        throw new OtpAuthException("Remote cookie not authorized: "
                + cookie.atomValue());
    }
468423
public void sendPermanentCookie(String name, String value) {
        Cookie cookie = new Cookie(name, value);
        cookie.setMaxAge(60*60*24*365*20);
        RequestContext.getHttpResponse().addCookie(Cookie.toServletCookie(cookie));
    }
352732
def _make_cookie(self):
        
        return struct.pack(self.COOKIE_FMT, self.COOKIE_MAGIC,
                           os.getpid(), id(self), thread.get_ident())
118703
private static <T> void notifyPostInvoke(EJBRequestCollaborator<T> collaborator, EJBRequestData request, Object preInvokeData) throws CSIException {
        try {
            @SuppressWarnings("unchecked")
            T uncheckedCookie = (T) preInvokeData;
            collaborator.postInvoke(request, uncheckedCookie);
        } catch (RuntimeException ex) {
            throw ex;
        } catch (CSIException ex) {
            throw ex;
        } catch (Exception ex) {
            throw new CSIException("", ex);
        }
    }
1127155
protected void initThreadLocalJawrContext(HttpServletRequest request) {
		ThreadLocalJawrContext.setJawrConfigMgrObjectName(JmxUtils.getJawrConfigMBeanObjectName(
				request.getContextPath(), resourceType, jawrConfig.getProperty(JawrConstant.JAWR_JMX_MBEAN_PREFIX)));

		ThreadLocalJawrContext.setRequest(request.getRequestURL().toString());

		RendererRequestUtils.setRequestDebuggable(request, jawrConfig);
	}
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);
		}
	}