public static boolean conditionallyWrappedResponsesRequired(IoSessionEx session) { ResourceAddress resourceAddress = BridgeSession.LOCAL_ADDRESS.get(session); String nextProtocol = resourceAddress.getOption(NEXT_PROTOCOL); if ("httpxe/1.1".equals(nextProtocol)) { HttpAcceptSession httpSession = (HttpAcceptSession) session; // note: would prefer to use explicit "application/x-message-http" content type header, // but that has already been faulted in by compatibility filter before the test // is made for conditionally wrapped response return //!isExplicitEnvelopedContentType(httpSession) && !isExplicitAccessControl(httpSession) && isLegacyClient(httpSession) && (httpSession.getMethod() == HttpMethod.GET // java clients || isEmulatedWebSocketRequest(httpSession) || isRevalidateWebSocketRequest(httpSession) || isBalancerRequest(httpSession) ); } return false; }
public static void handleExtensionNegotiationException(HttpAcceptSession session, List<String> clientRequestedExtensions, ProtocolException e, Logger logger) { // This happens when the extension negotiation leads to // a fatal failure; the session should be closed because // the service REQUIRED some extension that the client // did not request. if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) { // KG-10384: make sure port is explicitly included in the request URI we use for lookup since it is always // included when the service registry is created since we force use of explicit port in accepts. // TODO: consider doing this "at the edge" when the HTTP request object (or http session) is created. URI requestURI = HttpUtils.getRequestURI(session.getRequestURL(), session.getReadHeader("Host"), session); logger.debug(format( "Rejected %s request for URI \"%s\" on session '%s': failed to negotiate client requested extensions '%s'" + " due to exception %s", session.getMethod(), requestURI, session, clientRequestedExtensions, e.toString())); } } session.setStatus(HttpStatus.CLIENT_NOT_FOUND); session.setReason("WebSocket Extensions not found or invalid"); session.close(false); }
@Override protected void doSessionOpened(final HttpAcceptSession session) throws Exception { if (!PERMITTED_CREATE_METHODS.contains(session.getMethod())) { HttpStatus status = HttpStatus.CLIENT_BAD_REQUEST; session.setStatus(status); session.setReason("Forbidden wse create request method " + session.getMethod()); session.setWriteHeader(HEADER_CONTENT_LENGTH, "0"); session.close(false); return; } if (specCompliant && !validateSequenceNumber(session)) { return; } if (! validateWsebVersion(session)) { return; } if (!validateAcceptCommands(session)) { return; } String contentLengthStr = session.getReadHeader("Content-Length"); if (contentLengthStr == null || "0".equals(contentLengthStr)) { createWsebSessionAndFinalizeResponse(session); } }
GL.warn(GL.CLUSTER_LOGGER_NAME, "Rejected {} request for URI \"{}\" on session {}: no available balancee URI was found", session.getMethod(), session.getRequestURI(), session); session.setStatus(HttpStatus.CLIENT_NOT_FOUND); } else {
@Override protected void doSessionOpened(HttpAcceptSession session) throws Exception { if (!PERMITTED_REQUEST_METHODS.contains(session.getMethod())) { wsebSession.setCloseException( new IOException("Unsupported downstream request method: " + session.getMethod())); HttpStatus status = HttpStatus.CLIENT_BAD_REQUEST; session.setStatus(status);
if (session.getMethod() != HttpMethod.POST) { throw new ProtocolDecoderException("Unexpected HTTP method");
@Override protected void doSessionOpened(HttpAcceptSession session) throws Exception { HttpMethod method = session.getMethod(); String service = session.getParameter("service");
@Override protected void doSessionOpened(HttpAcceptSession session) throws Exception { HttpMethod method = session.getMethod(); String service = session.getParameter("service");
HttpMethod method = session.getMethod(); if (method != HttpMethod.GET && method != HttpMethod.HEAD) { reportError(session, HttpStatus.CLIENT_METHOD_NOT_ALLOWED);
private void doUpgrade(final HttpAcceptSession session) throws Exception { switch (session.getMethod()) { case GET:
private void doUpgrade75(final HttpAcceptSession session) throws URISyntaxException { switch (session.getMethod()) { case GET:
private void doUpgrade76(final HttpAcceptSession session, IoBufferEx key3) throws URISyntaxException { switch (session.getMethod()) { case GET: