From 9678aad6e961c21be0972aa90bfef570e0d237dc Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Mon, 3 Oct 2011 18:21:28 +1100 Subject: [PATCH 01/34] Debug printlns plus commented out Deferred auth --- .../security/jaspi/JaspiAuthenticator.java | 97 +++++++++++-------- .../jaspi/JaspiAuthenticatorFactory.java | 4 + .../jaspi/modules/BaseAuthModule.java | 4 +- .../jaspi/modules/FormAuthModule.java | 23 ++++- .../jetty/security/SecurityHandler.java | 6 +- 5 files changed, 86 insertions(+), 48 deletions(-) diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java index dbdb0b4a840..1b065287658 100644 --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java @@ -42,36 +42,38 @@ import org.eclipse.jetty.server.Authentication.User; public class JaspiAuthenticator implements Authenticator { private final ServerAuthConfig _authConfig; + private final Map _authProperties; + private final ServletCallbackHandler _callbackHandler; + private final Subject _serviceSubject; + private final boolean _allowLazyAuthentication; + private final IdentityService _identityService; + private final DeferredAuthentication _deferred; - public JaspiAuthenticator(ServerAuthConfig authConfig, Map authProperties, ServletCallbackHandler callbackHandler, - Subject serviceSubject, boolean allowLazyAuthentication, IdentityService identityService) + public JaspiAuthenticator(ServerAuthConfig authConfig, Map authProperties, ServletCallbackHandler callbackHandler, Subject serviceSubject, + boolean allowLazyAuthentication, IdentityService identityService) { // TODO maybe pass this in via setConfiguration ? - if (callbackHandler == null) - throw new NullPointerException("No CallbackHandler"); - if (authConfig == null) - throw new NullPointerException("No AuthConfig"); + if (callbackHandler == null) throw new NullPointerException("No CallbackHandler"); + if (authConfig == null) throw new NullPointerException("No AuthConfig"); this._authConfig = authConfig; this._authProperties = authProperties; this._callbackHandler = callbackHandler; this._serviceSubject = serviceSubject; this._allowLazyAuthentication = allowLazyAuthentication; this._identityService = identityService; - this._deferred=new DeferredAuthentication(this); + this._deferred = new DeferredAuthentication(this); } - public void setConfiguration(AuthConfiguration configuration) { } - - + public String getAuthMethod() { return "JASPI"; @@ -79,56 +81,67 @@ public class JaspiAuthenticator implements Authenticator public Authentication validateRequest(ServletRequest request, ServletResponse response, boolean mandatory) throws ServerAuthException { - if (_allowLazyAuthentication && !mandatory) - return _deferred; + System.err.println("JaspiAuthenticator.validateRequest, uri=" + ((javax.servlet.http.HttpServletRequest) request).getRequestURI() + + "lazy=" + + _allowLazyAuthentication + + " mandatory=" + + mandatory); + new Throwable().printStackTrace(); + JaspiMessageInfo info = new JaspiMessageInfo(request, response, mandatory); - request.setAttribute("org.eclipse.jetty.security.jaspi.info",info); + request.setAttribute("org.eclipse.jetty.security.jaspi.info", info); + + /* if (_allowLazyAuthentication && !mandatory) + return _deferred;*/ + return validateRequest(info); } // most likely validatedUser is not needed here. public boolean secureResponse(ServletRequest req, ServletResponse res, boolean mandatory, User validatedUser) throws ServerAuthException { - JaspiMessageInfo info = (JaspiMessageInfo)req.getAttribute("org.eclipse.jetty.security.jaspi.info"); - if (info==null) throw new NullPointerException("MeesageInfo from request missing: " + req); - return secureResponse(info,validatedUser); + System.err.println("JaspiAuthenticator.secureResponse uri=" + ((javax.servlet.http.HttpServletRequest) req).getRequestURI()); + + JaspiMessageInfo info = (JaspiMessageInfo) req.getAttribute("org.eclipse.jetty.security.jaspi.info"); + if (info == null) throw new NullPointerException("MessageInfo from request missing: " + req); + return secureResponse(info, validatedUser); } - + public Authentication validateRequest(JaspiMessageInfo messageInfo) throws ServerAuthException { try { + System.err.println("jaspAuthenticator.validateRequest(info)"); String authContextId = _authConfig.getAuthContextID(messageInfo); - ServerAuthContext authContext = _authConfig.getAuthContext(authContextId,_serviceSubject,_authProperties); + ServerAuthContext authContext = _authConfig.getAuthContext(authContextId, _serviceSubject, _authProperties); Subject clientSubject = new Subject(); - AuthStatus authStatus = authContext.validateRequest(messageInfo,clientSubject,_serviceSubject); -// String authMethod = (String)messageInfo.getMap().get(JaspiMessageInfo.AUTH_METHOD_KEY); + AuthStatus authStatus = authContext.validateRequest(messageInfo, clientSubject, _serviceSubject); + // String authMethod = + // (String)messageInfo.getMap().get(JaspiMessageInfo.AUTH_METHOD_KEY); + + if (authStatus == AuthStatus.SEND_CONTINUE) return Authentication.SEND_CONTINUE; + if (authStatus == AuthStatus.SEND_FAILURE) return Authentication.SEND_FAILURE; - if (authStatus == AuthStatus.SEND_CONTINUE) - return Authentication.SEND_CONTINUE; - if (authStatus == AuthStatus.SEND_FAILURE) - return Authentication.SEND_FAILURE; - if (authStatus == AuthStatus.SUCCESS) { - Set ids = clientSubject.getPrivateCredentials(UserIdentity.class); + Set ids = clientSubject.getPrivateCredentials(UserIdentity.class); UserIdentity userIdentity; if (ids.size() > 0) { userIdentity = ids.iterator().next(); - } else { + } + else + { CallerPrincipalCallback principalCallback = _callbackHandler.getThreadCallerPrincipalCallback(); - if (principalCallback == null) - { - return Authentication.UNAUTHENTICATED; - } + if (principalCallback == null) { return Authentication.UNAUTHENTICATED; } Principal principal = principalCallback.getPrincipal(); - if (principal == null) { + if (principal == null) + { String principalName = principalCallback.getName(); Set principals = principalCallback.getSubject().getPrincipals(); - for (Principal p: principals) + for (Principal p : principals) { if (p.getName().equals(principalName)) { @@ -136,10 +149,7 @@ public class JaspiAuthenticator implements Authenticator break; } } - if (principal == null) - { - return Authentication.UNAUTHENTICATED; - } + if (principal == null) { return Authentication.UNAUTHENTICATED; } } GroupPrincipalCallback groupPrincipalCallback = _callbackHandler.getThreadGroupPrincipalCallback(); String[] groups = groupPrincipalCallback == null ? null : groupPrincipalCallback.getGroups(); @@ -149,10 +159,10 @@ public class JaspiAuthenticator implements Authenticator } if (authStatus == AuthStatus.SEND_SUCCESS) { - //we are processing a message in a secureResponse dialog. + // we are processing a message in a secureResponse dialog. return Authentication.SEND_SUCCESS; } - //should not happen + // should not happen throw new NullPointerException("No AuthStatus returned"); } catch (AuthException e) @@ -166,13 +176,16 @@ public class JaspiAuthenticator implements Authenticator try { String authContextId = _authConfig.getAuthContextID(messageInfo); - ServerAuthContext authContext = _authConfig.getAuthContext(authContextId,_serviceSubject,_authProperties); - // TODO authContext.cleanSubject(messageInfo,validatedUser.getUserIdentity().getSubject()); - AuthStatus status = authContext.secureResponse(messageInfo,_serviceSubject); + ServerAuthContext authContext = _authConfig.getAuthContext(authContextId, _serviceSubject, _authProperties); + // TODO + // authContext.cleanSubject(messageInfo,validatedUser.getUserIdentity().getSubject()); + AuthStatus status = authContext.secureResponse(messageInfo, _serviceSubject); return (AuthStatus.SEND_SUCCESS.equals(status)); } catch (AuthException e) { + System.err.println("Error in JaspiAuthenticator.secureResponse"); + e.printStackTrace(); throw new ServerAuthException(e); } } diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticatorFactory.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticatorFactory.java index 35015090fb8..c645ffa85a2 100644 --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticatorFactory.java +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticatorFactory.java @@ -98,9 +98,13 @@ public class JaspiAuthenticatorFactory extends DefaultAuthenticatorFactory Subject serviceSubject=findServiceSubject(server); String serverName=findServerName(server,serviceSubject); + System.err.println("authconfigfactory="+authConfigFactory+" serviceSubject="+serviceSubject+" serverName="+serverName); String appContext = serverName + " " + context.getContextPath(); + + System.err.println("appcontext="+appContext); AuthConfigProvider authConfigProvider = authConfigFactory.getConfigProvider(MESSAGE_LAYER,appContext,listener); + System.err.println("authconfigProvider="+authConfigProvider); if (authConfigProvider != null) { ServletCallbackHandler servletCallbackHandler = new ServletCallbackHandler(loginService); diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/BaseAuthModule.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/BaseAuthModule.java index bd66f60bf75..3908ec7064d 100644 --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/BaseAuthModule.java +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/BaseAuthModule.java @@ -90,12 +90,12 @@ public class BaseAuthModule implements ServerAuthModule, ServerAuthContext public AuthStatus secureResponse(MessageInfo messageInfo, Subject serviceSubject) throws AuthException { // servlets do not need secured responses - return AuthStatus.SUCCESS; + return AuthStatus.SEND_SUCCESS; } public AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject, Subject serviceSubject) throws AuthException { - return AuthStatus.FAILURE; + return AuthStatus.SEND_FAILURE; } /** diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java index ab46f0ab571..88ce65e3526 100644 --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java @@ -146,22 +146,25 @@ public class FormAuthModule extends BaseAuthModule @Override public AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject, Subject serviceSubject) throws AuthException { + System.err.println("FormAuthModule.validateRequest(info,subject,serviceSubject)"); HttpServletRequest request = (HttpServletRequest) messageInfo.getRequestMessage(); HttpServletResponse response = (HttpServletResponse) messageInfo.getResponseMessage(); HttpSession session = request.getSession(isMandatory(messageInfo)); - String uri = request.getPathInfo(); + String uri = request.getRequestURI(); // not mandatory and not authenticated if (session == null || isLoginOrErrorPage(uri)) return AuthStatus.SUCCESS; + System.err.println("FormAuthModule.validateRequest(info,subect,serviceSubject), uri="+uri); try { // Handle a request for authentication. // TODO perhaps j_securitycheck can be uri suffix? - if (uri.endsWith(__J_SECURITY_CHECK)) + if (uri != null && isJSecurityCheck(uri)) { final String username = request.getParameter(__J_USERNAME); final String password = request.getParameter(__J_PASSWORD); + System.err.println("Try login username="+username+" password="+password); boolean success = tryLogin(messageInfo, clientSubject, response, session, username, new Password(password)); if (success) { @@ -199,6 +202,7 @@ public class FormAuthModule extends BaseAuthModule if (form_cred != null) { + System.err.println("Form cred: form.username="+form_cred._jUserName+" form.pwd="+new String(form_cred._jPassword)); boolean success = tryLogin(messageInfo, clientSubject, response, session, form_cred._jUserName, new Password(new String(form_cred._jPassword))); if (success) { return AuthStatus.SUCCESS; } // CallbackHandler loginCallbackHandler = new @@ -300,6 +304,7 @@ public class FormAuthModule extends BaseAuthModule return AuthStatus.SUCCESS; // redirect to login page + System.err.println("Redirecting to login page"); if (request.getQueryString() != null) uri += "?" + request.getQueryString(); session.setAttribute(__J_URI, request.getScheme() + "://" + request.getServerName() @@ -320,6 +325,20 @@ public class FormAuthModule extends BaseAuthModule } } + + /* ------------------------------------------------------------ */ + public boolean isJSecurityCheck(String uri) + { + int jsc = uri.indexOf(__J_SECURITY_CHECK); + + if (jsc<0) + return false; + int e=jsc+__J_SECURITY_CHECK.length(); + if (e==uri.length()) + return true; + char c = uri.charAt(e); + return c==';'||c=='#'||c=='/'||c=='?'; + } private boolean tryLogin(MessageInfo messageInfo, Subject clientSubject, HttpServletResponse response, HttpSession session, diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/SecurityHandler.java b/jetty-security/src/main/java/org/eclipse/jetty/security/SecurityHandler.java index 5878381ec2e..6a4b837783f 100644 --- a/jetty-security/src/main/java/org/eclipse/jetty/security/SecurityHandler.java +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/SecurityHandler.java @@ -318,11 +318,13 @@ public abstract class SecurityHandler extends HandlerWrapper implements Authenti if (!_loginServiceShared && _loginService instanceof LifeCycle) ((LifeCycle)_loginService).start(); + System.err.println("authenticator="+_authenticator+" authenticatorFactory="+_authenticatorFactory+" identityService="+_identityService); if (_authenticator==null && _authenticatorFactory!=null && _identityService!=null) { _authenticator=_authenticatorFactory.getAuthenticator(getServer(),ContextHandler.getCurrentContext(),this, _identityService, _loginService); if (_authenticator!=null) _authMethod=_authenticator.getAuthMethod(); + System.err.println("Called auth factory, authenticator="+_authenticator); } if (_authenticator==null) @@ -477,7 +479,7 @@ public abstract class SecurityHandler extends HandlerWrapper implements Authenti deferred.setIdentityService(_identityService); deferred.setLoginService(_loginService); baseRequest.setAuthentication(authentication); - +System.err.println("uri="+baseRequest.getUri()+" Auth is deferred"); try { handler.handle(pathInContext, baseRequest, request, response); @@ -487,7 +489,7 @@ public abstract class SecurityHandler extends HandlerWrapper implements Authenti previousIdentity = deferred.getPreviousAssociation(); deferred.setIdentityService(null); } - + System.err.println("Securityhandler calling secureResponse, for Authentication.User"); Authentication auth=baseRequest.getAuthentication(); if (auth instanceof Authentication.User) { From 53fa6a04810f2cd4366d3821efd8497e2479d0f8 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Tue, 4 Oct 2011 14:31:34 +1100 Subject: [PATCH 02/34] Hooked up the LoginCallbackImpl inside ServletCallbackHandler as the FormAuthModule appears to expect to see it; made JaspiAuthenticator return Deferred IFF !mandatory && allowLazyAuth && auth module returned UNAUTHENTICATED. This hinges on the fact that an auth module who is prepared to skip doing authentication (because !mandatory) must return AuthStatus.SUCCESS, which JaspiAuthenticator turns into Authentication.UNAUTHENTICATED. --- .../security/jaspi/JaspiAuthenticator.java | 19 +- .../jaspi/ServletCallbackHandler.java | 3 +- .../jaspi/modules/BaseAuthModule.java | 1 + .../jaspi/modules/FormAuthModule.java | 173 ++++-------------- 4 files changed, 52 insertions(+), 144 deletions(-) diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java index 1b065287658..6d0e6963e9a 100644 --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java @@ -81,21 +81,27 @@ public class JaspiAuthenticator implements Authenticator public Authentication validateRequest(ServletRequest request, ServletResponse response, boolean mandatory) throws ServerAuthException { - System.err.println("JaspiAuthenticator.validateRequest, uri=" + ((javax.servlet.http.HttpServletRequest) request).getRequestURI() - + "lazy=" + System.err.println("\nJaspiAuthenticator.validateRequest, uri=" + ((javax.servlet.http.HttpServletRequest) request).getRequestURI() + + " lazy=" + _allowLazyAuthentication + " mandatory=" + mandatory); - new Throwable().printStackTrace(); - - + JaspiMessageInfo info = new JaspiMessageInfo(request, response, mandatory); request.setAttribute("org.eclipse.jetty.security.jaspi.info", info); + //TODO janb - removed deferred authentication temporarily /* if (_allowLazyAuthentication && !mandatory) return _deferred;*/ - return validateRequest(info); + Authentication a = validateRequest(info); + + //if its not mandatory to authenticate, and the authenticator returned UNAUTHENTICATED, we treat it as authentication deferred + if (_allowLazyAuthentication && !info.isAuthMandatory() && a == Authentication.UNAUTHENTICATED) + a =_deferred; + + System.err.println("JaspiAuthenticator.validateRequest returning "+a); + return a; } // most likely validatedUser is not needed here. @@ -108,6 +114,7 @@ public class JaspiAuthenticator implements Authenticator return secureResponse(info, validatedUser); } + public Authentication validateRequest(JaspiMessageInfo messageInfo) throws ServerAuthException { try diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/ServletCallbackHandler.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/ServletCallbackHandler.java index d11a8d9bc84..44dbda13e3b 100644 --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/ServletCallbackHandler.java +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/ServletCallbackHandler.java @@ -90,8 +90,9 @@ public class ServletCallbackHandler implements CallbackHandler if (user!=null) { + loginCallback.setUserPrincipal(user.getUserPrincipal()); + credentialValidationCallback.getSubject().getPrivateCredentials().add(loginCallback); credentialValidationCallback.setResult(true); - credentialValidationCallback.getSubject().getPrincipals().addAll(user.getSubject().getPrincipals()); credentialValidationCallback.getSubject().getPrivateCredentials().add(user); } diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/BaseAuthModule.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/BaseAuthModule.java index 3908ec7064d..7099661a4da 100644 --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/BaseAuthModule.java +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/BaseAuthModule.java @@ -131,6 +131,7 @@ public class BaseAuthModule implements ServerAuthModule, ServerAuthContext if (credValidationCallback.getResult()) { Set loginCallbacks = clientSubject.getPrivateCredentials(LoginCallbackImpl.class); + System.err.println("LoginCallbackImpls.isEmpty="+loginCallbacks.isEmpty()); if (!loginCallbacks.isEmpty()) { LoginCallbackImpl loginCallback = loginCallbacks.iterator().next(); diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java index 88ce65e3526..fa2b5bb3a85 100644 --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java @@ -146,40 +146,50 @@ public class FormAuthModule extends BaseAuthModule @Override public AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject, Subject serviceSubject) throws AuthException { - System.err.println("FormAuthModule.validateRequest(info,subject,serviceSubject)"); + HttpServletRequest request = (HttpServletRequest) messageInfo.getRequestMessage(); HttpServletResponse response = (HttpServletResponse) messageInfo.getResponseMessage(); - HttpSession session = request.getSession(isMandatory(messageInfo)); String uri = request.getRequestURI(); - // not mandatory and not authenticated - if (session == null || isLoginOrErrorPage(uri)) return AuthStatus.SUCCESS; + if (uri==null) + uri=URIUtil.SLASH; + + boolean mandatory = isMandatory(messageInfo); + mandatory |= isJSecurityCheck(uri); + HttpSession session = request.getSession(mandatory); + + System.err.println("FormAuthModule.validateRequest(info,subject,serviceSubject) for uri="+uri+" mandatory="+mandatory+" isLoginOrError="+isLoginOrErrorPage(uri)); + + // not mandatory or its the login or login error page don't authenticate + if (!mandatory || isLoginOrErrorPage(uri)) return AuthStatus.SUCCESS; - System.err.println("FormAuthModule.validateRequest(info,subect,serviceSubject), uri="+uri); try { // Handle a request for authentication. - // TODO perhaps j_securitycheck can be uri suffix? - if (uri != null && isJSecurityCheck(uri)) + if (isJSecurityCheck(uri)) { - final String username = request.getParameter(__J_USERNAME); final String password = request.getParameter(__J_PASSWORD); System.err.println("Try login username="+username+" password="+password); boolean success = tryLogin(messageInfo, clientSubject, response, session, username, new Password(password)); if (success) { - // Redirect to original request - String nuri = (String) session.getAttribute(__J_URI); + // Redirect to original request + String nuri=null; + synchronized(session) + { + nuri = (String) session.getAttribute(__J_URI); + } + if (nuri == null || nuri.length() == 0) { nuri = request.getContextPath(); - if (nuri.length() == 0) nuri = URIUtil.SLASH; + if (nuri.length() == 0) + nuri = URIUtil.SLASH; } - session.removeAttribute(__J_URI); // Remove popped return - // URI. - response.setContentLength(0); + + System.err.println("FormAuthModule succesful login, sending redirect to "+nuri); + response.setContentLength(0); response.sendRedirect(response.encodeRedirectURL(nuri)); - return AuthStatus.SEND_CONTINUE; } // not authenticated @@ -205,88 +215,6 @@ public class FormAuthModule extends BaseAuthModule System.err.println("Form cred: form.username="+form_cred._jUserName+" form.pwd="+new String(form_cred._jPassword)); boolean success = tryLogin(messageInfo, clientSubject, response, session, form_cred._jUserName, new Password(new String(form_cred._jPassword))); if (success) { return AuthStatus.SUCCESS; } - // CallbackHandler loginCallbackHandler = new - // UserPasswordCallbackHandler(form_cred._jUserName, - // form_cred._jPassword); - // LoginResult loginResult = loginService.login(clientSubject, - // loginCallbackHandler); - // //TODO what should happen if !isMandatory but credentials - // exist and are wrong? - // if (loginResult.isSuccess()) - // { - // callbackHandler.handle(new - // Callback[]{loginResult.getCallerPrincipalCallback(), - // loginResult.getGroupPrincipalCallback()}); - // messageInfo.getMap().put(JettyMessageInfo.AUTH_METHOD_KEY, - // Constraint.__FORM_AUTH); - // - // form_cred = new FormCredential(form_cred._jUserName, - // form_cred._jPassword, - // loginResult.getCallerPrincipalCallback().getPrincipal()); - // - // session.setAttribute(__J_AUTHENTICATED, form_cred); - // if (ssoSource != null && ssoSource.fetch(request) == null) - // { - // UserInfo userInfo = new UserInfo(form_cred._jUserName, - // form_cred._jPassword); - // ssoSource.store(userInfo, response); - // } - // messageInfo.getMap().put(JettyMessageInfo.AUTH_METHOD_KEY, - // Constraint.__FORM_AUTH); - // return AuthStatus.SUCCESS; - // } - - // // We have a form credential. Has it been distributed? - // if (form_cred._userPrincipal==null) - // { - // // This form_cred appears to have been distributed. Need to - // reauth - // form_cred.authenticate(realm, request); - // - // // Sign-on to SSO mechanism - // if (form_cred._userPrincipal!=null && realm instanceof - // SSORealm) - // ((SSORealm)realm).setSingleSignOn(request,response,form_cred._userPrincipal,new - // Password(form_cred._jPassword)); - // - // } - // else if (!realm.reauthenticate(form_cred._userPrincipal)) - // // Else check that it is still authenticated. - // form_cred._userPrincipal=null; - // - // // If this credential is still authenticated - // if (form_cred._userPrincipal!=null) - // { - // if(LOG.isDebugEnabled())LOG.debug("FORM Authenticated for - // "+form_cred._userPrincipal.getName()); - // request.setAuthType(Constraint.__FORM_AUTH); - // //jaspi - // // request.setUserPrincipal(form_cred._userPrincipal); - // return form_cred._userPrincipal; - // } - // else - // session.setAttribute(__J_AUTHENTICATED,null); - // } - // else if (realm instanceof SSORealm) - // { - // // Try a single sign on. - // Credential cred = - // ((SSORealm)realm).getSingleSignOn(request,response); - // - // if (request.getUserPrincipal()!=null) - // { - // form_cred=new FormCredential(); - // form_cred._userPrincipal=request.getUserPrincipal(); - // form_cred._jUserName=form_cred._userPrincipal.getName(); - // if (cred!=null) - // form_cred._jPassword=cred.toString(); - // if(LOG.isDebugEnabled())LOG.debug("SSO for - // "+form_cred._userPrincipal); - // - // request.setAuthType(Constraint.__FORM_AUTH); - // session.setAttribute(__J_AUTHENTICATED,form_cred); - // return form_cred._userPrincipal; - // } } else if (ssoSource != null) { @@ -298,19 +226,17 @@ public class FormAuthModule extends BaseAuthModule } } - // Don't authenticate authform or errorpage - if (!isMandatory(messageInfo) || isLoginOrErrorPage(uri)) - // TODO verify this is correct action - return AuthStatus.SUCCESS; + // redirect to login page + StringBuffer buf = request.getRequestURL(); + if (request.getQueryString() != null) + buf.append("?").append(request.getQueryString()); - // redirect to login page - System.err.println("Redirecting to login page"); - if (request.getQueryString() != null) uri += "?" + request.getQueryString(); - session.setAttribute(__J_URI, request.getScheme() + "://" - + request.getServerName() - + ":" - + request.getServerPort() - + URIUtil.addPaths(request.getContextPath(), uri)); + synchronized (session) + { + session.setAttribute(__J_URI, buf.toString()); + } + + System.err.println("Redirecting to login page "+_formLoginPage+" and remembering juri="+buf.toString()); response.setContentLength(0); response.sendRedirect(response.encodeRedirectURL(URIUtil.addPaths(request.getContextPath(), _formLoginPage))); return AuthStatus.SEND_CONTINUE; @@ -349,6 +275,7 @@ public class FormAuthModule extends BaseAuthModule { char[] pwdChars = password.toString().toCharArray(); Set loginCallbacks = clientSubject.getPrivateCredentials(LoginCallbackImpl.class); + System.err.println("FormAuthModule, LoginCallbackImpl.isEmpty="+loginCallbacks.isEmpty()); if (!loginCallbacks.isEmpty()) { LoginCallbackImpl loginCallback = loginCallbacks.iterator().next(); @@ -366,34 +293,6 @@ public class FormAuthModule extends BaseAuthModule return true; } return false; - // LoginCallback loginCallback = new LoginCallback(clientSubject, - // username, password); - // loginService.login(loginCallback); - // if (loginCallback.isSuccess()) - // { - // CallerPrincipalCallback callerPrincipalCallback = new - // CallerPrincipalCallback(clientSubject, - // loginCallback.getUserPrincipal()); - // GroupPrincipalCallback groupPrincipalCallback = new - // GroupPrincipalCallback(clientSubject, - // loginCallback.getGroups().toArray(new - // String[loginCallback.getGroups().size()])); - // callbackHandler.handle(new Callback[] {callerPrincipalCallback, - // groupPrincipalCallback}); - // messageInfo.getMap().put(JettyMessageInfo.AUTH_METHOD_KEY, - // Constraint.__FORM_AUTH); - // FormCredential form_cred = new FormCredential(username, password, - // loginCallback.getUserPrincipal()); - // - // session.setAttribute(__J_AUTHENTICATED, form_cred); - // // Sign-on to SSO mechanism - // if (ssoSource != null) - // { - // UserInfo userInfo = new UserInfo(username, password); - // ssoSource.store(userInfo, response); - // } - // } - // return loginCallback.isSuccess(); } public boolean isLoginOrErrorPage(String pathInContext) From 4c0a3001e5731052c8ea3f91173d7c8bffed212c Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Fri, 14 Oct 2011 14:39:46 +1100 Subject: [PATCH 03/34] Ensure login/error page matching is done against the path in context. --- .../eclipse/jetty/security/jaspi/modules/FormAuthModule.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java index fa2b5bb3a85..52018e87c09 100644 --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java @@ -160,7 +160,7 @@ public class FormAuthModule extends BaseAuthModule System.err.println("FormAuthModule.validateRequest(info,subject,serviceSubject) for uri="+uri+" mandatory="+mandatory+" isLoginOrError="+isLoginOrErrorPage(uri)); // not mandatory or its the login or login error page don't authenticate - if (!mandatory || isLoginOrErrorPage(uri)) return AuthStatus.SUCCESS; + if (!mandatory || isLoginOrErrorPage(URIUtil.addPaths(request.getServletPath(),request.getPathInfo()))) return AuthStatus.SUCCESS; try { @@ -297,6 +297,7 @@ public class FormAuthModule extends BaseAuthModule public boolean isLoginOrErrorPage(String pathInContext) { + System.err.println("ISLOGINORERRORPAGE? "+pathInContext+" error: "+_formErrorPath+" login:"+_formLoginPath); return pathInContext != null && (pathInContext.equals(_formErrorPath) || pathInContext.equals(_formLoginPath)); } From d2e85010529e1209b2bf4852bc8283000ffa0090 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Fri, 14 Oct 2011 15:38:51 +1100 Subject: [PATCH 04/34] Remove some debug printlns; add a couple of comments --- .../jetty/security/jaspi/JaspiAuthenticator.java | 4 ---- .../jetty/security/jaspi/modules/FormAuthModule.java | 10 ++++++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java index 6d0e6963e9a..455cf28a4d4 100644 --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java @@ -89,10 +89,6 @@ public class JaspiAuthenticator implements Authenticator JaspiMessageInfo info = new JaspiMessageInfo(request, response, mandatory); request.setAttribute("org.eclipse.jetty.security.jaspi.info", info); - - //TODO janb - removed deferred authentication temporarily - /* if (_allowLazyAuthentication && !mandatory) - return _deferred;*/ Authentication a = validateRequest(info); diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java index 52018e87c09..3bb748a8614 100644 --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java @@ -213,6 +213,9 @@ public class FormAuthModule extends BaseAuthModule if (form_cred != null) { System.err.println("Form cred: form.username="+form_cred._jUserName+" form.pwd="+new String(form_cred._jPassword)); + + //TODO: we would like the form auth module to be able to invoke the loginservice.validate() method to check the previously authed user + boolean success = tryLogin(messageInfo, clientSubject, response, session, form_cred._jUserName, new Password(new String(form_cred._jPassword))); if (success) { return AuthStatus.SUCCESS; } } @@ -279,7 +282,7 @@ public class FormAuthModule extends BaseAuthModule if (!loginCallbacks.isEmpty()) { LoginCallbackImpl loginCallback = loginCallbacks.iterator().next(); - FormCredential form_cred = new FormCredential(username, pwdChars, loginCallback.getUserPrincipal()); + FormCredential form_cred = new FormCredential(username, pwdChars, loginCallback.getUserPrincipal(), loginCallback.getSubject()); session.setAttribute(__J_AUTHENTICATED, form_cred); } @@ -312,12 +315,15 @@ public class FormAuthModule extends BaseAuthModule char[] _jPassword; transient Principal _userPrincipal; + + transient Subject _subject; - private FormCredential(String _jUserName, char[] _jPassword, Principal _userPrincipal) + private FormCredential(String _jUserName, char[] _jPassword, Principal _userPrincipal, Subject subject) { this._jUserName = _jUserName; this._jPassword = _jPassword; this._userPrincipal = _userPrincipal; + this._subject = subject; } public void valueBound(HttpSessionBindingEvent event) From e30622516a04def10824ccbd5d3cbf989dfd6408 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Tue, 18 Oct 2011 07:35:42 +1100 Subject: [PATCH 05/34] add more debug printlns and a stack trace --- .../org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java | 1 + .../eclipse/jetty/security/jaspi/modules/FormAuthModule.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java index 455cf28a4d4..526f53a0101 100644 --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/JaspiAuthenticator.java @@ -86,6 +86,7 @@ public class JaspiAuthenticator implements Authenticator + _allowLazyAuthentication + " mandatory=" + mandatory); + new Throwable().printStackTrace(); JaspiMessageInfo info = new JaspiMessageInfo(request, response, mandatory); request.setAttribute("org.eclipse.jetty.security.jaspi.info", info); diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java index 3bb748a8614..c6441f4b526 100644 --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java @@ -157,7 +157,7 @@ public class FormAuthModule extends BaseAuthModule mandatory |= isJSecurityCheck(uri); HttpSession session = request.getSession(mandatory); - System.err.println("FormAuthModule.validateRequest(info,subject,serviceSubject) for uri="+uri+" mandatory="+mandatory+" isLoginOrError="+isLoginOrErrorPage(uri)); + System.err.println("FormAuthModule.validateRequest(info,subject,serviceSubject) for uri="+uri+" mandatory="+mandatory+" isLoginOrError="+isLoginOrErrorPage(URIUtil.addPaths(request.getServletPath(),request.getPathInfo()))); // not mandatory or its the login or login error page don't authenticate if (!mandatory || isLoginOrErrorPage(URIUtil.addPaths(request.getServletPath(),request.getPathInfo()))) return AuthStatus.SUCCESS; From e8b8c659b0884d33c52949b7f30ce3b7ae05b4a1 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Tue, 18 Oct 2011 10:41:19 +1100 Subject: [PATCH 06/34] Add mechanism to indicate to FormAuthModule that a deferred authentication is being requested, but for a call to Request.getRemoteUser, where there is no opportunity to issue a challenge. --- .../jetty/security/jaspi/modules/FormAuthModule.java | 12 +++++++++++- .../authentication/DeferredAuthentication.java | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java index c6441f4b526..72fc9b7f55f 100644 --- a/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java +++ b/jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java @@ -36,7 +36,9 @@ import javax.servlet.http.HttpSessionBindingListener; import org.eclipse.jetty.http.security.Constraint; import org.eclipse.jetty.http.security.Password; import org.eclipse.jetty.security.CrossContextPsuedoSession; +import org.eclipse.jetty.security.authentication.DeferredAuthentication; import org.eclipse.jetty.security.authentication.LoginCallbackImpl; +import org.eclipse.jetty.server.Authentication; import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.URIUtil; import org.eclipse.jetty.util.log.Log; @@ -207,9 +209,10 @@ public class FormAuthModule extends BaseAuthModule // that occur? return AuthStatus.SEND_FAILURE; } + + // Check if the session is already authenticated. FormCredential form_cred = (FormCredential) session.getAttribute(__J_AUTHENTICATED); - if (form_cred != null) { System.err.println("Form cred: form.username="+form_cred._jUserName+" form.pwd="+new String(form_cred._jPassword)); @@ -228,6 +231,13 @@ public class FormAuthModule extends BaseAuthModule if (success) { return AuthStatus.SUCCESS; } } } + + + + // if we can't send challenge + if (DeferredAuthentication.isDeferred(response)) + return AuthStatus.SUCCESS; + // redirect to login page StringBuffer buf = request.getRequestURL(); diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DeferredAuthentication.java b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DeferredAuthentication.java index e1aabf587ce..297d5beeff0 100644 --- a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DeferredAuthentication.java +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DeferredAuthentication.java @@ -167,7 +167,7 @@ public class DeferredAuthentication implements Authentication.Deferred * @param response * @return true if this response is from a deferred call to {@link #authenticate(ServletRequest)} */ - public boolean isDeferred(HttpServletResponse response) + public static boolean isDeferred(HttpServletResponse response) { return response==__deferredResponse; } @@ -175,7 +175,7 @@ public class DeferredAuthentication implements Authentication.Deferred /* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */ - static HttpServletResponse __deferredResponse = new HttpServletResponse() + final static HttpServletResponse __deferredResponse = new HttpServletResponse() { public void addCookie(Cookie cookie) { From e7b787996f62e4fb3691d1936abb89fff32af0e2 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Mon, 2 Jan 2012 08:26:29 +1100 Subject: [PATCH 07/34] Fix build. --- .../providers/ScanningAppProviderRuntimeUpdatesTest.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/providers/ScanningAppProviderRuntimeUpdatesTest.java b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/providers/ScanningAppProviderRuntimeUpdatesTest.java index d0611fa6923..f2535c20d33 100644 --- a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/providers/ScanningAppProviderRuntimeUpdatesTest.java +++ b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/providers/ScanningAppProviderRuntimeUpdatesTest.java @@ -111,6 +111,7 @@ public class ScanningAppProviderRuntimeUpdatesTest jetty.copyWebapp("foo-webapp-1.war","foo.war"); jetty.copyContext("foo.xml","foo.xml"); + waitForDirectoryScan(); waitForDirectoryScan(); jetty.assertWebAppContextsExists("/foo"); @@ -125,12 +126,14 @@ public class ScanningAppProviderRuntimeUpdatesTest jetty.copyWebapp("foo-webapp-1.war","foo.war"); jetty.copyContext("foo.xml","foo.xml"); + waitForDirectoryScan(); waitForDirectoryScan(); jetty.assertWebAppContextsExists("/foo"); jetty.removeContext("foo.xml"); + waitForDirectoryScan(); waitForDirectoryScan(); // FIXME: hot undeploy with removal not working! - jetty.assertNoWebAppContexts(); @@ -151,6 +154,7 @@ public class ScanningAppProviderRuntimeUpdatesTest jetty.copyWebapp("foo-webapp-1.war","foo.war"); jetty.copyContext("foo.xml","foo.xml"); + waitForDirectoryScan(); waitForDirectoryScan(); jetty.assertWebAppContextsExists("/foo"); @@ -165,6 +169,7 @@ public class ScanningAppProviderRuntimeUpdatesTest // This should result in the existing foo.war being replaced with the new foo.war waitForDirectoryScan(); + waitForDirectoryScan(); jetty.assertWebAppContextsExists("/foo"); // Test that webapp response contains "-2" From 06f0498a480991b9512df4f6792b5ec32f2eabda Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Tue, 3 Jan 2012 12:15:51 +0100 Subject: [PATCH 08/34] Made tests more reliable by waiting for the websocket connection to be established and for onOpen() to be called. --- .../websocket/SafariWebsocketDraft0Test.java | 18 +++++++++--------- .../jetty/websocket/WebSocketCommTest.java | 11 ++++++----- .../jetty/websocket/helper/CaptureSocket.java | 19 ++++++++----------- .../jetty/websocket/helper/SafariD00.java | 10 ++++++---- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/SafariWebsocketDraft0Test.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/SafariWebsocketDraft0Test.java index 0afb1dfae64..9b4af2d27c9 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/SafariWebsocketDraft0Test.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/SafariWebsocketDraft0Test.java @@ -15,8 +15,6 @@ *******************************************************************************/ package org.eclipse.jetty.websocket; -import static org.hamcrest.Matchers.*; - import java.net.URI; import java.util.concurrent.TimeUnit; @@ -24,7 +22,6 @@ import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; -import org.eclipse.jetty.util.log.StdErrLog; import org.eclipse.jetty.websocket.helper.CaptureSocket; import org.eclipse.jetty.websocket.helper.SafariD00; import org.eclipse.jetty.websocket.helper.WebSocketCaptureServlet; @@ -32,9 +29,11 @@ import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; -import org.junit.Ignore; import org.junit.Test; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.notNullValue; + public class SafariWebsocketDraft0Test { private Server server; @@ -76,7 +75,7 @@ public class SafariWebsocketDraft0Test serverUri = new URI(String.format("ws://%s:%d/",host,port)); // System.out.printf("Server URI: %s%n",serverUri); } - + @Test public void testSendTextMessages() throws Exception { @@ -96,10 +95,11 @@ public class SafariWebsocketDraft0Test CaptureSocket socket = servlet.captures.get(0); Assert.assertThat("CaptureSocket",socket,notNullValue()); - Assert.assertThat("CaptureSocket.isConnected", socket.isConnected(), is(true)); + Assert.assertThat("CaptureSocket.isConnected", socket.awaitConnected(1000), is(true)); - // Give servlet 500 millisecond to process messages + // Give servlet time to process messages threadSleep(1,TimeUnit.SECONDS); + // Should have captured 5 messages. Assert.assertThat("CaptureSocket.messages.size",socket.messages.size(),is(5)); } @@ -109,13 +109,13 @@ public class SafariWebsocketDraft0Test safari.disconnect(); } } - + public static void threadSleep(int dur, TimeUnit unit) throws InterruptedException { long ms = TimeUnit.MILLISECONDS.convert(dur,unit); Thread.sleep(ms); } - + @After public void stopServer() throws Exception { diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketCommTest.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketCommTest.java index 0e91ffaa0e9..1668d13b5ad 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketCommTest.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketCommTest.java @@ -15,8 +15,6 @@ *******************************************************************************/ package org.eclipse.jetty.websocket; -import static org.hamcrest.Matchers.*; - import java.net.URI; import java.util.concurrent.TimeUnit; @@ -32,6 +30,9 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.notNullValue; + /** * WebSocketCommTest - to test reported undelivered messages in bug JETTY-1463 @@ -109,11 +110,11 @@ public class WebSocketCommTest CaptureSocket socket = servlet.captures.get(0); Assert.assertThat("CaptureSocket",socket,notNullValue()); - Assert.assertThat("CaptureSocket.isConnected",socket.isConnected(),is(true)); + Assert.assertThat("CaptureSocket.isConnected",socket.awaitConnected(1000),is(true)); - // Give servlet 500 millisecond to process messages + // Give servlet time to process messages TimeUnit.MILLISECONDS.sleep(500); - + // Should have captured 5 messages. Assert.assertThat("CaptureSocket.messages.size",socket.messages.size(),is(5)); } diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/helper/CaptureSocket.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/helper/CaptureSocket.java index 19233d4d297..de969280a34 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/helper/CaptureSocket.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/helper/CaptureSocket.java @@ -17,12 +17,14 @@ package org.eclipse.jetty.websocket.helper; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; import org.eclipse.jetty.websocket.WebSocket; -public class CaptureSocket implements WebSocket, WebSocket.OnTextMessage +public class CaptureSocket implements WebSocket.OnTextMessage { - private Connection conn; + private final CountDownLatch latch = new CountDownLatch(1); public List messages; public CaptureSocket() @@ -30,13 +32,9 @@ public class CaptureSocket implements WebSocket, WebSocket.OnTextMessage messages = new ArrayList(); } - public boolean isConnected() + public boolean awaitConnected(long timeout) throws InterruptedException { - if (conn == null) - { - return false; - } - return conn.isOpen(); + return latch.await(timeout, TimeUnit.MILLISECONDS); } public void onMessage(String data) @@ -47,11 +45,10 @@ public class CaptureSocket implements WebSocket, WebSocket.OnTextMessage public void onOpen(Connection connection) { - this.conn = connection; + latch.countDown(); } public void onClose(int closeCode, String message) { - this.conn = null; } -} \ No newline at end of file +} diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/helper/SafariD00.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/helper/SafariD00.java index 244e71cdc2d..85ab83c2ae4 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/helper/SafariD00.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/helper/SafariD00.java @@ -15,8 +15,6 @@ *******************************************************************************/ package org.eclipse.jetty.websocket.helper; -import static org.hamcrest.Matchers.*; - import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; @@ -32,6 +30,8 @@ import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.util.TypeUtil; import org.junit.Assert; +import static org.hamcrest.Matchers.is; + public class SafariD00 { private URI uri; @@ -48,7 +48,7 @@ public class SafariD00 /** * Open the Socket to the destination endpoint and - * + * * @return the open java Socket. * @throws IOException */ @@ -65,7 +65,7 @@ public class SafariD00 /** * Issue an Http websocket (Draft-0) upgrade request using the Safari particulars. - * + * * @throws UnsupportedEncodingException */ public void issueHandshake() throws IOException @@ -96,6 +96,8 @@ public class SafariD00 InputStreamReader reader = new InputStreamReader(in); BufferedReader br = new BufferedReader(reader); + socket.setSoTimeout(5000); + boolean foundEnd = false; String line; while (!foundEnd) From d6e841beaebf81e080ca48273cefb5c119f47fd8 Mon Sep 17 00:00:00 2001 From: Thomas Becker Date: Wed, 4 Jan 2012 17:13:59 +0100 Subject: [PATCH 09/34] 367716: maxIdleTime fixes for async http and new maxIdleTime tests Signed-off-by: Simone Bordet --- .../jetty/server/AsyncHttpConnection.java | 11 +- .../org/eclipse/jetty/server/Request.java | 12 ++ .../jetty/server/LocalAsyncContextTest.java | 151 +----------------- .../server/SelectChannelTimeoutTest.java | 83 +++++++++- 4 files changed, 100 insertions(+), 157 deletions(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java b/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java index 1ddedf015aa..ed45cb75809 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java @@ -56,7 +56,8 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async setCurrentConnection(this); // don't check for idle while dispatched (unless blocking IO is done). - _asyncEndp.setCheckForIdle(false); + if(!_request.isAsyncCompleted()) + _asyncEndp.setCheckForIdle(false); // While progress and the connection has not changed @@ -144,11 +145,13 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async // return buffers _parser.returnBuffers(); _generator.returnBuffers(); - - // resuming checking for idle + } + + if (_request.isAsyncCompleted() || _request.isAsyncInitial()) + { _asyncEndp.setCheckForIdle(true); } - + // Safety net to catch spinning if (some_progress) _total_no_progress=0; diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java index ca8789de207..4c16fec280b 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java @@ -1265,6 +1265,18 @@ public class Request implements HttpServletRequest return _async.isAsyncStarted(); } + /* ------------------------------------------------------------ */ + public boolean isAsyncInitial() + { + return _async.isInitial(); + } + + /* ------------------------------------------------------------ */ + public boolean isAsyncCompleted() + { + return _async.isComplete(); + } + /* ------------------------------------------------------------ */ public boolean isAsyncSupported() { diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/LocalAsyncContextTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/LocalAsyncContextTest.java index e5b13f6dc52..3042c767e98 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/LocalAsyncContextTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/LocalAsyncContextTest.java @@ -16,16 +16,10 @@ package org.eclipse.jetty.server; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import java.io.IOException; -import java.io.InputStream; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.continuation.Continuation; import org.eclipse.jetty.continuation.ContinuationListener; -import org.eclipse.jetty.server.handler.HandlerWrapper; import org.eclipse.jetty.server.session.SessionHandler; import org.junit.After; import org.junit.Before; @@ -151,149 +145,8 @@ public class LocalAsyncContextTest return ((LocalConnector)_connector).getResponses(request); } - private static class SuspendHandler extends HandlerWrapper - { - private int _read; - private long _suspendFor=-1; - private long _resumeAfter=-1; - private long _completeAfter=-1; - - public SuspendHandler() - { - } - - public int getRead() - { - return _read; - } - - public void setRead(int read) - { - _read = read; - } - - public long getSuspendFor() - { - return _suspendFor; - } - - public void setSuspendFor(long suspendFor) - { - _suspendFor = suspendFor; - } - - public long getResumeAfter() - { - return _resumeAfter; - } - - public void setResumeAfter(long resumeAfter) - { - _resumeAfter = resumeAfter; - } - - public long getCompleteAfter() - { - return _completeAfter; - } - - public void setCompleteAfter(long completeAfter) - { - _completeAfter = completeAfter; - } - - @Override - public void handle(String target, final Request baseRequest, final HttpServletRequest request, final HttpServletResponse response) throws IOException, ServletException - { - if (DispatcherType.REQUEST.equals(baseRequest.getDispatcherType())) - { - if (_read>0) - { - byte[] buf=new byte[_read]; - request.getInputStream().read(buf); - } - else if (_read<0) - { - InputStream in = request.getInputStream(); - int b=in.read(); - while(b!=-1) - b=in.read(); - } - - final AsyncContext asyncContext = baseRequest.startAsync(); - asyncContext.addContinuationListener(__asyncListener); - if (_suspendFor>0) - asyncContext.setTimeout(_suspendFor); - - if (_completeAfter>0) - { - new Thread() { - @Override - public void run() - { - try - { - Thread.sleep(_completeAfter); - response.getOutputStream().print("COMPLETED"); - response.setStatus(200); - baseRequest.setHandled(true); - asyncContext.complete(); - } - catch(Exception e) - { - e.printStackTrace(); - } - } - }.start(); - } - else if (_completeAfter==0) - { - response.getOutputStream().print("COMPLETED"); - response.setStatus(200); - baseRequest.setHandled(true); - asyncContext.complete(); - } - - if (_resumeAfter>0) - { - new Thread() { - @Override - public void run() - { - try - { - Thread.sleep(_resumeAfter); - if(((HttpServletRequest)asyncContext.getRequest()).getSession(true).getId()!=null) - asyncContext.dispatch(); - } - catch(Exception e) - { - e.printStackTrace(); - } - } - }.start(); - } - else if (_resumeAfter==0) - { - asyncContext.dispatch(); - } - } - else if (request.getAttribute("TIMEOUT")!=null) - { - response.setStatus(200); - response.getOutputStream().print("TIMEOUT"); - baseRequest.setHandled(true); - } - else - { - response.setStatus(200); - response.getOutputStream().print("RESUMED"); - baseRequest.setHandled(true); - } - } - } - - private static ContinuationListener __asyncListener = new ContinuationListener() + + static ContinuationListener __asyncListener = new ContinuationListener() { public void onComplete(Continuation continuation) { diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/SelectChannelTimeoutTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/SelectChannelTimeoutTest.java index ece6ae77b9f..9a5aeb0e1f1 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/SelectChannelTimeoutTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/SelectChannelTimeoutTest.java @@ -13,17 +13,92 @@ package org.eclipse.jetty.server; +import java.io.InputStream; +import java.net.Socket; +import java.net.SocketException; + import org.eclipse.jetty.server.nio.SelectChannelConnector; -import org.junit.BeforeClass; +import org.eclipse.jetty.server.session.SessionHandler; +import org.eclipse.jetty.util.IO; +import org.junit.Before; +import org.junit.Test; public class SelectChannelTimeoutTest extends ConnectorTimeoutTest { - @BeforeClass - public static void init() throws Exception + + @Before + public void init() throws Exception { SelectChannelConnector connector = new SelectChannelConnector(); - connector.setMaxIdleTime(MAX_IDLE_TIME); //250 msec max idle + connector.setMaxIdleTime(MAX_IDLE_TIME); // 250 msec max idle startServer(connector); } + @Test(expected=SocketException.class) + public void testIdleTimeoutAfterSuspend() throws Exception + { + SuspendHandler _handler = new SuspendHandler(); + _server.stop(); + SessionHandler session = new SessionHandler(); + session.setHandler(_handler); + _server.setHandler(session); + _server.start(); + + _handler.setSuspendFor(100); + _handler.setResumeAfter(25); + process(null); + } + + @Test(expected=SocketException.class) + public void testIdleTimeoutAfterTimeout() throws Exception + { + SuspendHandler _handler = new SuspendHandler(); + _server.stop(); + SessionHandler session = new SessionHandler(); + session.setHandler(_handler); + _server.setHandler(session); + _server.start(); + + _handler.setSuspendFor(50); + System.out.println(process(null)); + } + + @Test(expected=SocketException.class) + public void testIdleTimeoutAfterComplete() throws Exception + { + SuspendHandler _handler = new SuspendHandler(); + _server.stop(); + SessionHandler session = new SessionHandler(); + session.setHandler(_handler); + _server.setHandler(session); + _server.start(); + + _handler.setSuspendFor(100); + _handler.setCompleteAfter(25); + System.out.println(process(null)); + } + + // TODO: remove code duplication to LocalAsyncContextTest.java + private synchronized String process(String content) throws Exception + { + String request = "GET / HTTP/1.1\r\n" + "Host: localhost\r\n" + "Connection: close\r\n"; + + if (content == null) + request += "\r\n"; + else + request += "Content-Length: " + content.length() + "\r\n" + "\r\n" + content; + return getResponse(request); + } + + protected String getResponse(String request) throws Exception + { + SelectChannelConnector connector = (SelectChannelConnector)_connector; + Socket socket = new Socket((String)null,connector.getLocalPort()); + socket.getOutputStream().write(request.getBytes("UTF-8")); + InputStream inputStream = socket.getInputStream(); + Thread.sleep(500); + socket.getOutputStream().write(10); + return IO.toString(inputStream); + } + } From 07afebafe53e3b041ecd1940bf4c0c7533b04869 Mon Sep 17 00:00:00 2001 From: Thomas Becker Date: Thu, 5 Jan 2012 13:18:41 +0100 Subject: [PATCH 10/34] 367716: maxIdleTime fixes Signed-off-by: Simone Bordet --- .../jetty/server/AsyncHttpConnection.java | 7 +- .../org/eclipse/jetty/server/Request.java | 27 +--- .../server/SelectChannelTimeoutTest.java | 30 ++-- .../eclipse/jetty/server/SuspendHandler.java | 153 ++++++++++++++++++ 4 files changed, 178 insertions(+), 39 deletions(-) create mode 100644 jetty-server/src/test/java/org/eclipse/jetty/server/SuspendHandler.java diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java b/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java index ed45cb75809..031ad11e8d0 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java @@ -56,8 +56,7 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async setCurrentConnection(this); // don't check for idle while dispatched (unless blocking IO is done). - if(!_request.isAsyncCompleted()) - _asyncEndp.setCheckForIdle(false); + _asyncEndp.setCheckForIdle(false); // While progress and the connection has not changed @@ -140,14 +139,14 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async setCurrentConnection(null); // If we are not suspended - if (!_request.isAsyncStarted()) + if (!_request.getAsyncContinuation().isAsyncStarted()) { // return buffers _parser.returnBuffers(); _generator.returnBuffers(); } - if (_request.isAsyncCompleted() || _request.isAsyncInitial()) + if (_request.getAsyncContinuation().isComplete() || _request.getAsyncContinuation().isInitial()) { _asyncEndp.setCheckForIdle(true); } diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java index 4c16fec280b..4fc8c5934d5 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java @@ -308,10 +308,11 @@ public class Request implements HttpServletRequest } } + /* ------------------------------------------------------------ */ public AsyncContext getAsyncContext() { - if (_async.isInitial() && !isAsyncStarted()) + if (_async.isInitial() && !_async.isAsyncStarted()) throw new IllegalStateException(_async.getStatusString()); return _async; } @@ -1260,34 +1261,16 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - public boolean isAsyncStarted() + public boolean isHandled() { - return _async.isAsyncStarted(); + return _handled; } - - /* ------------------------------------------------------------ */ - public boolean isAsyncInitial() - { - return _async.isInitial(); - } - - /* ------------------------------------------------------------ */ - public boolean isAsyncCompleted() - { - return _async.isComplete(); - } - + /* ------------------------------------------------------------ */ public boolean isAsyncSupported() { return _asyncSupported; } - - /* ------------------------------------------------------------ */ - public boolean isHandled() - { - return _handled; - } /* ------------------------------------------------------------ */ /* diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/SelectChannelTimeoutTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/SelectChannelTimeoutTest.java index 9a5aeb0e1f1..c3479cb4d4a 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/SelectChannelTimeoutTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/SelectChannelTimeoutTest.java @@ -13,9 +13,13 @@ package org.eclipse.jetty.server; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.IOException; import java.io.InputStream; +import java.io.UnsupportedEncodingException; import java.net.Socket; -import java.net.SocketException; import org.eclipse.jetty.server.nio.SelectChannelConnector; import org.eclipse.jetty.server.session.SessionHandler; @@ -34,7 +38,7 @@ public class SelectChannelTimeoutTest extends ConnectorTimeoutTest startServer(connector); } - @Test(expected=SocketException.class) + @Test public void testIdleTimeoutAfterSuspend() throws Exception { SuspendHandler _handler = new SuspendHandler(); @@ -46,10 +50,10 @@ public class SelectChannelTimeoutTest extends ConnectorTimeoutTest _handler.setSuspendFor(100); _handler.setResumeAfter(25); - process(null); + assertTrue(process(null).toUpperCase().contains("RESUMED")); } - @Test(expected=SocketException.class) + @Test public void testIdleTimeoutAfterTimeout() throws Exception { SuspendHandler _handler = new SuspendHandler(); @@ -60,11 +64,11 @@ public class SelectChannelTimeoutTest extends ConnectorTimeoutTest _server.start(); _handler.setSuspendFor(50); - System.out.println(process(null)); + assertTrue(process(null).toUpperCase().contains("TIMEOUT")); } - @Test(expected=SocketException.class) - public void testIdleTimeoutAfterComplete() throws Exception + @Test + public void testIdleTimeoutAfterComplete() throws Exception { SuspendHandler _handler = new SuspendHandler(); _server.stop(); @@ -75,11 +79,10 @@ public class SelectChannelTimeoutTest extends ConnectorTimeoutTest _handler.setSuspendFor(100); _handler.setCompleteAfter(25); - System.out.println(process(null)); + assertTrue(process(null).toUpperCase().contains("COMPLETED")); } - // TODO: remove code duplication to LocalAsyncContextTest.java - private synchronized String process(String content) throws Exception + private synchronized String process(String content) throws UnsupportedEncodingException, IOException, InterruptedException { String request = "GET / HTTP/1.1\r\n" + "Host: localhost\r\n" + "Connection: close\r\n"; @@ -90,15 +93,16 @@ public class SelectChannelTimeoutTest extends ConnectorTimeoutTest return getResponse(request); } - protected String getResponse(String request) throws Exception + private String getResponse(String request) throws UnsupportedEncodingException, IOException, InterruptedException { SelectChannelConnector connector = (SelectChannelConnector)_connector; Socket socket = new Socket((String)null,connector.getLocalPort()); socket.getOutputStream().write(request.getBytes("UTF-8")); InputStream inputStream = socket.getInputStream(); + String response = IO.toString(inputStream); Thread.sleep(500); - socket.getOutputStream().write(10); - return IO.toString(inputStream); + assertEquals("Socket should be closed and return -1 on reading",-1,socket.getInputStream().read()); + return response; } } diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/SuspendHandler.java b/jetty-server/src/test/java/org/eclipse/jetty/server/SuspendHandler.java new file mode 100644 index 00000000000..f5ea64c3bd1 --- /dev/null +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/SuspendHandler.java @@ -0,0 +1,153 @@ +package org.eclipse.jetty.server; + +import java.io.IOException; +import java.io.InputStream; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.eclipse.jetty.server.handler.HandlerWrapper; + +class SuspendHandler extends HandlerWrapper +{ + private int _read; + private long _suspendFor=-1; + private long _resumeAfter=-1; + private long _completeAfter=-1; + + public SuspendHandler() + { + } + + public int getRead() + { + return _read; + } + + public void setRead(int read) + { + _read = read; + } + + public long getSuspendFor() + { + return _suspendFor; + } + + public void setSuspendFor(long suspendFor) + { + _suspendFor = suspendFor; + } + + public long getResumeAfter() + { + return _resumeAfter; + } + + public void setResumeAfter(long resumeAfter) + { + _resumeAfter = resumeAfter; + } + + public long getCompleteAfter() + { + return _completeAfter; + } + + public void setCompleteAfter(long completeAfter) + { + _completeAfter = completeAfter; + } + + @Override + public void handle(String target, final Request baseRequest, final HttpServletRequest request, final HttpServletResponse response) throws IOException, ServletException + { + if (DispatcherType.REQUEST.equals(baseRequest.getDispatcherType())) + { + if (_read>0) + { + byte[] buf=new byte[_read]; + request.getInputStream().read(buf); + } + else if (_read<0) + { + InputStream in = request.getInputStream(); + int b=in.read(); + while(b!=-1) + b=in.read(); + } + + final AsyncContext asyncContext = baseRequest.startAsync(); + asyncContext.addContinuationListener(LocalAsyncContextTest.__asyncListener); + if (_suspendFor>0) + asyncContext.setTimeout(_suspendFor); + + if (_completeAfter>0) + { + new Thread() { + @Override + public void run() + { + try + { + Thread.sleep(_completeAfter); + response.getOutputStream().print("COMPLETED"); + response.setStatus(200); + baseRequest.setHandled(true); + asyncContext.complete(); + } + catch(Exception e) + { + e.printStackTrace(); + } + } + }.start(); + } + else if (_completeAfter==0) + { + response.getOutputStream().print("COMPLETED"); + response.setStatus(200); + baseRequest.setHandled(true); + asyncContext.complete(); + } + + if (_resumeAfter>0) + { + new Thread() { + @Override + public void run() + { + try + { + Thread.sleep(_resumeAfter); + if(((HttpServletRequest)asyncContext.getRequest()).getSession(true).getId()!=null) + asyncContext.dispatch(); + } + catch(Exception e) + { + e.printStackTrace(); + } + } + }.start(); + } + else if (_resumeAfter==0) + { + asyncContext.dispatch(); + } + } + else if (request.getAttribute("TIMEOUT")!=null) + { + response.setStatus(200); + response.getOutputStream().print("TIMEOUT"); + baseRequest.setHandled(true); + } + else + { + response.setStatus(200); + response.getOutputStream().print("RESUMED"); + baseRequest.setHandled(true); + } + } + +} \ No newline at end of file From bbe48ddfbbc38dd8c7eca079c669236470804271 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Thu, 5 Jan 2012 09:26:44 -0700 Subject: [PATCH 11/34] Updating version jetty-7.6.0.RC3 in VERSION.txt --- VERSION.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/VERSION.txt b/VERSION.txt index eb6e1de36f0..fc47f1ba50c 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1,4 +1,13 @@ -jetty-7.6.0-SNAPSHOT +jetty-7.6.0.RC3 - 05 January 2012 + + 367433 added tests to investigate + + 367435 improved D00 test harness + + 367485 HttpExchange canceled before response do not release connection. + + 367502 WebSocket connections should be closed when application context is + stopped. + + 367591 corrected configuration.xml version to 7.6 + + 367635 Added support for start.d directory + + 637638 limit number of form parameters to avoid DOS + + JETTY-1467 close half closed when idle jetty-7.6.0.RC2 - 22 December 2011 + 364638 HttpParser closes if data received while seeking EOF. Tests fixed to From 10d751fed834dd522f79c5f58fee990e8f3bd42d Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Thu, 5 Jan 2012 09:49:31 -0700 Subject: [PATCH 12/34] [maven-release-plugin] prepare release jetty-7.6.0.RC3 --- example-jetty-embedded/pom.xml | 2 +- jetty-aggregate/jetty-all-server/pom.xml | 2 +- jetty-aggregate/jetty-all/pom.xml | 2 +- jetty-aggregate/jetty-client/pom.xml | 2 +- jetty-aggregate/jetty-plus/pom.xml | 2 +- jetty-aggregate/jetty-server/pom.xml | 2 +- jetty-aggregate/jetty-servlet/pom.xml | 2 +- jetty-aggregate/jetty-webapp/pom.xml | 2 +- jetty-aggregate/jetty-websocket/pom.xml | 2 +- jetty-aggregate/pom.xml | 2 +- jetty-ajp/pom.xml | 2 +- jetty-annotations/pom.xml | 2 +- jetty-client/pom.xml | 2 +- jetty-continuation/pom.xml | 2 +- jetty-deploy/pom.xml | 2 +- jetty-distribution/pom.xml | 2 +- jetty-http-spi/pom.xml | 2 +- jetty-http/pom.xml | 2 +- jetty-io/pom.xml | 2 +- jetty-jaspi/pom.xml | 2 +- jetty-jmx/pom.xml | 2 +- jetty-jndi/pom.xml | 2 +- jetty-monitor/pom.xml | 2 +- jetty-nested/pom.xml | 2 +- jetty-nosql/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-jsp/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-logback/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-warurl/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot/pom.xml | 2 +- jetty-osgi/jetty-osgi-equinoxtools/pom.xml | 2 +- jetty-osgi/jetty-osgi-httpservice/pom.xml | 2 +- jetty-osgi/pom.xml | 2 +- jetty-osgi/test-jetty-osgi/pom.xml | 2 +- jetty-overlay-deployer/pom.xml | 2 +- jetty-plus/pom.xml | 2 +- jetty-policy/pom.xml | 2 +- jetty-rewrite/pom.xml | 2 +- jetty-security/pom.xml | 2 +- jetty-server/pom.xml | 2 +- jetty-servlet/pom.xml | 2 +- jetty-servlets/pom.xml | 2 +- jetty-start/pom.xml | 2 +- jetty-util/pom.xml | 2 +- jetty-webapp/pom.xml | 2 +- jetty-websocket/pom.xml | 2 +- jetty-xml/pom.xml | 2 +- pom.xml | 2 +- test-continuation/pom.xml | 2 +- test-jetty-nested/pom.xml | 2 +- test-jetty-servlet/pom.xml | 2 +- test-jetty-webapp/pom.xml | 2 +- tests/pom.xml | 2 +- tests/test-integration/pom.xml | 2 +- tests/test-loginservice/pom.xml | 2 +- tests/test-sessions/pom.xml | 2 +- tests/test-sessions/test-hash-sessions/pom.xml | 2 +- tests/test-sessions/test-jdbc-sessions/pom.xml | 2 +- tests/test-sessions/test-sessions-common/pom.xml | 2 +- tests/test-webapps/pom.xml | 2 +- tests/test-webapps/test-webapp-rfc2616/pom.xml | 2 +- 60 files changed, 60 insertions(+), 60 deletions(-) diff --git a/example-jetty-embedded/pom.xml b/example-jetty-embedded/pom.xml index 3eb95b0ea27..b7ce672ca77 100644 --- a/example-jetty-embedded/pom.xml +++ b/example-jetty-embedded/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 example-jetty-embedded diff --git a/jetty-aggregate/jetty-all-server/pom.xml b/jetty-aggregate/jetty-all-server/pom.xml index 072ff23321e..1614450e6a1 100644 --- a/jetty-aggregate/jetty-all-server/pom.xml +++ b/jetty-aggregate/jetty-all-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-all-server diff --git a/jetty-aggregate/jetty-all/pom.xml b/jetty-aggregate/jetty-all/pom.xml index 3a6eee3ac51..3e2b87f2249 100644 --- a/jetty-aggregate/jetty-all/pom.xml +++ b/jetty-aggregate/jetty-all/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-all diff --git a/jetty-aggregate/jetty-client/pom.xml b/jetty-aggregate/jetty-client/pom.xml index e30ee5b160a..ae0af26f0d9 100644 --- a/jetty-aggregate/jetty-client/pom.xml +++ b/jetty-aggregate/jetty-client/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-client diff --git a/jetty-aggregate/jetty-plus/pom.xml b/jetty-aggregate/jetty-plus/pom.xml index ff9bf1f74c9..b8c3b4e792c 100644 --- a/jetty-aggregate/jetty-plus/pom.xml +++ b/jetty-aggregate/jetty-plus/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-plus diff --git a/jetty-aggregate/jetty-server/pom.xml b/jetty-aggregate/jetty-server/pom.xml index 8d3cdddcb2f..95b721d3c62 100644 --- a/jetty-aggregate/jetty-server/pom.xml +++ b/jetty-aggregate/jetty-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-server diff --git a/jetty-aggregate/jetty-servlet/pom.xml b/jetty-aggregate/jetty-servlet/pom.xml index 2e4f9bd47ee..c57674f08c4 100644 --- a/jetty-aggregate/jetty-servlet/pom.xml +++ b/jetty-aggregate/jetty-servlet/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-servlet diff --git a/jetty-aggregate/jetty-webapp/pom.xml b/jetty-aggregate/jetty-webapp/pom.xml index 47090b07d8f..4eef2f2284f 100644 --- a/jetty-aggregate/jetty-webapp/pom.xml +++ b/jetty-aggregate/jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-webapp diff --git a/jetty-aggregate/jetty-websocket/pom.xml b/jetty-aggregate/jetty-websocket/pom.xml index c650ef55103..55f9991ac1d 100644 --- a/jetty-aggregate/jetty-websocket/pom.xml +++ b/jetty-aggregate/jetty-websocket/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-websocket diff --git a/jetty-aggregate/pom.xml b/jetty-aggregate/pom.xml index 7de1ac8d379..59b959c1c82 100644 --- a/jetty-aggregate/pom.xml +++ b/jetty-aggregate/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 org.eclipse.jetty.aggregate jetty-aggregate-project diff --git a/jetty-ajp/pom.xml b/jetty-ajp/pom.xml index c02155bea81..02328ee43f8 100644 --- a/jetty-ajp/pom.xml +++ b/jetty-ajp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-ajp diff --git a/jetty-annotations/pom.xml b/jetty-annotations/pom.xml index a4b6c219f44..9eb9ef70c66 100644 --- a/jetty-annotations/pom.xml +++ b/jetty-annotations/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-annotations diff --git a/jetty-client/pom.xml b/jetty-client/pom.xml index 02a0320bdd9..7593a5a1e34 100644 --- a/jetty-client/pom.xml +++ b/jetty-client/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 diff --git a/jetty-continuation/pom.xml b/jetty-continuation/pom.xml index 6c4c47b893a..df1c6cb5a58 100644 --- a/jetty-continuation/pom.xml +++ b/jetty-continuation/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-continuation diff --git a/jetty-deploy/pom.xml b/jetty-deploy/pom.xml index 528e7ce46c0..4dddd4e102b 100644 --- a/jetty-deploy/pom.xml +++ b/jetty-deploy/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-deploy diff --git a/jetty-distribution/pom.xml b/jetty-distribution/pom.xml index 173d546d426..a29ec58fedc 100644 --- a/jetty-distribution/pom.xml +++ b/jetty-distribution/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 jetty-distribution Jetty :: Distribution Assemblies diff --git a/jetty-http-spi/pom.xml b/jetty-http-spi/pom.xml index 856673b86eb..8234a14d5f8 100644 --- a/jetty-http-spi/pom.xml +++ b/jetty-http-spi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-http-spi diff --git a/jetty-http/pom.xml b/jetty-http/pom.xml index 53d5c6e9641..17496bc94b2 100644 --- a/jetty-http/pom.xml +++ b/jetty-http/pom.xml @@ -2,7 +2,7 @@ jetty-project org.eclipse.jetty - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 org.eclipse.jetty diff --git a/jetty-io/pom.xml b/jetty-io/pom.xml index 8a5f69852a6..2acc47bd96b 100644 --- a/jetty-io/pom.xml +++ b/jetty-io/pom.xml @@ -2,7 +2,7 @@ jetty-project org.eclipse.jetty - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 org.eclipse.jetty diff --git a/jetty-jaspi/pom.xml b/jetty-jaspi/pom.xml index f06938ce0f8..2fceec06534 100644 --- a/jetty-jaspi/pom.xml +++ b/jetty-jaspi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-jaspi diff --git a/jetty-jmx/pom.xml b/jetty-jmx/pom.xml index 4b9a0dc2a9d..60fb9b6ce59 100644 --- a/jetty-jmx/pom.xml +++ b/jetty-jmx/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-jmx diff --git a/jetty-jndi/pom.xml b/jetty-jndi/pom.xml index 5eaf6fef291..a4526e33694 100644 --- a/jetty-jndi/pom.xml +++ b/jetty-jndi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-jndi diff --git a/jetty-monitor/pom.xml b/jetty-monitor/pom.xml index bfff477df54..ed3a957ada2 100644 --- a/jetty-monitor/pom.xml +++ b/jetty-monitor/pom.xml @@ -19,7 +19,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-monitor diff --git a/jetty-nested/pom.xml b/jetty-nested/pom.xml index 40da79b3cfe..f60b6caad00 100644 --- a/jetty-nested/pom.xml +++ b/jetty-nested/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 jetty-nested Jetty :: Nested diff --git a/jetty-nosql/pom.xml b/jetty-nosql/pom.xml index 75b77f019a9..06d909fe6c6 100644 --- a/jetty-nosql/pom.xml +++ b/jetty-nosql/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-nosql diff --git a/jetty-osgi/jetty-osgi-boot-jsp/pom.xml b/jetty-osgi/jetty-osgi-boot-jsp/pom.xml index 76e530cde78..c24780b5bee 100644 --- a/jetty-osgi/jetty-osgi-boot-jsp/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-jsp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot-logback/pom.xml b/jetty-osgi/jetty-osgi-boot-logback/pom.xml index 595e77a4b24..216a0c9852c 100644 --- a/jetty-osgi/jetty-osgi-boot-logback/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-logback/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot-warurl/pom.xml b/jetty-osgi/jetty-osgi-boot-warurl/pom.xml index a0463cc5643..ac2daad4649 100644 --- a/jetty-osgi/jetty-osgi-boot-warurl/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-warurl/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot/pom.xml b/jetty-osgi/jetty-osgi-boot/pom.xml index 87a7087125d..6eb494efcc0 100644 --- a/jetty-osgi/jetty-osgi-boot/pom.xml +++ b/jetty-osgi/jetty-osgi-boot/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-equinoxtools/pom.xml b/jetty-osgi/jetty-osgi-equinoxtools/pom.xml index fbb16968697..e39ecae8b7c 100644 --- a/jetty-osgi/jetty-osgi-equinoxtools/pom.xml +++ b/jetty-osgi/jetty-osgi-equinoxtools/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-httpservice/pom.xml b/jetty-osgi/jetty-osgi-httpservice/pom.xml index e389254295d..098cbee1234 100644 --- a/jetty-osgi/jetty-osgi-httpservice/pom.xml +++ b/jetty-osgi/jetty-osgi-httpservice/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 ../pom.xml 4.0.0 diff --git a/jetty-osgi/pom.xml b/jetty-osgi/pom.xml index ae30fdd313e..1b6e19ca932 100644 --- a/jetty-osgi/pom.xml +++ b/jetty-osgi/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 ../pom.xml org.eclipse.jetty.osgi diff --git a/jetty-osgi/test-jetty-osgi/pom.xml b/jetty-osgi/test-jetty-osgi/pom.xml index f0ae38a1230..4981ca2f40e 100644 --- a/jetty-osgi/test-jetty-osgi/pom.xml +++ b/jetty-osgi/test-jetty-osgi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 ../pom.xml 4.0.0 diff --git a/jetty-overlay-deployer/pom.xml b/jetty-overlay-deployer/pom.xml index 75b8349308e..59516ca7399 100644 --- a/jetty-overlay-deployer/pom.xml +++ b/jetty-overlay-deployer/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-overlay-deployer diff --git a/jetty-plus/pom.xml b/jetty-plus/pom.xml index 391eb9691c7..608ca3c2abc 100644 --- a/jetty-plus/pom.xml +++ b/jetty-plus/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-plus diff --git a/jetty-policy/pom.xml b/jetty-policy/pom.xml index 64548024678..8281dd66789 100644 --- a/jetty-policy/pom.xml +++ b/jetty-policy/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 org.eclipse.jetty jetty-policy diff --git a/jetty-rewrite/pom.xml b/jetty-rewrite/pom.xml index cdfe6d1c5b0..c245d1f176c 100644 --- a/jetty-rewrite/pom.xml +++ b/jetty-rewrite/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-rewrite diff --git a/jetty-security/pom.xml b/jetty-security/pom.xml index 397991f6299..97ddadab69a 100644 --- a/jetty-security/pom.xml +++ b/jetty-security/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-security diff --git a/jetty-server/pom.xml b/jetty-server/pom.xml index 8e71f15966d..de1d69a0794 100644 --- a/jetty-server/pom.xml +++ b/jetty-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-server diff --git a/jetty-servlet/pom.xml b/jetty-servlet/pom.xml index 70ab5daf8a3..7e58d15ef31 100644 --- a/jetty-servlet/pom.xml +++ b/jetty-servlet/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-servlet diff --git a/jetty-servlets/pom.xml b/jetty-servlets/pom.xml index 9e112abff9e..95e7262559c 100644 --- a/jetty-servlets/pom.xml +++ b/jetty-servlets/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-servlets diff --git a/jetty-start/pom.xml b/jetty-start/pom.xml index 9fcfa2c2cc8..c113d9ddbec 100644 --- a/jetty-start/pom.xml +++ b/jetty-start/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-start diff --git a/jetty-util/pom.xml b/jetty-util/pom.xml index 9e5dc45445a..021e7382130 100644 --- a/jetty-util/pom.xml +++ b/jetty-util/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-util diff --git a/jetty-webapp/pom.xml b/jetty-webapp/pom.xml index eb1971c5043..e0add50cedf 100644 --- a/jetty-webapp/pom.xml +++ b/jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-webapp diff --git a/jetty-websocket/pom.xml b/jetty-websocket/pom.xml index cfb4b91e581..8c115c24a53 100644 --- a/jetty-websocket/pom.xml +++ b/jetty-websocket/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 diff --git a/jetty-xml/pom.xml b/jetty-xml/pom.xml index b2a39954309..4e5e019e493 100644 --- a/jetty-xml/pom.xml +++ b/jetty-xml/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 jetty-xml diff --git a/pom.xml b/pom.xml index 63315d4c21c..d7d88cc7780 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ 19 jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 Jetty :: Project ${jetty.url} pom diff --git a/test-continuation/pom.xml b/test-continuation/pom.xml index 498bf751457..a863188bb1c 100644 --- a/test-continuation/pom.xml +++ b/test-continuation/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 test-continuation diff --git a/test-jetty-nested/pom.xml b/test-jetty-nested/pom.xml index 2f5b334f991..d2a93c99496 100644 --- a/test-jetty-nested/pom.xml +++ b/test-jetty-nested/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 test-jetty-nested Jetty :: Nested Test diff --git a/test-jetty-servlet/pom.xml b/test-jetty-servlet/pom.xml index 65f98aa0f62..bad4d38e7ff 100644 --- a/test-jetty-servlet/pom.xml +++ b/test-jetty-servlet/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 test-jetty-servlet diff --git a/test-jetty-webapp/pom.xml b/test-jetty-webapp/pom.xml index 5c9fbf6c19b..542c82afaf8 100644 --- a/test-jetty-webapp/pom.xml +++ b/test-jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 org.eclipse.jetty diff --git a/tests/pom.xml b/tests/pom.xml index 28cee13d78b..2e6dc08761e 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty jetty-project - 7.6.0-SNAPSHOT + 7.6.0.RC3 org.eclipse.jetty.tests tests-parent diff --git a/tests/test-integration/pom.xml b/tests/test-integration/pom.xml index bf1daf62b96..9a6d5636dee 100644 --- a/tests/test-integration/pom.xml +++ b/tests/test-integration/pom.xml @@ -20,7 +20,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.0-SNAPSHOT + 7.6.0.RC3 4.0.0 test-integration diff --git a/tests/test-loginservice/pom.xml b/tests/test-loginservice/pom.xml index a5e08c91017..8519a127617 100644 --- a/tests/test-loginservice/pom.xml +++ b/tests/test-loginservice/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.0-SNAPSHOT + 7.6.0.RC3 test-loginservice Jetty Tests :: Login Service diff --git a/tests/test-sessions/pom.xml b/tests/test-sessions/pom.xml index 8c829fa6935..80a21e7dfa6 100644 --- a/tests/test-sessions/pom.xml +++ b/tests/test-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.0-SNAPSHOT + 7.6.0.RC3 test-sessions-parent Jetty Tests :: Sessions :: Parent diff --git a/tests/test-sessions/test-hash-sessions/pom.xml b/tests/test-sessions/test-hash-sessions/pom.xml index 1152f8a40e2..8903cb3c52b 100644 --- a/tests/test-sessions/test-hash-sessions/pom.xml +++ b/tests/test-sessions/test-hash-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.0-SNAPSHOT + 7.6.0.RC3 test-hash-sessions Jetty Tests :: Sessions :: Hash diff --git a/tests/test-sessions/test-jdbc-sessions/pom.xml b/tests/test-sessions/test-jdbc-sessions/pom.xml index 567cfad6daa..e1ed5aaf848 100644 --- a/tests/test-sessions/test-jdbc-sessions/pom.xml +++ b/tests/test-sessions/test-jdbc-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.0-SNAPSHOT + 7.6.0.RC3 test-jdbc-sessions Jetty Tests :: Sessions :: JDBC diff --git a/tests/test-sessions/test-sessions-common/pom.xml b/tests/test-sessions/test-sessions-common/pom.xml index 2979f679288..2c59d59b2cf 100644 --- a/tests/test-sessions/test-sessions-common/pom.xml +++ b/tests/test-sessions/test-sessions-common/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.0-SNAPSHOT + 7.6.0.RC3 test-sessions-common Jetty Tests :: Sessions :: Common diff --git a/tests/test-webapps/pom.xml b/tests/test-webapps/pom.xml index c34dda4cdc9..00a3b0cbcfd 100644 --- a/tests/test-webapps/pom.xml +++ b/tests/test-webapps/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.0-SNAPSHOT + 7.6.0.RC3 test-webapps-parent Jetty Tests :: WebApps :: Parent diff --git a/tests/test-webapps/test-webapp-rfc2616/pom.xml b/tests/test-webapps/test-webapp-rfc2616/pom.xml index fcc140014f9..3a46350b438 100644 --- a/tests/test-webapps/test-webapp-rfc2616/pom.xml +++ b/tests/test-webapps/test-webapp-rfc2616/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-webapps-parent - 7.6.0-SNAPSHOT + 7.6.0.RC3 test-webapp-rfc2616 Jetty Tests :: WebApp :: RFC2616 From 51e3af89b8dd57b7bd41a2701c865371ff50302c Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Thu, 5 Jan 2012 09:49:38 -0700 Subject: [PATCH 13/34] [maven-release-plugin] prepare for next development iteration --- example-jetty-embedded/pom.xml | 2 +- jetty-aggregate/jetty-all-server/pom.xml | 2 +- jetty-aggregate/jetty-all/pom.xml | 2 +- jetty-aggregate/jetty-client/pom.xml | 2 +- jetty-aggregate/jetty-plus/pom.xml | 2 +- jetty-aggregate/jetty-server/pom.xml | 2 +- jetty-aggregate/jetty-servlet/pom.xml | 2 +- jetty-aggregate/jetty-webapp/pom.xml | 2 +- jetty-aggregate/jetty-websocket/pom.xml | 2 +- jetty-aggregate/pom.xml | 2 +- jetty-ajp/pom.xml | 2 +- jetty-annotations/pom.xml | 2 +- jetty-client/pom.xml | 2 +- jetty-continuation/pom.xml | 2 +- jetty-deploy/pom.xml | 2 +- jetty-distribution/pom.xml | 2 +- jetty-http-spi/pom.xml | 2 +- jetty-http/pom.xml | 2 +- jetty-io/pom.xml | 2 +- jetty-jaspi/pom.xml | 2 +- jetty-jmx/pom.xml | 2 +- jetty-jndi/pom.xml | 2 +- jetty-monitor/pom.xml | 2 +- jetty-nested/pom.xml | 2 +- jetty-nosql/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-jsp/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-logback/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot-warurl/pom.xml | 2 +- jetty-osgi/jetty-osgi-boot/pom.xml | 2 +- jetty-osgi/jetty-osgi-equinoxtools/pom.xml | 2 +- jetty-osgi/jetty-osgi-httpservice/pom.xml | 2 +- jetty-osgi/pom.xml | 2 +- jetty-osgi/test-jetty-osgi/pom.xml | 2 +- jetty-overlay-deployer/pom.xml | 2 +- jetty-plus/pom.xml | 2 +- jetty-policy/pom.xml | 2 +- jetty-rewrite/pom.xml | 2 +- jetty-security/pom.xml | 2 +- jetty-server/pom.xml | 2 +- jetty-servlet/pom.xml | 2 +- jetty-servlets/pom.xml | 2 +- jetty-start/pom.xml | 2 +- jetty-util/pom.xml | 2 +- jetty-webapp/pom.xml | 2 +- jetty-websocket/pom.xml | 2 +- jetty-xml/pom.xml | 2 +- pom.xml | 2 +- test-continuation/pom.xml | 2 +- test-jetty-nested/pom.xml | 2 +- test-jetty-servlet/pom.xml | 2 +- test-jetty-webapp/pom.xml | 2 +- tests/pom.xml | 2 +- tests/test-integration/pom.xml | 2 +- tests/test-loginservice/pom.xml | 2 +- tests/test-sessions/pom.xml | 2 +- tests/test-sessions/test-hash-sessions/pom.xml | 2 +- tests/test-sessions/test-jdbc-sessions/pom.xml | 2 +- tests/test-sessions/test-sessions-common/pom.xml | 2 +- tests/test-webapps/pom.xml | 2 +- tests/test-webapps/test-webapp-rfc2616/pom.xml | 2 +- 60 files changed, 60 insertions(+), 60 deletions(-) diff --git a/example-jetty-embedded/pom.xml b/example-jetty-embedded/pom.xml index b7ce672ca77..3eb95b0ea27 100644 --- a/example-jetty-embedded/pom.xml +++ b/example-jetty-embedded/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 example-jetty-embedded diff --git a/jetty-aggregate/jetty-all-server/pom.xml b/jetty-aggregate/jetty-all-server/pom.xml index 1614450e6a1..072ff23321e 100644 --- a/jetty-aggregate/jetty-all-server/pom.xml +++ b/jetty-aggregate/jetty-all-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-all-server diff --git a/jetty-aggregate/jetty-all/pom.xml b/jetty-aggregate/jetty-all/pom.xml index 3e2b87f2249..3a6eee3ac51 100644 --- a/jetty-aggregate/jetty-all/pom.xml +++ b/jetty-aggregate/jetty-all/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-all diff --git a/jetty-aggregate/jetty-client/pom.xml b/jetty-aggregate/jetty-client/pom.xml index ae0af26f0d9..e30ee5b160a 100644 --- a/jetty-aggregate/jetty-client/pom.xml +++ b/jetty-aggregate/jetty-client/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-client diff --git a/jetty-aggregate/jetty-plus/pom.xml b/jetty-aggregate/jetty-plus/pom.xml index b8c3b4e792c..ff9bf1f74c9 100644 --- a/jetty-aggregate/jetty-plus/pom.xml +++ b/jetty-aggregate/jetty-plus/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-plus diff --git a/jetty-aggregate/jetty-server/pom.xml b/jetty-aggregate/jetty-server/pom.xml index 95b721d3c62..8d3cdddcb2f 100644 --- a/jetty-aggregate/jetty-server/pom.xml +++ b/jetty-aggregate/jetty-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-server diff --git a/jetty-aggregate/jetty-servlet/pom.xml b/jetty-aggregate/jetty-servlet/pom.xml index c57674f08c4..2e4f9bd47ee 100644 --- a/jetty-aggregate/jetty-servlet/pom.xml +++ b/jetty-aggregate/jetty-servlet/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-servlet diff --git a/jetty-aggregate/jetty-webapp/pom.xml b/jetty-aggregate/jetty-webapp/pom.xml index 4eef2f2284f..47090b07d8f 100644 --- a/jetty-aggregate/jetty-webapp/pom.xml +++ b/jetty-aggregate/jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-webapp diff --git a/jetty-aggregate/jetty-websocket/pom.xml b/jetty-aggregate/jetty-websocket/pom.xml index 55f9991ac1d..c650ef55103 100644 --- a/jetty-aggregate/jetty-websocket/pom.xml +++ b/jetty-aggregate/jetty-websocket/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.aggregate jetty-aggregate-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-websocket diff --git a/jetty-aggregate/pom.xml b/jetty-aggregate/pom.xml index 59b959c1c82..7de1ac8d379 100644 --- a/jetty-aggregate/pom.xml +++ b/jetty-aggregate/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT org.eclipse.jetty.aggregate jetty-aggregate-project diff --git a/jetty-ajp/pom.xml b/jetty-ajp/pom.xml index 02328ee43f8..c02155bea81 100644 --- a/jetty-ajp/pom.xml +++ b/jetty-ajp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-ajp diff --git a/jetty-annotations/pom.xml b/jetty-annotations/pom.xml index 9eb9ef70c66..a4b6c219f44 100644 --- a/jetty-annotations/pom.xml +++ b/jetty-annotations/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-annotations diff --git a/jetty-client/pom.xml b/jetty-client/pom.xml index 7593a5a1e34..02a0320bdd9 100644 --- a/jetty-client/pom.xml +++ b/jetty-client/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 diff --git a/jetty-continuation/pom.xml b/jetty-continuation/pom.xml index df1c6cb5a58..6c4c47b893a 100644 --- a/jetty-continuation/pom.xml +++ b/jetty-continuation/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-continuation diff --git a/jetty-deploy/pom.xml b/jetty-deploy/pom.xml index 4dddd4e102b..528e7ce46c0 100644 --- a/jetty-deploy/pom.xml +++ b/jetty-deploy/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-deploy diff --git a/jetty-distribution/pom.xml b/jetty-distribution/pom.xml index a29ec58fedc..173d546d426 100644 --- a/jetty-distribution/pom.xml +++ b/jetty-distribution/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT jetty-distribution Jetty :: Distribution Assemblies diff --git a/jetty-http-spi/pom.xml b/jetty-http-spi/pom.xml index 8234a14d5f8..856673b86eb 100644 --- a/jetty-http-spi/pom.xml +++ b/jetty-http-spi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-http-spi diff --git a/jetty-http/pom.xml b/jetty-http/pom.xml index 17496bc94b2..53d5c6e9641 100644 --- a/jetty-http/pom.xml +++ b/jetty-http/pom.xml @@ -2,7 +2,7 @@ jetty-project org.eclipse.jetty - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 org.eclipse.jetty diff --git a/jetty-io/pom.xml b/jetty-io/pom.xml index 2acc47bd96b..8a5f69852a6 100644 --- a/jetty-io/pom.xml +++ b/jetty-io/pom.xml @@ -2,7 +2,7 @@ jetty-project org.eclipse.jetty - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 org.eclipse.jetty diff --git a/jetty-jaspi/pom.xml b/jetty-jaspi/pom.xml index 2fceec06534..f06938ce0f8 100644 --- a/jetty-jaspi/pom.xml +++ b/jetty-jaspi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-jaspi diff --git a/jetty-jmx/pom.xml b/jetty-jmx/pom.xml index 60fb9b6ce59..4b9a0dc2a9d 100644 --- a/jetty-jmx/pom.xml +++ b/jetty-jmx/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-jmx diff --git a/jetty-jndi/pom.xml b/jetty-jndi/pom.xml index a4526e33694..5eaf6fef291 100644 --- a/jetty-jndi/pom.xml +++ b/jetty-jndi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-jndi diff --git a/jetty-monitor/pom.xml b/jetty-monitor/pom.xml index ed3a957ada2..bfff477df54 100644 --- a/jetty-monitor/pom.xml +++ b/jetty-monitor/pom.xml @@ -19,7 +19,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-monitor diff --git a/jetty-nested/pom.xml b/jetty-nested/pom.xml index f60b6caad00..40da79b3cfe 100644 --- a/jetty-nested/pom.xml +++ b/jetty-nested/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT jetty-nested Jetty :: Nested diff --git a/jetty-nosql/pom.xml b/jetty-nosql/pom.xml index 06d909fe6c6..75b77f019a9 100644 --- a/jetty-nosql/pom.xml +++ b/jetty-nosql/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-nosql diff --git a/jetty-osgi/jetty-osgi-boot-jsp/pom.xml b/jetty-osgi/jetty-osgi-boot-jsp/pom.xml index c24780b5bee..76e530cde78 100644 --- a/jetty-osgi/jetty-osgi-boot-jsp/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-jsp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot-logback/pom.xml b/jetty-osgi/jetty-osgi-boot-logback/pom.xml index 216a0c9852c..595e77a4b24 100644 --- a/jetty-osgi/jetty-osgi-boot-logback/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-logback/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot-warurl/pom.xml b/jetty-osgi/jetty-osgi-boot-warurl/pom.xml index ac2daad4649..a0463cc5643 100644 --- a/jetty-osgi/jetty-osgi-boot-warurl/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-warurl/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-boot/pom.xml b/jetty-osgi/jetty-osgi-boot/pom.xml index 6eb494efcc0..87a7087125d 100644 --- a/jetty-osgi/jetty-osgi-boot/pom.xml +++ b/jetty-osgi/jetty-osgi-boot/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-equinoxtools/pom.xml b/jetty-osgi/jetty-osgi-equinoxtools/pom.xml index e39ecae8b7c..fbb16968697 100644 --- a/jetty-osgi/jetty-osgi-equinoxtools/pom.xml +++ b/jetty-osgi/jetty-osgi-equinoxtools/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/jetty-osgi-httpservice/pom.xml b/jetty-osgi/jetty-osgi-httpservice/pom.xml index 098cbee1234..e389254295d 100644 --- a/jetty-osgi/jetty-osgi-httpservice/pom.xml +++ b/jetty-osgi/jetty-osgi-httpservice/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-osgi/pom.xml b/jetty-osgi/pom.xml index 1b6e19ca932..ae30fdd313e 100644 --- a/jetty-osgi/pom.xml +++ b/jetty-osgi/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT ../pom.xml org.eclipse.jetty.osgi diff --git a/jetty-osgi/test-jetty-osgi/pom.xml b/jetty-osgi/test-jetty-osgi/pom.xml index 4981ca2f40e..f0ae38a1230 100644 --- a/jetty-osgi/test-jetty-osgi/pom.xml +++ b/jetty-osgi/test-jetty-osgi/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty.osgi jetty-osgi-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/jetty-overlay-deployer/pom.xml b/jetty-overlay-deployer/pom.xml index 59516ca7399..75b8349308e 100644 --- a/jetty-overlay-deployer/pom.xml +++ b/jetty-overlay-deployer/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-overlay-deployer diff --git a/jetty-plus/pom.xml b/jetty-plus/pom.xml index 608ca3c2abc..391eb9691c7 100644 --- a/jetty-plus/pom.xml +++ b/jetty-plus/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-plus diff --git a/jetty-policy/pom.xml b/jetty-policy/pom.xml index 8281dd66789..64548024678 100644 --- a/jetty-policy/pom.xml +++ b/jetty-policy/pom.xml @@ -3,7 +3,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT org.eclipse.jetty jetty-policy diff --git a/jetty-rewrite/pom.xml b/jetty-rewrite/pom.xml index c245d1f176c..cdfe6d1c5b0 100644 --- a/jetty-rewrite/pom.xml +++ b/jetty-rewrite/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-rewrite diff --git a/jetty-security/pom.xml b/jetty-security/pom.xml index 97ddadab69a..397991f6299 100644 --- a/jetty-security/pom.xml +++ b/jetty-security/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-security diff --git a/jetty-server/pom.xml b/jetty-server/pom.xml index de1d69a0794..8e71f15966d 100644 --- a/jetty-server/pom.xml +++ b/jetty-server/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-server diff --git a/jetty-servlet/pom.xml b/jetty-servlet/pom.xml index 7e58d15ef31..70ab5daf8a3 100644 --- a/jetty-servlet/pom.xml +++ b/jetty-servlet/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-servlet diff --git a/jetty-servlets/pom.xml b/jetty-servlets/pom.xml index 95e7262559c..9e112abff9e 100644 --- a/jetty-servlets/pom.xml +++ b/jetty-servlets/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-servlets diff --git a/jetty-start/pom.xml b/jetty-start/pom.xml index c113d9ddbec..9fcfa2c2cc8 100644 --- a/jetty-start/pom.xml +++ b/jetty-start/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-start diff --git a/jetty-util/pom.xml b/jetty-util/pom.xml index 021e7382130..9e5dc45445a 100644 --- a/jetty-util/pom.xml +++ b/jetty-util/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-util diff --git a/jetty-webapp/pom.xml b/jetty-webapp/pom.xml index e0add50cedf..eb1971c5043 100644 --- a/jetty-webapp/pom.xml +++ b/jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-webapp diff --git a/jetty-websocket/pom.xml b/jetty-websocket/pom.xml index 8c115c24a53..cfb4b91e581 100644 --- a/jetty-websocket/pom.xml +++ b/jetty-websocket/pom.xml @@ -3,7 +3,7 @@ jetty-project org.eclipse.jetty - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 diff --git a/jetty-xml/pom.xml b/jetty-xml/pom.xml index 4e5e019e493..b2a39954309 100644 --- a/jetty-xml/pom.xml +++ b/jetty-xml/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 jetty-xml diff --git a/pom.xml b/pom.xml index d7d88cc7780..63315d4c21c 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ 19 jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT Jetty :: Project ${jetty.url} pom diff --git a/test-continuation/pom.xml b/test-continuation/pom.xml index a863188bb1c..498bf751457 100644 --- a/test-continuation/pom.xml +++ b/test-continuation/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 test-continuation diff --git a/test-jetty-nested/pom.xml b/test-jetty-nested/pom.xml index d2a93c99496..2f5b334f991 100644 --- a/test-jetty-nested/pom.xml +++ b/test-jetty-nested/pom.xml @@ -4,7 +4,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT test-jetty-nested Jetty :: Nested Test diff --git a/test-jetty-servlet/pom.xml b/test-jetty-servlet/pom.xml index bad4d38e7ff..65f98aa0f62 100644 --- a/test-jetty-servlet/pom.xml +++ b/test-jetty-servlet/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 test-jetty-servlet diff --git a/test-jetty-webapp/pom.xml b/test-jetty-webapp/pom.xml index 542c82afaf8..5c9fbf6c19b 100644 --- a/test-jetty-webapp/pom.xml +++ b/test-jetty-webapp/pom.xml @@ -2,7 +2,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 org.eclipse.jetty diff --git a/tests/pom.xml b/tests/pom.xml index 2e6dc08761e..28cee13d78b 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty jetty-project - 7.6.0.RC3 + 7.6.0-SNAPSHOT org.eclipse.jetty.tests tests-parent diff --git a/tests/test-integration/pom.xml b/tests/test-integration/pom.xml index 9a6d5636dee..bf1daf62b96 100644 --- a/tests/test-integration/pom.xml +++ b/tests/test-integration/pom.xml @@ -20,7 +20,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.0.RC3 + 7.6.0-SNAPSHOT 4.0.0 test-integration diff --git a/tests/test-loginservice/pom.xml b/tests/test-loginservice/pom.xml index 8519a127617..a5e08c91017 100644 --- a/tests/test-loginservice/pom.xml +++ b/tests/test-loginservice/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.0.RC3 + 7.6.0-SNAPSHOT test-loginservice Jetty Tests :: Login Service diff --git a/tests/test-sessions/pom.xml b/tests/test-sessions/pom.xml index 80a21e7dfa6..8c829fa6935 100644 --- a/tests/test-sessions/pom.xml +++ b/tests/test-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.0.RC3 + 7.6.0-SNAPSHOT test-sessions-parent Jetty Tests :: Sessions :: Parent diff --git a/tests/test-sessions/test-hash-sessions/pom.xml b/tests/test-sessions/test-hash-sessions/pom.xml index 8903cb3c52b..1152f8a40e2 100644 --- a/tests/test-sessions/test-hash-sessions/pom.xml +++ b/tests/test-sessions/test-hash-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.0.RC3 + 7.6.0-SNAPSHOT test-hash-sessions Jetty Tests :: Sessions :: Hash diff --git a/tests/test-sessions/test-jdbc-sessions/pom.xml b/tests/test-sessions/test-jdbc-sessions/pom.xml index e1ed5aaf848..567cfad6daa 100644 --- a/tests/test-sessions/test-jdbc-sessions/pom.xml +++ b/tests/test-sessions/test-jdbc-sessions/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.0.RC3 + 7.6.0-SNAPSHOT test-jdbc-sessions Jetty Tests :: Sessions :: JDBC diff --git a/tests/test-sessions/test-sessions-common/pom.xml b/tests/test-sessions/test-sessions-common/pom.xml index 2c59d59b2cf..2979f679288 100644 --- a/tests/test-sessions/test-sessions-common/pom.xml +++ b/tests/test-sessions/test-sessions-common/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-sessions-parent - 7.6.0.RC3 + 7.6.0-SNAPSHOT test-sessions-common Jetty Tests :: Sessions :: Common diff --git a/tests/test-webapps/pom.xml b/tests/test-webapps/pom.xml index 00a3b0cbcfd..c34dda4cdc9 100644 --- a/tests/test-webapps/pom.xml +++ b/tests/test-webapps/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests tests-parent - 7.6.0.RC3 + 7.6.0-SNAPSHOT test-webapps-parent Jetty Tests :: WebApps :: Parent diff --git a/tests/test-webapps/test-webapp-rfc2616/pom.xml b/tests/test-webapps/test-webapp-rfc2616/pom.xml index 3a46350b438..fcc140014f9 100644 --- a/tests/test-webapps/test-webapp-rfc2616/pom.xml +++ b/tests/test-webapps/test-webapp-rfc2616/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jetty.tests test-webapps-parent - 7.6.0.RC3 + 7.6.0-SNAPSHOT test-webapp-rfc2616 Jetty Tests :: WebApp :: RFC2616 From 505a76df059a638334bf94eab7b3f734352ee943 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Thu, 5 Jan 2012 10:54:42 -0700 Subject: [PATCH 14/34] Updating VERSION.txt top section --- VERSION.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/VERSION.txt b/VERSION.txt index fc47f1ba50c..c2b8cbdd157 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1,3 +1,5 @@ +jetty-7.6.0-SNAPSHOT + jetty-7.6.0.RC3 - 05 January 2012 + 367433 added tests to investigate + 367435 improved D00 test harness From e666ed67cbdc41c9700ea729eecbddb3771f60f1 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Fri, 6 Jan 2012 15:41:55 +0100 Subject: [PATCH 15/34] 368035 - WebSocketClientFactory does not invoke super.doStop(). --- .../java/org/eclipse/jetty/websocket/WebSocketClientFactory.java | 1 + 1 file changed, 1 insertion(+) diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java index 4b250ab1b2d..92407cd2eab 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java @@ -208,6 +208,7 @@ public class WebSocketClientFactory extends AggregateLifeCycle protected void doStop() throws Exception { closeConnections(); + super.doStop(); } /* ------------------------------------------------------------ */ From 5e181308540fe80879392cab7fa51341db511b34 Mon Sep 17 00:00:00 2001 From: Thomas Becker Date: Mon, 12 Dec 2011 10:32:23 +0100 Subject: [PATCH 16/34] 365411: Removed static logger from ProxyServlet Signed-off-by: Simone Bordet --- .../java/org/eclipse/jetty/servlets/ProxyServlet.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java index 2b186b49677..784710db93a 100644 --- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java +++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java @@ -84,8 +84,6 @@ import org.eclipse.jetty.util.thread.QueuedThreadPool; */ public class ProxyServlet implements Servlet { - private static final Logger LOG = Log.getLogger(ProxyServlet.class); - protected Logger _log; protected HttpClient _client; protected String _hostHeader; @@ -497,7 +495,7 @@ public class ProxyServlet implements Servlet { if (ex instanceof EofException) { - LOG.ignore(ex); + _log.ignore(ex); return; } handleOnException(ex,request,response); @@ -732,8 +730,8 @@ public class ProxyServlet implements Servlet */ protected void handleOnException(Throwable ex, HttpServletRequest request, HttpServletResponse response) { - LOG.warn(ex.toString()); - LOG.debug(ex); + _log.warn(ex.toString()); + _log.debug(ex); if (!response.isCommitted()) { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); From 9e4fd4d3856b00ab387d08e2c1e40ad88b7a6d11 Mon Sep 17 00:00:00 2001 From: Thomas Becker Date: Thu, 5 Jan 2012 19:43:07 +0100 Subject: [PATCH 17/34] 365411: removed trailing whitespaces in ProxyServlet Signed-off-by: Simone Bordet --- .../eclipse/jetty/servlets/ProxyServlet.java | 134 ++++++++++-------- 1 file changed, 72 insertions(+), 62 deletions(-) diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java index 784710db93a..48bfcf391c0 100644 --- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java +++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/ProxyServlet.java @@ -57,7 +57,7 @@ import org.eclipse.jetty.util.thread.QueuedThreadPool; /** * Asynchronous Proxy Servlet. - * + * * Forward requests to another server either as a standard web proxy (as defined by RFC2616) or as a transparent proxy. *

* This servlet needs the jetty-util and jetty-client classes to be available to the web application. @@ -75,11 +75,11 @@ import org.eclipse.jetty.util.thread.QueuedThreadPool; *

  • requestBufferSize - the size of the request buffer (d. 12,288) *
  • responseHeaderSize - the size of the response header buffer (d. 6,144) *
  • responseBufferSize - the size of the response buffer (d. 32,768) - *
  • HostHeader - Force the host header to a particular value + *
  • HostHeader - Force the host header to a particular value *
  • whiteList - comma-separated list of allowed proxy destinations *
  • blackList - comma-separated list of forbidden proxy destinations * - * + * * @see org.eclipse.jetty.server.handler.ConnectHandler */ public class ProxyServlet implements Servlet @@ -109,22 +109,22 @@ public class ProxyServlet implements Servlet /* ------------------------------------------------------------ */ /* * (non-Javadoc) - * + * * @see javax.servlet.Servlet#init(javax.servlet.ServletConfig) */ public void init(ServletConfig config) throws ServletException { _config = config; _context = config.getServletContext(); - + _hostHeader = config.getInitParameter("HostHeader"); try { - _log = createLogger(config); + _log = createLogger(config); _client = createHttpClient(config); - + if (_context != null) { _context.setAttribute(config.getServletName() + ".Logger",_log); @@ -160,12 +160,12 @@ public class ProxyServlet implements Servlet _log.debug(x); } } - - + + /** - * Create and return a logger based on the ServletConfig for use in the + * Create and return a logger based on the ServletConfig for use in the * proxy servlet - * + * * @param config * @return Logger */ @@ -173,24 +173,24 @@ public class ProxyServlet implements Servlet { return Log.getLogger("org.eclipse.jetty.servlets." + config.getServletName()); } - + /** * Create and return an HttpClient based on ServletConfig - * - * By default this implementation will create an instance of the + * + * By default this implementation will create an instance of the * HttpClient for use by this proxy servlet. - * - * @param config - * @return HttpClient + * + * @param config + * @return HttpClient * @throws Exception */ protected HttpClient createHttpClient(ServletConfig config) throws Exception { HttpClient client = new HttpClient(); client.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL); - + String t = config.getInitParameter("maxThreads"); - + if (t != null) { client.setThreadPool(new QueuedThreadPool(Integer.parseInt(t))); @@ -199,67 +199,67 @@ public class ProxyServlet implements Servlet { client.setThreadPool(new QueuedThreadPool()); } - - ((QueuedThreadPool)client.getThreadPool()).setName(config.getServletName()); + + ((QueuedThreadPool)client.getThreadPool()).setName(config.getServletName()); t = config.getInitParameter("maxConnections"); - + if (t != null) { client.setMaxConnectionsPerAddress(Integer.parseInt(t)); } - + t = config.getInitParameter("timeout"); - + if ( t != null ) { client.setTimeout(Long.parseLong(t)); } - + t = config.getInitParameter("idleTimeout"); - + if ( t != null ) { client.setIdleTimeout(Long.parseLong(t)); } - + t = config.getInitParameter("requestHeaderSize"); - + if ( t != null ) { client.setRequestHeaderSize(Integer.parseInt(t)); } - + t = config.getInitParameter("requestBufferSize"); - + if ( t != null ) { client.setRequestBufferSize(Integer.parseInt(t)); } - + t = config.getInitParameter("responseHeaderSize"); - + if ( t != null ) { client.setResponseHeaderSize(Integer.parseInt(t)); } - + t = config.getInitParameter("responseBufferSize"); - + if ( t != null ) { client.setResponseBufferSize(Integer.parseInt(t)); } - + client.start(); - + return client; } - + /* ------------------------------------------------------------ */ /** * Helper function to process a parameter value containing a list of new entries and initialize the specified host map. - * + * * @param list * comma-separated list of new entries * @param hostMap @@ -299,7 +299,7 @@ public class ProxyServlet implements Servlet /* ------------------------------------------------------------ */ /** * Check the request hostname and path against white- and blacklist. - * + * * @param host * hostname to check * @param path @@ -351,7 +351,7 @@ public class ProxyServlet implements Servlet /* ------------------------------------------------------------ */ /* * (non-Javadoc) - * + * * @see javax.servlet.Servlet#getServletConfig() */ public ServletConfig getServletConfig() @@ -362,7 +362,7 @@ public class ProxyServlet implements Servlet /* ------------------------------------------------------------ */ /** * Get the hostHeader. - * + * * @return the hostHeader */ public String getHostHeader() @@ -373,7 +373,7 @@ public class ProxyServlet implements Servlet /* ------------------------------------------------------------ */ /** * Set the hostHeader. - * + * * @param hostHeader * the hostHeader to set */ @@ -385,7 +385,7 @@ public class ProxyServlet implements Servlet /* ------------------------------------------------------------ */ /* * (non-Javadoc) - * + * * @see javax.servlet.Servlet#service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) */ public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException @@ -410,7 +410,7 @@ public class ProxyServlet implements Servlet response.sendError(HttpServletResponse.SC_GATEWAY_TIMEOUT); // Need better test that isInitial else { - + String uri = request.getRequestURI(); if (request.getQueryString() != null) uri += "?" + request.getQueryString(); @@ -428,14 +428,17 @@ public class ProxyServlet implements Servlet HttpExchange exchange = new HttpExchange() { + @Override protected void onRequestCommitted() throws IOException { } + @Override protected void onRequestComplete() throws IOException { } + @Override protected void onResponseComplete() throws IOException { if (debug != 0) @@ -443,6 +446,7 @@ public class ProxyServlet implements Servlet continuation.complete(); } + @Override protected void onResponseContent(Buffer content) throws IOException { if (debug != 0) @@ -450,10 +454,12 @@ public class ProxyServlet implements Servlet content.writeTo(out); } + @Override protected void onResponseHeaderComplete() throws IOException { } + @Override protected void onResponseStatus(Buffer version, int status, Buffer reason) throws IOException { if (debug != 0) @@ -465,6 +471,7 @@ public class ProxyServlet implements Servlet response.setStatus(status); } + @Override protected void onResponseHeader(Buffer name, Buffer value) throws IOException { String s = name.toString().toLowerCase(); @@ -479,11 +486,12 @@ public class ProxyServlet implements Servlet _log.debug(debug + " " + name + "! " + value); } + @Override protected void onConnectionFailed(Throwable ex) { handleOnConnectionFailed(ex,request,response); - - // it is possible this might trigger before the + + // it is possible this might trigger before the // continuation.suspend() if (!continuation.isInitial()) { @@ -491,6 +499,7 @@ public class ProxyServlet implements Servlet } } + @Override protected void onException(Throwable ex) { if (ex instanceof EofException) @@ -499,8 +508,8 @@ public class ProxyServlet implements Servlet return; } handleOnException(ex,request,response); - - // it is possible this might trigger before the + + // it is possible this might trigger before the // continuation.suspend() if (!continuation.isInitial()) { @@ -508,6 +517,7 @@ public class ProxyServlet implements Servlet } } + @Override protected void onExpire() { handleOnExpire(request,response); @@ -595,14 +605,14 @@ public class ProxyServlet implements Servlet if (hasContent) exchange.setRequestContentSource(in); - customizeExchange(exchange, request); - + customizeExchange(exchange, request); + /* * we need to set the timeout on the continuation to take into * account the timeout of the HttpClient and the HttpExchange */ long ctimeout = (_client.getTimeout() > exchange.getTimeout()) ? _client.getTimeout() : exchange.getTimeout(); - + // continuation fudge factor of 1000, underlying components // should fail/expire first from exchange if ( ctimeout == 0 ) @@ -610,12 +620,12 @@ public class ProxyServlet implements Servlet continuation.setTimeout(0); // ideally never times out } else - { + { continuation.setTimeout(ctimeout + 1000); } - + customizeContinuation(continuation); - + continuation.suspend(response); _client.send(exchange); @@ -676,7 +686,7 @@ public class ProxyServlet implements Servlet /* * (non-Javadoc) - * + * * @see javax.servlet.Servlet#getServletInfo() */ public String getServletInfo() @@ -687,7 +697,7 @@ public class ProxyServlet implements Servlet /** * Extension point for subclasses to customize an exchange. Useful for setting timeouts etc. The default implementation does nothing. - * + * * @param exchange * @param request */ @@ -699,7 +709,7 @@ public class ProxyServlet implements Servlet /** * Extension point for subclasses to customize the Continuation after it's initial creation in the service method. Useful for setting timeouts etc. The * default implementation does nothing. - * + * * @param continuation */ protected void customizeContinuation(Continuation continuation) @@ -710,7 +720,7 @@ public class ProxyServlet implements Servlet /** * Extension point for custom handling of an HttpExchange's onConnectionFailed method. The default implementation delegates to * {@link #handleOnException(Throwable, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)} - * + * * @param ex * @param request * @param response @@ -723,7 +733,7 @@ public class ProxyServlet implements Servlet /** * Extension point for custom handling of an HttpExchange's onException method. The default implementation sets the response status to * HttpServletResponse.SC_INTERNAL_SERVER_ERROR (503) - * + * * @param ex * @param request * @param response @@ -741,7 +751,7 @@ public class ProxyServlet implements Servlet /** * Extension point for custom handling of an HttpExchange's onExpire method. The default implementation sets the response status to * HttpServletResponse.SC_GATEWAY_TIMEOUT (504) - * + * * @param request * @param response */ @@ -755,7 +765,7 @@ public class ProxyServlet implements Servlet /** * Transparent Proxy. - * + * * This convenience extension to ProxyServlet configures the servlet as a transparent proxy. The servlet is configured with init parameters: *
      *
    • ProxyTo - a URI like http://host:80/context to which the request is proxied. @@ -763,7 +773,7 @@ public class ProxyServlet implements Servlet *
    * For example, if a request was received at /foo/bar and the ProxyTo was http://host:80/context and the Prefix was /foo, then the request would be proxied * to http://host:80/context/bar - * + * */ public static class Transparent extends ProxyServlet { From 2fa5a63f3c50ce1295477d226af59c025da47ccb Mon Sep 17 00:00:00 2001 From: Thomas Becker Date: Thu, 5 Jan 2012 17:41:09 +0100 Subject: [PATCH 18/34] 365048: Fix proxy issue. http-client dropped authentication header on connect requests before Signed-off-by: Simone Bordet --- .../jetty/client/AbstractHttpConnection.java | 28 +++-- .../client/HttpsProxyAuthenticationTest.java | 116 ++++++++++++++++++ 2 files changed, 131 insertions(+), 13 deletions(-) create mode 100644 jetty-client/src/test/java/org/eclipse/jetty/client/HttpsProxyAuthenticationTest.java diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractHttpConnection.java b/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractHttpConnection.java index a032b38b17b..4f736343cd8 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractHttpConnection.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractHttpConnection.java @@ -180,20 +180,22 @@ public abstract class AbstractHttpConnection extends AbstractConnection implemen String method=_exchange.getMethod(); String uri = _exchange.getRequestURI(); - if (_destination.isProxied() && !HttpMethods.CONNECT.equals(method) && uri.startsWith("/")) + if (_destination.isProxied()) { - boolean secure = _destination.isSecure(); - String host = _destination.getAddress().getHost(); - int port = _destination.getAddress().getPort(); - StringBuilder absoluteURI = new StringBuilder(); - absoluteURI.append(secure ? HttpSchemes.HTTPS : HttpSchemes.HTTP); - absoluteURI.append("://"); - absoluteURI.append(host); - // Avoid adding default ports - if (!(secure && port == 443 || !secure && port == 80)) - absoluteURI.append(":").append(port); - absoluteURI.append(uri); - uri = absoluteURI.toString(); + if(!HttpMethods.CONNECT.equals(method) && uri.startsWith("/")){ + boolean secure = _destination.isSecure(); + String host = _destination.getAddress().getHost(); + int port = _destination.getAddress().getPort(); + StringBuilder absoluteURI = new StringBuilder(); + absoluteURI.append(secure ? HttpSchemes.HTTPS : HttpSchemes.HTTP); + absoluteURI.append("://"); + absoluteURI.append(host); + // Avoid adding default ports + if (!(secure && port == 443 || !secure && port == 80)) + absoluteURI.append(":").append(port); + absoluteURI.append(uri); + uri = absoluteURI.toString(); + } Authentication auth = _destination.getProxyAuthentication(); if (auth != null) auth.setCredentials(_exchange); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpsProxyAuthenticationTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpsProxyAuthenticationTest.java new file mode 100644 index 00000000000..4b28b88b673 --- /dev/null +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpsProxyAuthenticationTest.java @@ -0,0 +1,116 @@ +// ======================================================================== +// Copyright (c) 2009-2009 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== + +package org.eclipse.jetty.client; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.eclipse.jetty.client.security.Authentication; +import org.eclipse.jetty.client.security.BasicAuthentication; +import org.eclipse.jetty.client.security.Realm; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.handler.ConnectHandler; +import org.eclipse.jetty.server.nio.SelectChannelConnector; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/* ------------------------------------------------------------ */ +/** + * This UnitTest class executes two tests. Both will send a http request to https://google.com through a misbehaving proxy server. + *

    + * The first test runs against a proxy which simply closes the connection (as nginx does) for a connect request. The second proxy server always responds with a + * 500 error. + *

    + * The expected result for both tests is an exception and the HttpExchange should have status HttpExchange.STATUS_EXCEPTED. + */ +public class HttpsProxyAuthenticationTest +{ + private Server _proxy = new Server(); + private HttpClient _client = new HttpClient(); + private boolean authHandlerSend; + + @Before + public void init() throws Exception + { + // setup proxies with different behaviour + _proxy.addConnector(new SelectChannelConnector()); + _proxy.setHandler(new ConnectHandler() + { + @Override + protected boolean handleAuthentication(HttpServletRequest request, HttpServletResponse response, String address) throws ServletException, + IOException + { + if(!request.getHeader("Authorization").isEmpty()){ + authHandlerSend = true; + } + return super.handleAuthentication(request,response,address); + } + }); + _proxy.start(); + int proxyPort = _proxy.getConnectors()[0].getLocalPort(); + + Authentication authentication = new BasicAuthentication(new Realm() + { + public String getId() + { + return "MyRealm"; + } + + public String getPrincipal() + { + return "jetty"; + } + + public String getCredentials() + { + return "jetty"; + } + }); + + _client.setProxy(new Address("localhost",proxyPort)); + _client.setProxyAuthentication(authentication); + _client.start(); + } + + @After + public void destroy() throws Exception + { + _client.stop(); + _proxy.stop(); + } + + @Test + public void httpsViaProxyThatReturns504ErrorTest() throws Exception + { + sendRequestThroughProxy(new ContentExchange(),"google",7); + assertTrue("Authorization header not set!",authHandlerSend); + } + + private void sendRequestThroughProxy(HttpExchange exchange, String desiredBehaviour, int exptectedStatus) throws Exception + { + String url = "https://" + desiredBehaviour + ".com/"; + exchange.setURL(url); + exchange.addRequestHeader("behaviour",desiredBehaviour); + _client.send(exchange); + assertEquals(HttpExchange.toState(exptectedStatus) + " status awaited",exptectedStatus,exchange.waitForDone()); + } + +} From 69675d4d19ce61e18040abaf1ac107703eeff878 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Fri, 6 Jan 2012 16:19:05 +0100 Subject: [PATCH 19/34] 365048 - jetty Http client does not send proxy authentication when requesting a Https-resource through a web-proxy. --- .../jetty/client/AbstractHttpConnection.java | 5 +- .../client/HttpsProxyAuthenticationTest.java | 63 ++++++++++--------- 2 files changed, 35 insertions(+), 33 deletions(-) diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractHttpConnection.java b/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractHttpConnection.java index 4f736343cd8..51a4b53560c 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractHttpConnection.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractHttpConnection.java @@ -180,9 +180,10 @@ public abstract class AbstractHttpConnection extends AbstractConnection implemen String method=_exchange.getMethod(); String uri = _exchange.getRequestURI(); - if (_destination.isProxied()) + if (_destination.isProxied()) { - if(!HttpMethods.CONNECT.equals(method) && uri.startsWith("/")){ + if (!HttpMethods.CONNECT.equals(method) && uri.startsWith("/")) + { boolean secure = _destination.isSecure(); String host = _destination.getAddress().getHost(); int port = _destination.getAddress().getPort(); diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpsProxyAuthenticationTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpsProxyAuthenticationTest.java index 4b28b88b673..9076f054291 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpsProxyAuthenticationTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpsProxyAuthenticationTest.java @@ -13,11 +13,9 @@ package org.eclipse.jetty.client; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - import java.io.IOException; - +import java.net.InetSocketAddress; +import java.net.Socket; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -29,18 +27,11 @@ import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.handler.ConnectHandler; import org.eclipse.jetty.server.nio.SelectChannelConnector; import org.junit.After; +import org.junit.Assert; +import org.junit.Assume; import org.junit.Before; import org.junit.Test; -/* ------------------------------------------------------------ */ -/** - * This UnitTest class executes two tests. Both will send a http request to https://google.com through a misbehaving proxy server. - *

    - * The first test runs against a proxy which simply closes the connection (as nginx does) for a connect request. The second proxy server always responds with a - * 500 error. - *

    - * The expected result for both tests is an exception and the HttpExchange should have status HttpExchange.STATUS_EXCEPTED. - */ public class HttpsProxyAuthenticationTest { private Server _proxy = new Server(); @@ -50,22 +41,20 @@ public class HttpsProxyAuthenticationTest @Before public void init() throws Exception { - // setup proxies with different behaviour - _proxy.addConnector(new SelectChannelConnector()); + SelectChannelConnector connector = new SelectChannelConnector(); + _proxy.addConnector(connector); _proxy.setHandler(new ConnectHandler() { @Override - protected boolean handleAuthentication(HttpServletRequest request, HttpServletResponse response, String address) throws ServletException, - IOException + protected boolean handleAuthentication(HttpServletRequest request, HttpServletResponse response, String address) throws ServletException, IOException { - if(!request.getHeader("Authorization").isEmpty()){ + if (!request.getHeader("Authorization").isEmpty()) authHandlerSend = true; - } return super.handleAuthentication(request,response,address); } }); _proxy.start(); - int proxyPort = _proxy.getConnectors()[0].getLocalPort(); + int proxyPort = connector.getLocalPort(); Authentication authentication = new BasicAuthentication(new Realm() { @@ -85,7 +74,7 @@ public class HttpsProxyAuthenticationTest } }); - _client.setProxy(new Address("localhost",proxyPort)); + _client.setProxy(new Address("localhost", proxyPort)); _client.setProxyAuthentication(authentication); _client.start(); } @@ -95,22 +84,34 @@ public class HttpsProxyAuthenticationTest { _client.stop(); _proxy.stop(); + _proxy.join(); } @Test public void httpsViaProxyThatReturns504ErrorTest() throws Exception { - sendRequestThroughProxy(new ContentExchange(),"google",7); - assertTrue("Authorization header not set!",authHandlerSend); - } + // Assume that we can connect to google + String host = "google.com"; + int port = 443; + Socket socket = new Socket(); + try + { + socket.connect(new InetSocketAddress(host, port), 1000); + } + catch (IOException x) + { + Assume.assumeNoException(x); + } + finally + { + socket.close(); + } - private void sendRequestThroughProxy(HttpExchange exchange, String desiredBehaviour, int exptectedStatus) throws Exception - { - String url = "https://" + desiredBehaviour + ".com/"; - exchange.setURL(url); - exchange.addRequestHeader("behaviour",desiredBehaviour); + HttpExchange exchange = new ContentExchange(); + exchange.setURL("https://" + host + ":" + port); + exchange.addRequestHeader("behaviour", "google"); _client.send(exchange); - assertEquals(HttpExchange.toState(exptectedStatus) + " status awaited",exptectedStatus,exchange.waitForDone()); + Assert.assertEquals(HttpExchange.STATUS_COMPLETED, exchange.waitForDone()); + Assert.assertTrue("Authorization header not set!", authHandlerSend); } - } From 588b068c06235c23a391a7f17f8857eaccf09ba3 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Mon, 9 Jan 2012 08:53:19 +1100 Subject: [PATCH 20/34] replaced break in finally with progres=false --- .../java/org/eclipse/jetty/server/AsyncHttpConnection.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java b/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java index 031ad11e8d0..0f68b4ed6ba 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java @@ -126,10 +126,10 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async } else if (_request.getAsyncContinuation().isAsyncStarted()) { - // The request is suspended, so even though progress has been made, break the while loop + // The request is suspended, so even though progress has been made, + // exit the while loop by setting progress to false LOG.debug("suspended {}",this); - // TODO: breaking inside finally blocks is bad: rethink how we should exit from here - break; + progress=false; } } } From 90e9358ea5f62b78f1b11fe607b333b500373cb3 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Mon, 9 Jan 2012 11:16:30 +1100 Subject: [PATCH 21/34] 367716 simplified maxIdleTime logic --- .../main/java/org/eclipse/jetty/server/AsyncContinuation.java | 3 --- .../java/org/eclipse/jetty/server/AsyncHttpConnection.java | 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncContinuation.java b/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncContinuation.java index f9846745e69..9ed4119c936 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncContinuation.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncContinuation.java @@ -185,9 +185,6 @@ public class AsyncContinuation implements AsyncContext, Continuation } /* ------------------------------------------------------------ */ - /* (non-Javadoc) - * @see javax.servlet.ServletRequest#isSuspended() - */ public boolean isSuspending() { synchronized(this) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java b/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java index 0f68b4ed6ba..59e66626e69 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/AsyncHttpConnection.java @@ -146,7 +146,8 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async _generator.returnBuffers(); } - if (_request.getAsyncContinuation().isComplete() || _request.getAsyncContinuation().isInitial()) + // reenable idle checking unless request is suspended + if(!_request.getAsyncContinuation().isAsyncStarted()) { _asyncEndp.setCheckForIdle(true); } From 48438dc914631dbcbdead46ae3076e4d627ef0c0 Mon Sep 17 00:00:00 2001 From: Thomas Becker Date: Mon, 2 Jan 2012 17:50:57 +0100 Subject: [PATCH 22/34] 367635: Add test for parsing start.d files, small changes --- .../java/org/eclipse/jetty/start/Main.java | 45 ++++++++++--------- .../org/eclipse/jetty/start/usage.txt | 16 ++++--- .../org/eclipse/jetty/start/MainTest.java | 15 ++++--- 3 files changed, 43 insertions(+), 33 deletions(-) diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java index c42b93d7106..6275baab2d2 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java @@ -123,30 +123,35 @@ public class Main // if no non-option inis, add the start.ini and start.d if (!ini) { - List ini_args=new ArrayList(); - File start_ini = new File(_jettyHome,"start.ini"); - if (start_ini.exists()) - ini_args.addAll(loadStartIni(start_ini)); - - File start_d = new File(_jettyHome,"start.d"); - if (start_d.isDirectory()) - { - File[] inis = start_d.listFiles(new FilenameFilter() - { - public boolean accept(File dir, String name) - { - return name.toLowerCase().endsWith(".ini"); - } - }); - Arrays.sort(inis); - for (File i : inis) - ini_args.addAll(loadStartIni(i)); - } - arguments.addAll(0,ini_args); + arguments.addAll(0,parseStartIniFiles()); } return arguments; } + + List parseStartIniFiles() + { + List ini_args=new ArrayList(); + File start_ini = new File(_jettyHome,"start.ini"); + if (start_ini.exists()) + ini_args.addAll(loadStartIni(start_ini)); + + File start_d = new File(_jettyHome,"start.d"); + if (start_d.isDirectory()) + { + File[] inis = start_d.listFiles(new FilenameFilter() + { + public boolean accept(File dir, String name) + { + return name.toLowerCase().endsWith(".ini"); + } + }); + Arrays.sort(inis); + for (File i : inis) + ini_args.addAll(loadStartIni(i)); + } + return ini_args; + } public List processCommandLine(List arguments) throws Exception { diff --git a/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt b/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt index c4c85c4523d..41b0107580e 100644 --- a/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt +++ b/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt @@ -20,7 +20,7 @@ Command Line Options: when the start.ini includes -X or -D arguments. --exec Run the generated command line (see --dry-run) in - a sub processes. This can be used when start.ini + a sub process. This can be used when start.ini contains -X or -D arguments, but creates an extra JVM instance. @@ -36,8 +36,10 @@ Command Line Options: --ini= Load command line arguments from a file. If no --ini options are specified, then the - start.ini file will be read if it exists. - A --ini option with no file indicates that + start.ini file will be read if it exists in + jetty.home. If specified jetty.home/start.ini + and additional .ini files in jetty.home/start.d/ + will NOT be read. A --ini option with no file indicates that start.ini should not be read. --pre= Specify a configuration file that is to be processed @@ -116,10 +118,10 @@ Available Configurations: Defaults: A start.ini file may be used to specify default arguments to start.jar, which are used if no command line arguments are provided and override - the defaults in the start.config file. If the directory start.d exists, - then multiple *.ini files will be read from that directory in alphabetical - order. If --ini options are provided on the command line, then start.ini - and start.d will not be read. + the defaults in the start.config file. If the directory jetty.home/start.d + exists, then multiple *.ini files will be read from that directory in + alphabetical order. If --ini options are provided on the command line, + then start.ini and start.d will NOT be read. The current start.ini arguments are: diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/MainTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/MainTest.java index 246771b4da6..8e2f1f071bb 100644 --- a/jetty-start/src/test/java/org/eclipse/jetty/start/MainTest.java +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/MainTest.java @@ -15,7 +15,7 @@ package org.eclipse.jetty.start; import static org.junit.Assert.assertEquals; -import java.io.File; +import java.io.IOException; import java.net.URL; import java.util.List; @@ -39,15 +39,18 @@ public class MainTest /** * Test method for {@link org.eclipse.jetty.start.StartIniParser#loadStartIni(java.lang.String)}. + * @throws IOException */ @Test - public void testLoadStartIni() + public void testLoadStartIni() throws IOException { - URL startIni = this.getClass().getResource("/jetty.home/start.ini"); - String startIniFileName = startIni.getFile(); - List args = Main.loadStartIni(new File(startIniFileName)); - assertEquals("Expected 5 uncommented lines in start.ini",5,args.size()); + URL startIni = this.getClass().getResource("/jetty.home/"); + System.setProperty("jetty.home",startIni.getFile()); + Main main = new Main(); + List args = main.parseStartIniFiles(); + assertEquals("Expected 5 uncommented lines in start.ini",9,args.size()); assertEquals("First uncommented line in start.ini doesn't match expected result","OPTIONS=Server,jsp,resources,websocket,ext",args.get(0)); + assertEquals("Last uncommented line in start.ini doesn't match expected result","etc/jetty-testrealm.xml",args.get(8)); } @Test From 58c57a9ea0288acf80e52b85e35349811d88fb5a Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Mon, 9 Jan 2012 11:24:25 +1100 Subject: [PATCH 23/34] 367635: report errors --- jetty-start/src/main/java/org/eclipse/jetty/start/Main.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java index 6275baab2d2..69112f8f319 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java @@ -1080,7 +1080,7 @@ public class Main } catch (IOException e) { - // usageExit(e,ERR_UNKNOWN); + usageExit(e,ERR_UNKNOWN); } finally { From bbaef55bd61811c9adc4cb21d4c1b42a3c02e999 Mon Sep 17 00:00:00 2001 From: Thomas Becker Date: Fri, 6 Jan 2012 14:52:22 +0100 Subject: [PATCH 24/34] 366774: Request.java code format --- .../org/eclipse/jetty/server/Request.java | 1065 +++++++++-------- 1 file changed, 535 insertions(+), 530 deletions(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java index 4fc8c5934d5..7a54b62706d 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java @@ -4,11 +4,11 @@ // All rights reserved. This program and the accompanying materials // are made available under the terms of the Eclipse Public License v1.0 // and Apache License v2.0 which accompanies this distribution. -// The Eclipse Public License is available at +// The Eclipse Public License is available at // http://www.eclipse.org/legal/epl-v10.html // The Apache License v2.0 is available at // http://www.opensource.org/licenses/apache2.0.php -// You may elect to redistribute this code under either of these licenses. +// You may elect to redistribute this code under either of these licenses. // ======================================================================== package org.eclipse.jetty.server; @@ -72,62 +72,55 @@ import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; /* ------------------------------------------------------------ */ -/** Jetty Request. +/** + * Jetty Request. *

    * Implements {@link javax.servlet.http.HttpServletRequest} from the javax.servlet.http package. *

    *

    - * The standard interface of mostly getters, - * is extended with setters so that the request is mutable by the handlers that it is - * passed to. This allows the request object to be as lightweight as possible and not - * actually implement any significant behavior. For example

      - * - *
    • The {@link Request#getContextPath()} method will return null, until the request has been - * passed to a {@link ContextHandler} which matches the {@link Request#getPathInfo()} with a context - * path and calls {@link Request#setContextPath(String)} as a result.
    • - * - *
    • the HTTP session methods - * will all return null sessions until such time as a request has been passed to - * a {@link org.eclipse.jetty.server.session.SessionHandler} which checks for session cookies - * and enables the ability to create new sessions.
    • - * - *
    • The {@link Request#getServletPath()} method will return null until the request has been - * passed to a org.eclipse.jetty.servlet.ServletHandler and the pathInfo matched - * against the servlet URL patterns and {@link Request#setServletPath(String)} called as a result.
    • + * The standard interface of mostly getters, is extended with setters so that the request is mutable by the handlers that it is passed to. This allows the + * request object to be as lightweight as possible and not actually implement any significant behavior. For example + *
        + * + *
      • The {@link Request#getContextPath()} method will return null, until the request has been passed to a {@link ContextHandler} which matches the + * {@link Request#getPathInfo()} with a context path and calls {@link Request#setContextPath(String)} as a result.
      • + * + *
      • the HTTP session methods will all return null sessions until such time as a request has been passed to a + * {@link org.eclipse.jetty.server.session.SessionHandler} which checks for session cookies and enables the ability to create new sessions.
      • + * + *
      • The {@link Request#getServletPath()} method will return null until the request has been passed to a org.eclipse.jetty.servlet.ServletHandler + * and the pathInfo matched against the servlet URL patterns and {@link Request#setServletPath(String)} called as a result.
      • *
      - * - * A request instance is created for each {@link AbstractHttpConnection} accepted by the server - * and recycled for each HTTP request received via that connection. An effort is made - * to avoid reparsing headers and cookies that are likely to be the same for - * requests from the same connection. - * + * + * A request instance is created for each {@link AbstractHttpConnection} accepted by the server and recycled for each HTTP request received via that connection. + * An effort is made to avoid reparsing headers and cookies that are likely to be the same for requests from the same connection. + * *

      - * The form content that a request can process is limited to protect from Denial of Service - * attacks. The size in bytes is limited by {@link ContextHandler#getMaxFormContentSize()} or if there is no - * context then the "org.eclipse.jetty.server.Request.maxFormContentSize" {@link Server} attribute. - * The number of parameters keys is limited by {@link ContextHandler#getMaxFormKeys()} or if there is no - * context then the "org.eclipse.jetty.server.Request.maxFormKeys" {@link Server} attribute. - * - * + * The form content that a request can process is limited to protect from Denial of Service attacks. The size in bytes is limited by + * {@link ContextHandler#getMaxFormContentSize()} or if there is no context then the "org.eclipse.jetty.server.Request.maxFormContentSize" {@link Server} + * attribute. The number of parameters keys is limited by {@link ContextHandler#getMaxFormKeys()} or if there is no context then the + * "org.eclipse.jetty.server.Request.maxFormKeys" {@link Server} attribute. + * + * */ public class Request implements HttpServletRequest { private static final Logger LOG = Log.getLogger(Request.class); - private static final String __ASYNC_FWD="org.eclipse.asyncfwd"; + private static final String __ASYNC_FWD = "org.eclipse.asyncfwd"; private static final Collection __defaultLocale = Collections.singleton(Locale.getDefault()); - private static final int __NONE=0, _STREAM=1, __READER=2; + private static final int __NONE = 0, _STREAM = 1, __READER = 2; /* ------------------------------------------------------------ */ public static Request getRequest(HttpServletRequest request) { if (request instanceof Request) - return (Request) request; + return (Request)request; return AbstractHttpConnection.getCurrentConnection().getRequest(); } protected final AsyncContinuation _async = new AsyncContinuation(); - private boolean _asyncSupported=true; + private boolean _asyncSupported = true; private volatile Attributes _attributes; private Authentication _authentication; private MultiMap _baseParameters; @@ -137,18 +130,18 @@ public class Request implements HttpServletRequest private boolean _newContext; private String _contextPath; private CookieCutter _cookies; - private boolean _cookiesExtracted=false; + private boolean _cookiesExtracted = false; private DispatcherType _dispatcherType; - private boolean _dns=false; + private boolean _dns = false; private EndPoint _endp; - private boolean _handled =false; - private int _inputState=__NONE; + private boolean _handled = false; + private int _inputState = __NONE; private String _method; private MultiMap _parameters; private boolean _paramsExtracted; private String _pathInfo; private int _port; - private String _protocol=HttpVersions.HTTP_1_1; + private String _protocol = HttpVersions.HTTP_1_1; private String _queryEncoding; private String _queryString; private BufferedReader _reader; @@ -157,10 +150,10 @@ public class Request implements HttpServletRequest private String _remoteHost; private Object _requestAttributeListeners; private String _requestedSessionId; - private boolean _requestedSessionIdFromCookie=false; + private boolean _requestedSessionIdFromCookie = false; private String _requestURI; - private Map _savedNewSessions; - private String _scheme=URIUtil.HTTP; + private Map _savedNewSessions; + private String _scheme = URIUtil.HTTP; private UserIdentity.Scope _scope; private String _serverName; private String _servletPath; @@ -168,10 +161,10 @@ public class Request implements HttpServletRequest private SessionManager _sessionManager; private long _timeStamp; private long _dispatchTime; - + private Buffer _timeStampBuffer; private HttpURI _uri; - + /* ------------------------------------------------------------ */ public Request() { @@ -184,10 +177,10 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - public void addEventListener(final EventListener listener) + public void addEventListener(final EventListener listener) { if (listener instanceof ServletRequestAttributeListener) - _requestAttributeListeners= LazyList.add(_requestAttributeListeners, listener); + _requestAttributeListeners = LazyList.add(_requestAttributeListeners,listener); if (listener instanceof ContinuationListener) throw new IllegalArgumentException(); } @@ -198,13 +191,13 @@ public class Request implements HttpServletRequest */ public void extractParameters() { - if (_baseParameters == null) + if (_baseParameters == null) _baseParameters = new MultiMap(16); - if (_paramsExtracted) + if (_paramsExtracted) { - if (_parameters==null) - _parameters=_baseParameters; + if (_parameters == null) + _parameters = _baseParameters; return; } @@ -213,9 +206,9 @@ public class Request implements HttpServletRequest try { // Handle query string - if (_uri!=null && _uri.hasQuery()) + if (_uri != null && _uri.hasQuery()) { - if (_queryEncoding==null) + if (_queryEncoding == null) _uri.decodeQueryTo(_baseParameters); else { @@ -238,40 +231,41 @@ public class Request implements HttpServletRequest String content_type = getContentType(); if (content_type != null && content_type.length() > 0) { - content_type = HttpFields.valueParameters(content_type, null); - - if (MimeTypes.FORM_ENCODED.equalsIgnoreCase(content_type) && _inputState==__NONE && - (HttpMethods.POST.equals(getMethod()) || HttpMethods.PUT.equals(getMethod()))) + content_type = HttpFields.valueParameters(content_type,null); + + if (MimeTypes.FORM_ENCODED.equalsIgnoreCase(content_type) && _inputState == __NONE + && (HttpMethods.POST.equals(getMethod()) || HttpMethods.PUT.equals(getMethod()))) { int content_length = getContentLength(); if (content_length != 0) { try { - int maxFormContentSize=-1; - int maxFormKeys=-1; + int maxFormContentSize = -1; + int maxFormKeys = -1; - if (_context!=null) + if (_context != null) { - maxFormContentSize=_context.getContextHandler().getMaxFormContentSize(); - maxFormKeys=_context.getContextHandler().getMaxFormKeys(); + maxFormContentSize = _context.getContextHandler().getMaxFormContentSize(); + maxFormKeys = _context.getContextHandler().getMaxFormKeys(); } else { - Number size = (Number)_connection.getConnector().getServer().getAttribute("org.eclipse.jetty.server.Request.maxFormContentSize"); - maxFormContentSize=size==null?200000:size.intValue(); + Number size = (Number)_connection.getConnector().getServer() + .getAttribute("org.eclipse.jetty.server.Request.maxFormContentSize"); + maxFormContentSize = size == null?200000:size.intValue(); Number keys = (Number)_connection.getConnector().getServer().getAttribute("org.eclipse.jetty.server.Request.maxFormKeys"); - maxFormKeys =keys==null?1000:keys.intValue(); + maxFormKeys = keys == null?1000:keys.intValue(); } - - if (content_length>maxFormContentSize && maxFormContentSize > 0) + + if (content_length > maxFormContentSize && maxFormContentSize > 0) { - throw new IllegalStateException("Form too large"+content_length+">"+maxFormContentSize); + throw new IllegalStateException("Form too large" + content_length + ">" + maxFormContentSize); } InputStream in = getInputStream(); // Add form params to query params - UrlEncoded.decodeTo(in, _baseParameters, encoding,content_length<0?maxFormContentSize:-1,maxFormKeys); + UrlEncoded.decodeTo(in,_baseParameters,encoding,content_length < 0?maxFormContentSize:-1,maxFormKeys); } catch (IOException e) { @@ -284,31 +278,30 @@ public class Request implements HttpServletRequest } } - if (_parameters==null) - _parameters=_baseParameters; - else if (_parameters!=_baseParameters) + if (_parameters == null) + _parameters = _baseParameters; + else if (_parameters != _baseParameters) { // Merge parameters (needed if parameters extracted after a forward). Iterator iter = _baseParameters.entrySet().iterator(); while (iter.hasNext()) { Map.Entry entry = (Map.Entry)iter.next(); - String name=(String)entry.getKey(); - Object values=entry.getValue(); - for (int i=0;inull if {@link #setContext} has not yet - * been called. + * @return The current {@link Context context} used for this request, or null if {@link #setContext} has not yet been called. */ public Context getContext() { @@ -438,7 +432,7 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getContextPath() */ public String getContextPath() @@ -447,23 +441,23 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getCookies() */ public Cookie[] getCookies() { - if (_cookiesExtracted) - return _cookies==null?null:_cookies.getCookies(); + if (_cookiesExtracted) + return _cookies == null?null:_cookies.getCookies(); _cookiesExtracted = true; - + Enumeration enm = _connection.getRequestFields().getValues(HttpHeaders.COOKIE_BUFFER); - + // Handle no cookies - if (enm!=null) + if (enm != null) { - if (_cookies==null) - _cookies=new CookieCutter(); + if (_cookies == null) + _cookies = new CookieCutter(); while (enm.hasMoreElements()) { @@ -472,11 +466,11 @@ public class Request implements HttpServletRequest } } - return _cookies==null?null:_cookies.getCookies(); + return _cookies == null?null:_cookies.getCookies(); } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getDateHeader(java.lang.String) */ public long getDateHeader(String name) @@ -487,11 +481,11 @@ public class Request implements HttpServletRequest /* ------------------------------------------------------------ */ public DispatcherType getDispatcherType() { - return _dispatcherType; + return _dispatcherType; } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getHeader(java.lang.String) */ public String getHeader(String name) @@ -500,7 +494,7 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getHeaderNames() */ public Enumeration getHeaderNames() @@ -509,13 +503,13 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getHeaders(java.lang.String) */ public Enumeration getHeaders(String name) { Enumeration e = _connection.getRequestFields().getValues(name); - if (e==null) + if (e == null) return Collections.enumeration(Collections.EMPTY_LIST); return e; } @@ -530,19 +524,19 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getInputStream() */ public ServletInputStream getInputStream() throws IOException { - if (_inputState!=__NONE && _inputState!=_STREAM) + if (_inputState != __NONE && _inputState != _STREAM) throw new IllegalStateException("READER"); - _inputState=_STREAM; + _inputState = _STREAM; return _connection.getInputStream(); } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getIntHeader(java.lang.String) */ public int getIntHeader(String name) @@ -551,37 +545,37 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getLocalAddr() */ public String getLocalAddr() { - return _endp==null?null:_endp.getLocalAddr(); + return _endp == null?null:_endp.getLocalAddr(); } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getLocale() */ public Locale getLocale() { - Enumeration enm = _connection.getRequestFields().getValues(HttpHeaders.ACCEPT_LANGUAGE, HttpFields.__separators); - + Enumeration enm = _connection.getRequestFields().getValues(HttpHeaders.ACCEPT_LANGUAGE,HttpFields.__separators); + // handle no locale if (enm == null || !enm.hasMoreElements()) return Locale.getDefault(); - + // sort the list in quality order List acceptLanguage = HttpFields.qualityList(enm); - if (acceptLanguage.size()==0) - return Locale.getDefault(); - - int size=acceptLanguage.size(); + if (acceptLanguage.size() == 0) + return Locale.getDefault(); - if (size>0) + int size = acceptLanguage.size(); + + if (size > 0) { String language = (String)acceptLanguage.get(0); - language=HttpFields.valueParameters(language,null); + language = HttpFields.valueParameters(language,null); String country = ""; int dash = language.indexOf('-'); if (dash > -1) @@ -591,38 +585,37 @@ public class Request implements HttpServletRequest } return new Locale(language,country); } - - return Locale.getDefault(); + + return Locale.getDefault(); } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getLocales() */ public Enumeration getLocales() { - Enumeration enm = _connection.getRequestFields().getValues(HttpHeaders.ACCEPT_LANGUAGE, HttpFields.__separators); - + Enumeration enm = _connection.getRequestFields().getValues(HttpHeaders.ACCEPT_LANGUAGE,HttpFields.__separators); + // handle no locale if (enm == null || !enm.hasMoreElements()) return Collections.enumeration(__defaultLocale); - + // sort the list in quality order List acceptLanguage = HttpFields.qualityList(enm); - - if (acceptLanguage.size()==0) - return - Collections.enumeration(__defaultLocale); - + + if (acceptLanguage.size() == 0) + return Collections.enumeration(__defaultLocale); + Object langs = null; - int size=acceptLanguage.size(); - + int size = acceptLanguage.size(); + // convert to locals - for (int i=0; i -1) @@ -630,44 +623,44 @@ public class Request implements HttpServletRequest country = language.substring(dash + 1).trim(); language = language.substring(0,dash).trim(); } - langs=LazyList.ensureSize(langs,size); - langs=LazyList.add(langs,new Locale(language,country)); + langs = LazyList.ensureSize(langs,size); + langs = LazyList.add(langs,new Locale(language,country)); } - - if (LazyList.size(langs)==0) + + if (LazyList.size(langs) == 0) return Collections.enumeration(__defaultLocale); - + return Collections.enumeration(LazyList.getList(langs)); } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getLocalName() */ public String getLocalName() { - if (_endp==null) + if (_endp == null) return null; if (_dns) return _endp.getLocalHost(); - + String local = _endp.getLocalAddr(); - if (local!=null && local.indexOf(':')>=0) - local="["+local+"]"; + if (local != null && local.indexOf(':') >= 0) + local = "[" + local + "]"; return local; } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getLocalPort() */ public int getLocalPort() { - return _endp==null?0:_endp.getLocalPort(); + return _endp == null?0:_endp.getLocalPort(); } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getMethod() */ public String getMethod() @@ -676,35 +669,35 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getParameter(java.lang.String) */ public String getParameter(String name) { - if (!_paramsExtracted) + if (!_paramsExtracted) extractParameters(); - return (String) _parameters.getValue(name, 0); + return (String)_parameters.getValue(name,0); } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getParameterMap() */ public Map getParameterMap() { - if (!_paramsExtracted) + if (!_paramsExtracted) extractParameters(); - + return Collections.unmodifiableMap(_parameters.toStringArrayMap()); } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getParameterNames() */ public Enumeration getParameterNames() { - if (!_paramsExtracted) + if (!_paramsExtracted) extractParameters(); return Collections.enumeration(_parameters.keySet()); } @@ -719,21 +712,21 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getParameterValues(java.lang.String) */ public String[] getParameterValues(String name) { - if (!_paramsExtracted) + if (!_paramsExtracted) extractParameters(); List vals = _parameters.getValues(name); - if (vals==null) + if (vals == null) return null; - return (String[])vals.toArray(new String[vals.size()]); + return vals.toArray(new String[vals.size()]); } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getPathInfo() */ public String getPathInfo() @@ -742,18 +735,18 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getPathTranslated() */ public String getPathTranslated() { - if (_pathInfo==null || _context==null) + if (_pathInfo == null || _context == null) return null; return _context.getRealPath(_pathInfo); } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getProtocol() */ public String getProtocol() @@ -768,78 +761,78 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getQueryString() */ public String getQueryString() { - if (_queryString==null && _uri!=null) + if (_queryString == null && _uri != null) { - if (_queryEncoding==null) - _queryString=_uri.getQuery(); + if (_queryEncoding == null) + _queryString = _uri.getQuery(); else - _queryString=_uri.getQuery(_queryEncoding); + _queryString = _uri.getQuery(_queryEncoding); } return _queryString; } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getReader() */ public BufferedReader getReader() throws IOException { - if (_inputState!=__NONE && _inputState!=__READER) + if (_inputState != __NONE && _inputState != __READER) throw new IllegalStateException("STREAMED"); - if (_inputState==__READER) + if (_inputState == __READER) return _reader; - - String encoding=getCharacterEncoding(); - if (encoding==null) - encoding=StringUtil.__ISO_8859_1; - - if (_reader==null || !encoding.equalsIgnoreCase(_readerEncoding)) + + String encoding = getCharacterEncoding(); + if (encoding == null) + encoding = StringUtil.__ISO_8859_1; + + if (_reader == null || !encoding.equalsIgnoreCase(_readerEncoding)) { final ServletInputStream in = getInputStream(); - _readerEncoding=encoding; - _reader=new BufferedReader(new InputStreamReader(in,encoding)) + _readerEncoding = encoding; + _reader = new BufferedReader(new InputStreamReader(in,encoding)) { @Override public void close() throws IOException { in.close(); - } + } }; } - _inputState=__READER; + _inputState = __READER; return _reader; } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getRealPath(java.lang.String) */ public String getRealPath(String path) { - if (_context==null) + if (_context == null) return null; return _context.getRealPath(path); } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getRemoteAddr() */ public String getRemoteAddr() { if (_remoteAddr != null) - return _remoteAddr; - return _endp==null?null:_endp.getRemoteAddr(); + return _remoteAddr; + return _endp == null?null:_endp.getRemoteAddr(); } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getRemoteHost() */ public String getRemoteHost() @@ -850,58 +843,58 @@ public class Request implements HttpServletRequest { return _remoteHost; } - return _endp==null?null:_endp.getRemoteHost(); + return _endp == null?null:_endp.getRemoteHost(); } return getRemoteAddr(); } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getRemotePort() */ public int getRemotePort() { - return _endp==null?0:_endp.getRemotePort(); + return _endp == null?0:_endp.getRemotePort(); } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getRemoteUser() */ public String getRemoteUser() { Principal p = getUserPrincipal(); - if (p==null) + if (p == null) return null; return p.getName(); } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getRequestDispatcher(java.lang.String) */ public RequestDispatcher getRequestDispatcher(String path) { - if (path == null || _context==null) + if (path == null || _context == null) return null; // handle relative path if (!path.startsWith("/")) { - String relTo=URIUtil.addPaths(_servletPath,_pathInfo); - int slash=relTo.lastIndexOf("/"); - if (slash>1) - relTo=relTo.substring(0,slash+1); + String relTo = URIUtil.addPaths(_servletPath,_pathInfo); + int slash = relTo.lastIndexOf("/"); + if (slash > 1) + relTo = relTo.substring(0,slash + 1); else - relTo="/"; - path=URIUtil.addPaths(relTo,path); + relTo = "/"; + path = URIUtil.addPaths(relTo,path); } - + return _context.getRequestDispatcher(path); } - + /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getRequestedSessionId() */ public String getRequestedSessionId() @@ -910,18 +903,18 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getRequestURI() */ public String getRequestURI() { - if (_requestURI==null && _uri!=null) - _requestURI=_uri.getPathAndParam(); + if (_requestURI == null && _uri != null) + _requestURI = _uri.getPathAndParam(); return _requestURI; } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getRequestURL() */ public StringBuffer getRequestURL() @@ -935,14 +928,12 @@ public class Request implements HttpServletRequest url.append(scheme); url.append("://"); url.append(getServerName()); - if (_port>0 && - ((scheme.equalsIgnoreCase(URIUtil.HTTP) && port != 80) || - (scheme.equalsIgnoreCase(URIUtil.HTTPS) && port != 443))) + if (_port > 0 && ((scheme.equalsIgnoreCase(URIUtil.HTTP) && port != 80) || (scheme.equalsIgnoreCase(URIUtil.HTTPS) && port != 443))) { url.append(':'); url.append(_port); } - + url.append(getRequestURI()); return url; } @@ -953,17 +944,16 @@ public class Request implements HttpServletRequest { return _connection._response; } - + /* ------------------------------------------------------------ */ /** - * Reconstructs the URL the client used to make the request. The returned URL contains a - * protocol, server name, port number, and, but it does not include a path. + * Reconstructs the URL the client used to make the request. The returned URL contains a protocol, server name, port number, and, but it does not include a + * path. *

      - * Because this method returns a StringBuffer, not a string, you can modify the - * URL easily, for example, to append path and query parameters. - * + * Because this method returns a StringBuffer, not a string, you can modify the URL easily, for example, to append path and query parameters. + * * This method is useful for creating redirect messages and for reporting errors. - * + * * @return "scheme://host:port" */ public StringBuilder getRootURL() @@ -985,7 +975,7 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getScheme() */ public String getScheme() @@ -994,49 +984,48 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getServerName() */ public String getServerName() - { + { // Return already determined host - if (_serverName != null) + if (_serverName != null) return _serverName; - + if (_uri == null) throw new IllegalStateException("No uri"); // Return host from absolute URI _serverName = _uri.getHost(); _port = _uri.getPort(); - if (_serverName != null) + if (_serverName != null) return _serverName; // Return host from header field Buffer hostPort = _connection.getRequestFields().get(HttpHeaders.HOST_BUFFER); - if (hostPort!=null) + if (hostPort != null) { - loop: - for (int i=hostPort.putIndex();i-->hostPort.getIndex();) + loop: for (int i = hostPort.putIndex(); i-- > hostPort.getIndex();) { - char ch=(char)(0xff&hostPort.peek(i)); - switch(ch) + char ch = (char)(0xff & hostPort.peek(i)); + switch (ch) { case ']': break loop; case ':': - _serverName=BufferUtil.to8859_1_String(hostPort.peek(hostPort.getIndex(), i-hostPort.getIndex())); - _port=BufferUtil.toInt(hostPort.peek(i+1, hostPort.putIndex()-i-1)); + _serverName = BufferUtil.to8859_1_String(hostPort.peek(hostPort.getIndex(),i - hostPort.getIndex())); + _port = BufferUtil.toInt(hostPort.peek(i + 1,hostPort.putIndex() - i - 1)); return _serverName; } } - if (_serverName==null || _port<0) + if (_serverName == null || _port < 0) { - _serverName=BufferUtil.to8859_1_String(hostPort); + _serverName = BufferUtil.to8859_1_String(hostPort); _port = 0; } - + return _serverName; } @@ -1045,7 +1034,7 @@ public class Request implements HttpServletRequest { _serverName = getLocalName(); _port = getLocalPort(); - if (_serverName != null && !StringUtil.ALL_INTERFACES.equals(_serverName)) + if (_serverName != null && !StringUtil.ALL_INTERFACES.equals(_serverName)) return _serverName; } @@ -1062,26 +1051,26 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#getServerPort() */ public int getServerPort() { - if (_port<=0) + if (_port <= 0) { - if (_serverName==null) + if (_serverName == null) getServerName(); - - if (_port<=0) + + if (_port <= 0) { - if (_serverName!=null && _uri!=null) + if (_serverName != null && _uri != null) _port = _uri.getPort(); else - _port = _endp==null?0:_endp.getLocalPort(); + _port = _endp == null?0:_endp.getLocalPort(); } } - - if (_port<=0) + + if (_port <= 0) { if (getScheme().equalsIgnoreCase(URIUtil.HTTPS)) return 443; @@ -1097,23 +1086,23 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /* + /* */ public String getServletName() { - if (_scope!=null) + if (_scope != null) return _scope.getName(); return null; } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getServletPath() */ public String getServletPath() { - if (_servletPath==null) - _servletPath=""; + if (_servletPath == null) + _servletPath = ""; return _servletPath; } @@ -1124,7 +1113,7 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getSession() */ public HttpSession getSession() @@ -1133,33 +1122,32 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getSession(boolean) */ public HttpSession getSession(boolean create) - { - if (_session != null ) + { + if (_session != null) { - if (_sessionManager!=null && !_sessionManager.isValid(_session)) - _session=null; + if (_sessionManager != null && !_sessionManager.isValid(_session)) + _session = null; else return _session; } - + if (!create) return null; - - if (_sessionManager==null) + + if (_sessionManager == null) throw new IllegalStateException("No SessionManager"); - _session=_sessionManager.newHttpSession(this); - HttpCookie cookie=_sessionManager.getSessionCookie(_session,getContextPath(),isSecure()); - if (cookie!=null) + _session = _sessionManager.newHttpSession(this); + HttpCookie cookie = _sessionManager.getSessionCookie(_session,getContextPath(),isSecure()); + if (cookie != null) _connection.getResponse().addCookie(cookie); - + return _session; } - /* ------------------------------------------------------------ */ /** @@ -1169,31 +1157,31 @@ public class Request implements HttpServletRequest { return _sessionManager; } - + /* ------------------------------------------------------------ */ /** * Get Request TimeStamp - * + * * @return The time that the request was received. */ public long getTimeStamp() { return _timeStamp; } - + /* ------------------------------------------------------------ */ /** * Get Request TimeStamp - * + * * @return The time that the request was received. */ public Buffer getTimeStampBuffer() { if (_timeStampBuffer == null && _timeStamp > 0) - _timeStampBuffer = HttpFields.__dateCache.formatBuffer(_timeStamp); + _timeStampBuffer = HttpFields.__dateCache.formatBuffer(_timeStamp); return _timeStampBuffer; } - + /* ------------------------------------------------------------ */ /** * @return Returns the uri. @@ -1208,7 +1196,7 @@ public class Request implements HttpServletRequest { if (_authentication instanceof Authentication.Deferred) setAuthentication(((Authentication.Deferred)_authentication).authenticate(this)); - + if (_authentication instanceof Authentication.User) return ((Authentication.User)_authentication).getUserIdentity(); return null; @@ -1216,9 +1204,8 @@ public class Request implements HttpServletRequest /* ------------------------------------------------------------ */ /** - * @return The resolved user Identity, which may be null if the - * {@link Authentication} is not {@link Authentication.User} - * (eg. {@link Authentication.Deferred}). + * @return The resolved user Identity, which may be null if the {@link Authentication} is not {@link Authentication.User} (eg. + * {@link Authentication.Deferred}). */ public UserIdentity getResolvedUserIdentity() { @@ -1226,22 +1213,22 @@ public class Request implements HttpServletRequest return ((Authentication.User)_authentication).getUserIdentity(); return null; } - + /* ------------------------------------------------------------ */ public UserIdentity.Scope getUserIdentityScope() { return _scope; } - + /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#getUserPrincipal() */ public Principal getUserPrincipal() { if (_authentication instanceof Authentication.Deferred) setAuthentication(((Authentication.Deferred)_authentication).authenticate(this)); - + if (_authentication instanceof Authentication.User) { UserIdentity user = ((Authentication.User)_authentication).getUserIdentity(); @@ -1249,10 +1236,11 @@ public class Request implements HttpServletRequest } return null; } - + /* ------------------------------------------------------------ */ - /** Get timestamp of the request dispatch - * + /** + * Get timestamp of the request dispatch + * * @return timestamp */ public long getDispatchTime() @@ -1271,157 +1259,156 @@ public class Request implements HttpServletRequest { return _asyncSupported; } - + /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#isRequestedSessionIdFromCookie() */ public boolean isRequestedSessionIdFromCookie() { - return _requestedSessionId!=null && _requestedSessionIdFromCookie; + return _requestedSessionId != null && _requestedSessionIdFromCookie; } - + /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#isRequestedSessionIdFromUrl() */ public boolean isRequestedSessionIdFromUrl() { - return _requestedSessionId!=null && !_requestedSessionIdFromCookie; + return _requestedSessionId != null && !_requestedSessionIdFromCookie; } - + /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#isRequestedSessionIdFromURL() */ public boolean isRequestedSessionIdFromURL() { - return _requestedSessionId!=null && !_requestedSessionIdFromCookie; + return _requestedSessionId != null && !_requestedSessionIdFromCookie; } - + /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#isRequestedSessionIdValid() */ public boolean isRequestedSessionIdValid() - { - if (_requestedSessionId==null) + { + if (_requestedSessionId == null) return false; - - HttpSession session=getSession(false); + + HttpSession session = getSession(false); return (session != null && _sessionManager.getSessionIdManager().getClusterId(_requestedSessionId).equals(_sessionManager.getClusterId(session))); } - + /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#isSecure() */ public boolean isSecure() { return _connection.isConfidential(this); } - + /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.http.HttpServletRequest#isUserInRole(java.lang.String) */ public boolean isUserInRole(String role) { if (_authentication instanceof Authentication.Deferred) setAuthentication(((Authentication.Deferred)_authentication).authenticate(this)); - + if (_authentication instanceof Authentication.User) return ((Authentication.User)_authentication).isUserInRole(_scope,role); return false; } - + /* ------------------------------------------------------------ */ public HttpSession recoverNewSession(Object key) { - if (_savedNewSessions==null) + if (_savedNewSessions == null) return null; return _savedNewSessions.get(key); } - + /* ------------------------------------------------------------ */ protected void recycle() { - if (_inputState==__READER) + if (_inputState == __READER) { try { - int r=_reader.read(); - while(r!=-1) - r=_reader.read(); + int r = _reader.read(); + while (r != -1) + r = _reader.read(); } - catch(Exception e) + catch (Exception e) { LOG.ignore(e); - _reader=null; + _reader = null; } } - + setAuthentication(Authentication.NOT_CHECKED); - _async.recycle(); - _asyncSupported=true; - _handled=false; - if (_context!=null) + _async.recycle(); + _asyncSupported = true; + _handled = false; + if (_context != null) throw new IllegalStateException("Request in context!"); - if(_attributes!=null) + if (_attributes != null) _attributes.clearAttributes(); - _characterEncoding=null; - if (_cookies!=null) + _characterEncoding = null; + if (_cookies != null) _cookies.reset(); - _cookiesExtracted=false; - _context=null; - _serverName=null; - _method=null; - _pathInfo=null; - _port=0; - _protocol=HttpVersions.HTTP_1_1; - _queryEncoding=null; - _queryString=null; - _requestedSessionId=null; - _requestedSessionIdFromCookie=false; - _session=null; - _sessionManager=null; - _requestURI=null; - _scope=null; - _scheme=URIUtil.HTTP; - _servletPath=null; - _timeStamp=0; - _timeStampBuffer=null; - _uri=null; - if (_baseParameters!=null) + _cookiesExtracted = false; + _context = null; + _serverName = null; + _method = null; + _pathInfo = null; + _port = 0; + _protocol = HttpVersions.HTTP_1_1; + _queryEncoding = null; + _queryString = null; + _requestedSessionId = null; + _requestedSessionIdFromCookie = false; + _session = null; + _sessionManager = null; + _requestURI = null; + _scope = null; + _scheme = URIUtil.HTTP; + _servletPath = null; + _timeStamp = 0; + _timeStampBuffer = null; + _uri = null; + if (_baseParameters != null) _baseParameters.clear(); - _parameters=null; - _paramsExtracted=false; - _inputState=__NONE; - - if (_savedNewSessions!=null) + _parameters = null; + _paramsExtracted = false; + _inputState = __NONE; + + if (_savedNewSessions != null) _savedNewSessions.clear(); - _savedNewSessions=null; + _savedNewSessions = null; } - + /* ------------------------------------------------------------ */ - /* + /* * @see javax.servlet.ServletRequest#removeAttribute(java.lang.String) */ public void removeAttribute(String name) { - Object old_value=_attributes==null?null:_attributes.getAttribute(name); - - if (_attributes!=null) + Object old_value = _attributes == null?null:_attributes.getAttribute(name); + + if (_attributes != null) _attributes.removeAttribute(name); - - if (old_value!=null) + + if (old_value != null) { - if (_requestAttributeListeners!=null) + if (_requestAttributeListeners != null) { - final ServletRequestAttributeEvent event = - new ServletRequestAttributeEvent(_context,this,name, old_value); - final int size=LazyList.size(_requestAttributeListeners); - for(int i=0;i(); + if (_savedNewSessions == null) + _savedNewSessions = new HashMap(); _savedNewSessions.put(key,session); } + /* ------------------------------------------------------------ */ public void setAsyncSupported(boolean supported) { - _asyncSupported=supported; + _asyncSupported = supported; } - + /* ------------------------------------------------------------ */ - /* - * Set a request attribute. - * if the attribute name is "org.eclipse.jetty.server.server.Request.queryEncoding" then - * the value is also passed in a call to {@link #setQueryEncoding}. - *

      - * if the attribute name is "org.eclipse.jetty.server.server.ResponseBuffer", then - * the response buffer is flushed with @{link #flushResponseBuffer} - *

      - * if the attribute name is "org.eclipse.jetty.io.EndPoint.maxIdleTime", then the - * value is passed to the associated {@link EndPoint#setMaxIdleTime}. + /* + * Set a request attribute. if the attribute name is "org.eclipse.jetty.server.server.Request.queryEncoding" then the value is also passed in a call to + * {@link #setQueryEncoding}.

      if the attribute name is "org.eclipse.jetty.server.server.ResponseBuffer", then the response buffer is flushed with @{link + * #flushResponseBuffer}

      if the attribute name is "org.eclipse.jetty.io.EndPoint.maxIdleTime", then the value is passed to the associated {@link + * EndPoint#setMaxIdleTime}. + * * @see javax.servlet.ServletRequest#setAttribute(java.lang.String, java.lang.Object) */ public void setAttribute(String name, Object value) { - Object old_value=_attributes==null?null:_attributes.getAttribute(name); - + Object old_value = _attributes == null?null:_attributes.getAttribute(name); + if (name.startsWith("org.eclipse.jetty.")) { if ("org.eclipse.jetty.server.Request.queryEncoding".equals(name)) - setQueryEncoding(value==null?null:value.toString()); - else if("org.eclipse.jetty.server.sendContent".equals(name)) + setQueryEncoding(value == null?null:value.toString()); + else if ("org.eclipse.jetty.server.sendContent".equals(name)) { - try + try { - ((AbstractHttpConnection.Output)getServletResponse().getOutputStream()).sendContent(value); - } + ((AbstractHttpConnection.Output)getServletResponse().getOutputStream()).sendContent(value); + } catch (IOException e) { throw new RuntimeException(e); } } - else if("org.eclipse.jetty.server.ResponseBuffer".equals(name)) + else if ("org.eclipse.jetty.server.ResponseBuffer".equals(name)) { try { - final ByteBuffer byteBuffer=(ByteBuffer)value; + final ByteBuffer byteBuffer = (ByteBuffer)value; synchronized (byteBuffer) { - NIOBuffer buffer = byteBuffer.isDirect() - ?new DirectNIOBuffer(byteBuffer,true) - :new IndirectNIOBuffer(byteBuffer,true); + NIOBuffer buffer = byteBuffer.isDirect()?new DirectNIOBuffer(byteBuffer,true):new IndirectNIOBuffer(byteBuffer,true); ((AbstractHttpConnection.Output)getServletResponse().getOutputStream()).sendResponse(buffer); } } @@ -1508,32 +1491,31 @@ public class Request implements HttpServletRequest { getConnection().getEndPoint().setMaxIdleTime(Integer.valueOf(value.toString())); } - catch(IOException e) + catch (IOException e) { throw new RuntimeException(e); } } } - - if (_attributes==null) - _attributes=new AttributesMap(); - _attributes.setAttribute(name, value); - - if (_requestAttributeListeners!=null) + + if (_attributes == null) + _attributes = new AttributesMap(); + _attributes.setAttribute(name,value); + + if (_requestAttributeListeners != null) { - final ServletRequestAttributeEvent event = - new ServletRequestAttributeEvent(_context,this,name, old_value==null?value:old_value); - final int size=LazyList.size(_requestAttributeListeners); - for(int i=0;i parameters) { - _parameters= (parameters==null)?_baseParameters:parameters; - if (_paramsExtracted && _parameters==null) + _parameters = (parameters == null)?_baseParameters:parameters; + if (_paramsExtracted && _parameters == null) throw new IllegalStateException(); } /* ------------------------------------------------------------ */ /** - * @param pathInfo The pathInfo to set. + * @param pathInfo + * The pathInfo to set. */ public void setPathInfo(String pathInfo) { _pathInfo = pathInfo; } - + /* ------------------------------------------------------------ */ /** - * @param protocol The protocol to set. + * @param protocol + * The protocol to set. */ public void setProtocol(String protocol) { @@ -1704,33 +1695,34 @@ public class Request implements HttpServletRequest } /* ------------------------------------------------------------ */ - /** Set the character encoding used for the query string. - * This call will effect the return of getQueryString and getParamaters. - * It must be called before any geParameter methods. - * - * The request attribute "org.eclipse.jetty.server.server.Request.queryEncoding" - * may be set as an alternate method of calling setQueryEncoding. - * + /** + * Set the character encoding used for the query string. This call will effect the return of getQueryString and getParamaters. It must be called before any + * geParameter methods. + * + * The request attribute "org.eclipse.jetty.server.server.Request.queryEncoding" may be set as an alternate method of calling setQueryEncoding. + * * @param queryEncoding */ public void setQueryEncoding(String queryEncoding) { - _queryEncoding=queryEncoding; - _queryString=null; + _queryEncoding = queryEncoding; + _queryString = null; } - + /* ------------------------------------------------------------ */ /** - * @param queryString The queryString to set. + * @param queryString + * The queryString to set. */ public void setQueryString(String queryString) { _queryString = queryString; } - + /* ------------------------------------------------------------ */ /** - * @param addr The address to set. + * @param addr + * The address to set. */ public void setRemoteAddr(String addr) { @@ -1739,7 +1731,8 @@ public class Request implements HttpServletRequest /* ------------------------------------------------------------ */ /** - * @param host The host to set. + * @param host + * The host to set. */ public void setRemoteHost(String host) { @@ -1748,16 +1741,18 @@ public class Request implements HttpServletRequest /* ------------------------------------------------------------ */ /** - * @param requestedSessionId The requestedSessionId to set. + * @param requestedSessionId + * The requestedSessionId to set. */ public void setRequestedSessionId(String requestedSessionId) { _requestedSessionId = requestedSessionId; } - + /* ------------------------------------------------------------ */ /** - * @param requestedSessionIdCookie The requestedSessionIdCookie to set. + * @param requestedSessionIdCookie + * The requestedSessionIdCookie to set. */ public void setRequestedSessionIdFromCookie(boolean requestedSessionIdCookie) { @@ -1766,7 +1761,8 @@ public class Request implements HttpServletRequest /* ------------------------------------------------------------ */ /** - * @param requestURI The requestURI to set. + * @param requestURI + * The requestURI to set. */ public void setRequestURI(String requestURI) { @@ -1775,7 +1771,8 @@ public class Request implements HttpServletRequest /* ------------------------------------------------------------ */ /** - * @param scheme The scheme to set. + * @param scheme + * The scheme to set. */ public void setScheme(String scheme) { @@ -1784,16 +1781,18 @@ public class Request implements HttpServletRequest /* ------------------------------------------------------------ */ /** - * @param host The host to set. + * @param host + * The host to set. */ public void setServerName(String host) { _serverName = host; } - + /* ------------------------------------------------------------ */ /** - * @param port The port to set. + * @param port + * The port to set. */ public void setServerPort(int port) { @@ -1802,7 +1801,8 @@ public class Request implements HttpServletRequest /* ------------------------------------------------------------ */ /** - * @param servletPath The servletPath to set. + * @param servletPath + * The servletPath to set. */ public void setServletPath(String servletPath) { @@ -1811,7 +1811,8 @@ public class Request implements HttpServletRequest /* ------------------------------------------------------------ */ /** - * @param session The session to set. + * @param session + * The session to set. */ public void setSession(HttpSession session) { @@ -1820,7 +1821,8 @@ public class Request implements HttpServletRequest /* ------------------------------------------------------------ */ /** - * @param sessionManager The sessionManager to set. + * @param sessionManager + * The sessionManager to set. */ public void setSessionManager(SessionManager sessionManager) { @@ -1835,7 +1837,8 @@ public class Request implements HttpServletRequest /* ------------------------------------------------------------ */ /** - * @param uri The uri to set. + * @param uri + * The uri to set. */ public void setUri(HttpURI uri) { @@ -1845,13 +1848,15 @@ public class Request implements HttpServletRequest /* ------------------------------------------------------------ */ public void setUserIdentityScope(UserIdentity.Scope scope) { - _scope=scope; + _scope = scope; } /* ------------------------------------------------------------ */ - /** Set timetstamp of request dispatch - * - * @param value timestamp + /** + * Set timetstamp of request dispatch + * + * @param value + * timestamp */ public void setDispatchTime(long value) { @@ -1863,7 +1868,7 @@ public class Request implements HttpServletRequest { if (!_asyncSupported) throw new IllegalStateException("!asyncSupported"); - _async.suspend(_context,this,_connection._response); + _async.suspend(_context,this,_connection._response); return _async; } @@ -1880,85 +1885,85 @@ public class Request implements HttpServletRequest @Override public String toString() { - return (_handled?"[":"(")+getMethod()+" "+_uri+(_handled?"]@":")@")+hashCode()+" "+super.toString(); + return (_handled?"[":"(") + getMethod() + " " + _uri + (_handled?"]@":")@") + hashCode() + " " + super.toString(); } - - + /* ------------------------------------------------------------ */ - /** Merge in a new query string. - * The query string is merged with the existing parameters and {@link #setParameters(MultiMap)} and {@link #setQueryString(String)} are called with the result. - * The merge is according to the rules of the servlet dispatch forward method. - * @param query The query string to merge into the request. + /** + * Merge in a new query string. The query string is merged with the existing parameters and {@link #setParameters(MultiMap)} and + * {@link #setQueryString(String)} are called with the result. The merge is according to the rules of the servlet dispatch forward method. + * + * @param query + * The query string to merge into the request. */ public void mergeQueryString(String query) { // extract parameters from dispatch query - MultiMap parameters=new MultiMap(); + MultiMap parameters = new MultiMap(); UrlEncoded.decodeTo(query,parameters,getCharacterEncoding()); - + boolean merge_old_query = false; // Have we evaluated parameters - if (!_paramsExtracted) + if (!_paramsExtracted) extractParameters(); - + // Are there any existing parameters? - if (_parameters!=null && _parameters.size()>0) + if (_parameters != null && _parameters.size() > 0) { // Merge parameters; new parameters of the same name take precedence. - Iterator> iter = _parameters.entrySet().iterator(); + Iterator> iter = _parameters.entrySet().iterator(); while (iter.hasNext()) { - Map.Entry entry = iter.next(); - String name=entry.getKey(); - + Map.Entry entry = iter.next(); + String name = entry.getKey(); + // If the names match, we will need to remake the query string if (parameters.containsKey(name)) merge_old_query = true; // Add the old values to the new parameter map - Object values=entry.getValue(); - for (int i=0;i0) + + if (_queryString != null && _queryString.length() > 0) { - if ( merge_old_query ) + if (merge_old_query) { StringBuilder overridden_query_string = new StringBuilder(); MultiMap overridden_old_query = new MultiMap(); UrlEncoded.decodeTo(_queryString,overridden_old_query,getCharacterEncoding()); - MultiMap overridden_new_query = new MultiMap(); + MultiMap overridden_new_query = new MultiMap(); UrlEncoded.decodeTo(query,overridden_new_query,getCharacterEncoding()); - Iterator> iter = overridden_old_query.entrySet().iterator(); + Iterator> iter = overridden_old_query.entrySet().iterator(); while (iter.hasNext()) { - Map.Entry entry = iter.next(); - String name=entry.getKey(); - if(!overridden_new_query.containsKey(name)) + Map.Entry entry = iter.next(); + String name = entry.getKey(); + if (!overridden_new_query.containsKey(name)) { - Object values=entry.getValue(); - for (int i=0;i Date: Fri, 6 Jan 2012 17:49:22 +0100 Subject: [PATCH 25/34] 366774: NumberFormatException when parsing Host header now causes a 400 return code --- .../org/eclipse/jetty/server/Request.java | 20 ++++- .../org/eclipse/jetty/server/RequestTest.java | 73 ++++++++++++------- .../server/SelectChannelTimeoutTest.java | 20 ++--- 3 files changed, 76 insertions(+), 37 deletions(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java index 7a54b62706d..30dfd68c0d5 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java @@ -46,10 +46,12 @@ import javax.servlet.http.HttpSession; import org.eclipse.jetty.continuation.Continuation; import org.eclipse.jetty.continuation.ContinuationListener; import org.eclipse.jetty.http.HttpCookie; +import org.eclipse.jetty.http.HttpException; import org.eclipse.jetty.http.HttpFields; import org.eclipse.jetty.http.HttpHeaders; import org.eclipse.jetty.http.HttpMethods; import org.eclipse.jetty.http.HttpParser; +import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.http.HttpURI; import org.eclipse.jetty.http.HttpVersions; import org.eclipse.jetty.http.MimeTypes; @@ -1016,7 +1018,23 @@ public class Request implements HttpServletRequest case ':': _serverName = BufferUtil.to8859_1_String(hostPort.peek(hostPort.getIndex(),i - hostPort.getIndex())); - _port = BufferUtil.toInt(hostPort.peek(i + 1,hostPort.putIndex() - i - 1)); + try + { + _port = BufferUtil.toInt(hostPort.peek(i + 1,hostPort.putIndex() - i - 1)); + } + catch (NumberFormatException e) + { + try + { + if (_connection != null) + _connection._generator.sendError(HttpStatus.BAD_REQUEST_400,"Port couldn't be parsed from Host header: " + hostPort,null, + true); + } + catch (IOException e1) + { + throw new IllegalArgumentException("IOException caught while trying to send error due to invalid host header: " + hostPort,e1); + } + } return _serverName; } } diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java index bc4cbff2cdc..a81ad64a20e 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java @@ -40,6 +40,7 @@ import junit.framework.Assert; import org.eclipse.jetty.http.MimeTypes; import org.eclipse.jetty.server.handler.AbstractHandler; +import org.eclipse.jetty.server.handler.ContextHandler; import org.eclipse.jetty.util.IO; import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.log.Log; @@ -78,7 +79,7 @@ public class RequestTest _server.stop(); _server.join(); } - + @Test public void testParamExtraction() throws Exception { @@ -101,27 +102,27 @@ public class RequestTest System.err.println(map); assertFalse(map == null); assertTrue(map.isEmpty()); - + Enumeration names = request.getParameterNames(); assertFalse(names.hasMoreElements()); } - + return true; } }; - + //Send a request with query string with illegal hex code to cause //an exception parsing the params String request="GET /?param=%ZZaaa HTTP/1.1\r\n"+ "Host: whatever\r\n"+ "Content-Type: text/html;charset=utf8\n"+ "\n"; - + String responses=_connector.getResponses(request); assertTrue(responses.startsWith("HTTP/1.1 200")); - + } - + @Test public void testBadUtf8ParamExtraction() throws Exception { @@ -133,20 +134,40 @@ public class RequestTest return value.startsWith("aaa") && value.endsWith("bb"); } }; - + //Send a request with query string with illegal hex code to cause //an exception parsing the params String request="GET /?param=aaa%E7bbb HTTP/1.1\r\n"+ "Host: whatever\r\n"+ "Content-Type: text/html;charset=utf8\n"+ "\n"; - + String responses=_connector.getResponses(request); - assertTrue(responses.startsWith("HTTP/1.1 200")); + assertTrue(responses.startsWith("HTTP/1.1 200")); } - - + @Test + public void testInvalidHostHeader() throws Exception + { + // Use a contextHandler with vhosts to force call to Request.getServerName() + ContextHandler handler = new ContextHandler(); + handler.addVirtualHosts(new String[1]); + _server.stop(); + _server.setHandler(handler); + _server.start(); + + // Request with illegal Host header + String request="GET / HTTP/1.1\r\n"+ + "Host: whatever.com:\r\n"+ + "Content-Type: text/html;charset=utf8\n"+ + "\n"; + + String responses=_connector.getResponses(request); + assertTrue("400 Bad Request response expected",responses.startsWith("HTTP/1.1 400")); + } + + + @Test public void testContentTypeEncoding() throws Exception { @@ -196,7 +217,7 @@ public class RequestTest assertTrue(results.get(i++).startsWith("text/html")); assertEquals(" x=z; ",results.get(i++)); } - + @Test public void testHostPort() throws Exception { @@ -369,7 +390,7 @@ public class RequestTest Reader reader=request.getReader(); String in = IO.toString(reader); String param = request.getParameter("param"); - + byte[] b=("read='"+in+"' param="+param+"\n").getBytes(StringUtil.__UTF8); response.setContentLength(b.length); response.getOutputStream().write(b); @@ -389,11 +410,11 @@ public class RequestTest "param=wrong\r\n"; String responses = _connector.getResponses(request); - + assertTrue(responses.indexOf("read='param=wrong' param=right")>0); - + } - + @Test public void testPartialInput() throws Exception { @@ -752,7 +773,7 @@ public class RequestTest { _server.setAttribute("org.eclipse.jetty.server.Request.maxFormContentSize",-1); _server.setAttribute("org.eclipse.jetty.server.Request.maxFormKeys",1000); - + // This file is not distributed - as it is dangerous File evil_keys = new File("/tmp/keys_mapping_to_zero_2m"); if (!evil_keys.exists()) @@ -760,10 +781,10 @@ public class RequestTest Log.info("testHashDOS skipped"); return; } - + BufferedReader in = new BufferedReader(new FileReader(evil_keys)); StringBuilder buf = new StringBuilder(4000000); - + String key=null; buf.append("a=b"); while((key=in.readLine())!=null) @@ -771,7 +792,7 @@ public class RequestTest buf.append("&").append(key).append("=").append("x"); } buf.append("&c=d"); - + _handler._checker = new RequestTester() { public boolean check(HttpServletRequest request,HttpServletResponse response) @@ -787,15 +808,15 @@ public class RequestTest "Connection: close\r\n"+ "\r\n"+ buf; - + long start=System.currentTimeMillis(); String response = _connector.getResponses(request); assertTrue(response.contains("200 OK")); long now=System.currentTimeMillis(); assertTrue((now-start)<5000); } - - + + interface RequestTester { boolean check(HttpServletRequest request,HttpServletResponse response) throws IOException; @@ -812,12 +833,12 @@ public class RequestTest if (request.getContentLength()>0 && !MimeTypes.FORM_ENCODED.equals(request.getContentType())) _content=IO.toString(request.getInputStream()); - + if (_checker!=null && _checker.check(request,response)) response.setStatus(200); else response.sendError(500); - + } } diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/SelectChannelTimeoutTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/SelectChannelTimeoutTest.java index c3479cb4d4a..b0b3af66339 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/SelectChannelTimeoutTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/SelectChannelTimeoutTest.java @@ -24,14 +24,14 @@ import java.net.Socket; import org.eclipse.jetty.server.nio.SelectChannelConnector; import org.eclipse.jetty.server.session.SessionHandler; import org.eclipse.jetty.util.IO; -import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; public class SelectChannelTimeoutTest extends ConnectorTimeoutTest { - - @Before - public void init() throws Exception + + @BeforeClass + public static void init() throws Exception { SelectChannelConnector connector = new SelectChannelConnector(); connector.setMaxIdleTime(MAX_IDLE_TIME); // 250 msec max idle @@ -52,7 +52,7 @@ public class SelectChannelTimeoutTest extends ConnectorTimeoutTest _handler.setResumeAfter(25); assertTrue(process(null).toUpperCase().contains("RESUMED")); } - + @Test public void testIdleTimeoutAfterTimeout() throws Exception { @@ -62,13 +62,13 @@ public class SelectChannelTimeoutTest extends ConnectorTimeoutTest session.setHandler(_handler); _server.setHandler(session); _server.start(); - + _handler.setSuspendFor(50); assertTrue(process(null).toUpperCase().contains("TIMEOUT")); } - + @Test - public void testIdleTimeoutAfterComplete() throws Exception + public void testIdleTimeoutAfterComplete() throws Exception { SuspendHandler _handler = new SuspendHandler(); _server.stop(); @@ -76,13 +76,13 @@ public class SelectChannelTimeoutTest extends ConnectorTimeoutTest session.setHandler(_handler); _server.setHandler(session); _server.start(); - + _handler.setSuspendFor(100); _handler.setCompleteAfter(25); assertTrue(process(null).toUpperCase().contains("COMPLETED")); } - private synchronized String process(String content) throws UnsupportedEncodingException, IOException, InterruptedException + private synchronized String process(String content) throws UnsupportedEncodingException, IOException, InterruptedException { String request = "GET / HTTP/1.1\r\n" + "Host: localhost\r\n" + "Connection: close\r\n"; From 245161438160f0ed900bca3ce28b05b1bee6e3ad Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Mon, 9 Jan 2012 11:38:07 +1100 Subject: [PATCH 26/34] 366774 removed XSS vulnerbility --- .../src/main/java/org/eclipse/jetty/server/Request.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java index 30dfd68c0d5..01a6b7655d2 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Request.java @@ -1027,12 +1027,11 @@ public class Request implements HttpServletRequest try { if (_connection != null) - _connection._generator.sendError(HttpStatus.BAD_REQUEST_400,"Port couldn't be parsed from Host header: " + hostPort,null, - true); + _connection._generator.sendError(HttpStatus.BAD_REQUEST_400,"Bad Host header",null,true); } catch (IOException e1) { - throw new IllegalArgumentException("IOException caught while trying to send error due to invalid host header: " + hostPort,e1); + throw new RuntimeException(e1); } } return _serverName; From 9ba96f22dd44e6e8a342a03afe0b28244a8f9622 Mon Sep 17 00:00:00 2001 From: Thomas Becker Date: Fri, 6 Jan 2012 14:09:26 +0100 Subject: [PATCH 27/34] 367974: Calculate wait times, etc. based on MAX_IDLE_TIME --- .../jetty/server/ConnectorTimeoutTest.java | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ConnectorTimeoutTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ConnectorTimeoutTest.java index f01dfc831a8..85db40c80ed 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/ConnectorTimeoutTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ConnectorTimeoutTest.java @@ -39,6 +39,9 @@ import static org.junit.matchers.JUnitMatchers.containsString; public abstract class ConnectorTimeoutTest extends HttpServerTestFixture { protected static final int MAX_IDLE_TIME=250; + private int sleepTime = MAX_IDLE_TIME + MAX_IDLE_TIME/5; + private int minimumTestRuntime = MAX_IDLE_TIME-MAX_IDLE_TIME/5; + private int maximumTestRuntime = MAX_IDLE_TIME*10; static { @@ -68,11 +71,11 @@ public abstract class ConnectorTimeoutTest extends HttpServerTestFixture long start = System.currentTimeMillis(); IO.toString(is); - Thread.sleep(300); + Thread.sleep(sleepTime); assertEquals(-1, is.read()); - Assert.assertTrue(System.currentTimeMillis()-start>200); - Assert.assertTrue(System.currentTimeMillis()-start<5000); + Assert.assertTrue(System.currentTimeMillis()-start>minimumTestRuntime); + Assert.assertTrue(System.currentTimeMillis()-start200); - Assert.assertTrue(System.currentTimeMillis()-start<5000); + Assert.assertTrue(System.currentTimeMillis()-start>minimumTestRuntime); + Assert.assertTrue(System.currentTimeMillis()-start Date: Mon, 9 Jan 2012 13:12:25 +1100 Subject: [PATCH 28/34] 368114 Protect against non-Strings in System properties for Log --- jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java b/jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java index 74f8e5fa66d..c1f42baa85e 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java @@ -102,7 +102,10 @@ public class Log while (systemKeyEnum.hasMoreElements()) { String key = systemKeyEnum.nextElement(); - __props.setProperty(key,System.getProperty(key)); + String val = System.getProperty(key); + //protect against application code insertion of non-String values (returned as null) + if (val != null) + __props.setProperty(key,val); } /* Now use the configuration properties to configure the Log statics From 71ea564f0b48f28e95ac6020c0aca67df5c05552 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Mon, 9 Jan 2012 20:15:22 +0100 Subject: [PATCH 29/34] 368189 - WebSocketClientFactory should not manage external thread pool. --- .../websocket/WebSocketClientFactory.java | 23 ++++++++++++++++--- .../jetty/websocket/WebSocketClientTest.java | 5 +++- .../jetty/websocket/WebSocketOverSSLTest.java | 22 ++++++++++++++---- 3 files changed, 42 insertions(+), 8 deletions(-) diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java index 92407cd2eab..c7c73bc6524 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClientFactory.java @@ -45,6 +45,7 @@ import org.eclipse.jetty.io.nio.SslConnection; import org.eclipse.jetty.util.B64Code; import org.eclipse.jetty.util.QuotedStringTokenizer; import org.eclipse.jetty.util.component.AggregateLifeCycle; +import org.eclipse.jetty.util.component.LifeCycle; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.util.thread.QueuedThreadPool; @@ -67,6 +68,7 @@ public class WebSocketClientFactory extends AggregateLifeCycle private final Queue connections = new ConcurrentLinkedQueue(); private final SslContextFactory _sslContextFactory = new SslContextFactory(); private final ThreadPool _threadPool; + private final boolean _shutdownThreadPool; private final WebSocketClientSelector _selector; private MaskGen _maskGen; private WebSocketBuffers _buffers; @@ -77,7 +79,7 @@ public class WebSocketClientFactory extends AggregateLifeCycle */ public WebSocketClientFactory() { - this(new QueuedThreadPool()); + this(null); } /* ------------------------------------------------------------ */ @@ -114,14 +116,27 @@ public class WebSocketClientFactory extends AggregateLifeCycle */ public WebSocketClientFactory(ThreadPool threadPool, MaskGen maskGen, int bufferSize) { - _threadPool = threadPool; - addBean(threadPool); + if (threadPool == null) + { + _threadPool = new QueuedThreadPool(); + addBean(_threadPool); + _shutdownThreadPool = true; + } + else + { + _threadPool = threadPool; + _shutdownThreadPool = false; + } + _buffers = new WebSocketBuffers(bufferSize); addBean(_buffers); + _maskGen = maskGen; addBean(_maskGen); + _selector = new WebSocketClientSelector(); addBean(_selector); + addBean(_sslContextFactory); } @@ -209,6 +224,8 @@ public class WebSocketClientFactory extends AggregateLifeCycle { closeConnections(); super.doStop(); + if (_shutdownThreadPool && _threadPool instanceof LifeCycle) + ((LifeCycle)_threadPool).stop(); } /* ------------------------------------------------------------ */ diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketClientTest.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketClientTest.java index 571a454e0da..07a9060baa0 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketClientTest.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketClientTest.java @@ -74,8 +74,10 @@ public class WebSocketClientTest @Test public void testMessageBiggerThanBufferSize() throws Exception { + QueuedThreadPool threadPool = new QueuedThreadPool(); int bufferSize = 512; - WebSocketClientFactory factory = new WebSocketClientFactory(new QueuedThreadPool(), new ZeroMaskGen(), bufferSize); + WebSocketClientFactory factory = new WebSocketClientFactory(threadPool, new ZeroMaskGen(), bufferSize); + threadPool.start(); factory.start(); WebSocketClient client = new WebSocketClient(factory); @@ -118,6 +120,7 @@ public class WebSocketClientTest Assert.assertTrue(dataLatch.await(1000, TimeUnit.SECONDS)); factory.stop(); + threadPool.stop(); } @Test diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketOverSSLTest.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketOverSSLTest.java index 80b262d6392..524d8d0ece3 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketOverSSLTest.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketOverSSLTest.java @@ -35,6 +35,8 @@ public class WebSocketOverSSLTest { private Server _server; private int _port; + private QueuedThreadPool _threadPool; + private WebSocketClientFactory _wsFactory; private WebSocket.Connection _connection; private void startServer(final WebSocket webSocket) throws Exception @@ -61,13 +63,18 @@ public class WebSocketOverSSLTest { Assert.assertTrue(_server.isStarted()); - WebSocketClientFactory factory = new WebSocketClientFactory(new QueuedThreadPool(), new ZeroMaskGen()); - SslContextFactory cf = factory.getSslContextFactory(); + _threadPool = new QueuedThreadPool(); + _threadPool.setName("wsc-" + _threadPool.getName()); + _threadPool.start(); + + _wsFactory = new WebSocketClientFactory(_threadPool, new ZeroMaskGen()); + SslContextFactory cf = _wsFactory.getSslContextFactory(); cf.setKeyStorePath(MavenTestingUtils.getTestResourceFile("keystore").getAbsolutePath()); cf.setKeyStorePassword("storepwd"); cf.setKeyManagerPassword("keypwd"); - factory.start(); - WebSocketClient client = new WebSocketClient(factory); + _wsFactory.start(); + + WebSocketClient client = new WebSocketClient(_wsFactory); _connection = client.open(new URI("wss://localhost:" + _port), webSocket).get(5, TimeUnit.SECONDS); } @@ -76,6 +83,13 @@ public class WebSocketOverSSLTest { if (_connection != null) _connection.close(); + + if (_wsFactory != null) + _wsFactory.stop(); + + if (_threadPool != null) + _threadPool.stop(); + if (_server != null) { _server.stop(); From 27cbf0bf785f92c7639133cd6542ffdfdd6cf361 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Mon, 9 Jan 2012 20:27:46 +0100 Subject: [PATCH 30/34] 367099 - Upgrade jetty-websocket for RFC 6455 - Addendum. The WebSocket parser was forgot in the renaming. Took also the chance to remove hardcoded "D13" string in toString() methods. --- .../websocket/WebSocketConnectionRFC6455.java | 14 +- ...erD13.java => WebSocketParserRFC6455.java} | 6 +- ...est.java => WebSocketLoadRFC6455Test.java} | 24 +- .../WebSocketMessageRFC6455Test.java | 234 +++++++++--------- .../websocket/WebSocketParserRFC6455Test.java | 64 ++--- 5 files changed, 174 insertions(+), 168 deletions(-) rename jetty-websocket/src/main/java/org/eclipse/jetty/websocket/{WebSocketParserD13.java => WebSocketParserRFC6455.java} (98%) rename jetty-websocket/src/test/java/org/eclipse/jetty/websocket/{WebSocketLoadD13Test.java => WebSocketLoadRFC6455Test.java} (96%) diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionRFC6455.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionRFC6455.java index 7f693751be0..9a6377bd125 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionRFC6455.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionRFC6455.java @@ -121,7 +121,7 @@ public class WebSocketConnectionRFC6455 extends AbstractConnection implements We private final static byte[] MAGIC; private final List _extensions; - private final WebSocketParserD13 _parser; + private final WebSocketParserRFC6455 _parser; private final WebSocketGeneratorRFC6455 _generator; private final WebSocketGenerator _outbound; private final WebSocket _webSocket; @@ -197,7 +197,7 @@ public class WebSocketConnectionRFC6455 extends AbstractConnection implements We _outbound=(_extensions==null||_extensions.size()==0)?_generator:extensions.get(extensions.size()-1); WebSocketParser.FrameHandler inbound = (_extensions == null || _extensions.size() == 0) ? frameHandler : extensions.get(0); - _parser = new WebSocketParserD13(buffers, endpoint, inbound,maskgen==null); + _parser = new WebSocketParserRFC6455(buffers, endpoint, inbound,maskgen==null); _protocol=protocol; @@ -642,7 +642,13 @@ public class WebSocketConnectionRFC6455 extends AbstractConnection implements We @Override public String toString() { - return this.getClass().getSimpleName()+"D13@"+_endp.getLocalAddr()+":"+_endp.getLocalPort()+"<->"+_endp.getRemoteAddr()+":"+_endp.getRemotePort(); + return String.format("%s@%x l(%s:%d)<->r(%s:%d)", + getClass().getSimpleName(), + hashCode(), + _endp.getLocalAddr(), + _endp.getLocalPort(), + _endp.getRemoteAddr(), + _endp.getRemotePort()); } } @@ -973,6 +979,6 @@ public class WebSocketConnectionRFC6455 extends AbstractConnection implements We @Override public String toString() { - return String.format("WS/D%d p=%s g=%s", _draft, _parser, _generator); + return String.format("%s p=%s g=%s", getClass().getSimpleName(), _parser, _generator); } } diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParserD13.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParserRFC6455.java similarity index 98% rename from jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParserD13.java rename to jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParserRFC6455.java index 9979a683735..dbb16cb4390 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParserD13.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketParserRFC6455.java @@ -43,9 +43,9 @@ import org.eclipse.jetty.util.log.Logger; * Parser the WebSocket protocol. * */ -public class WebSocketParserD13 implements WebSocketParser +public class WebSocketParserRFC6455 implements WebSocketParser { - private static final Logger LOG = Log.getLogger(WebSocketParserD13.class); + private static final Logger LOG = Log.getLogger(WebSocketParserRFC6455.class); public enum State { @@ -89,7 +89,7 @@ public class WebSocketParserD13 implements WebSocketParser * @param handler the handler to notify when a parse event occurs * @param shouldBeMasked whether masking should be handled */ - public WebSocketParserD13(WebSocketBuffers buffers, EndPoint endp, FrameHandler handler, boolean shouldBeMasked) + public WebSocketParserRFC6455(WebSocketBuffers buffers, EndPoint endp, FrameHandler handler, boolean shouldBeMasked) { _buffers=buffers; _endp=endp; diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketLoadD13Test.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketLoadRFC6455Test.java similarity index 96% rename from jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketLoadD13Test.java rename to jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketLoadRFC6455Test.java index 9a12059a006..13a3869bdc1 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketLoadD13Test.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketLoadRFC6455Test.java @@ -15,8 +15,6 @@ *******************************************************************************/ package org.eclipse.jetty.websocket; -import static org.junit.Assert.*; - import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; @@ -28,11 +26,9 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; - import javax.servlet.http.HttpServletRequest; import junit.framework.Assert; - import org.eclipse.jetty.io.Buffer; import org.eclipse.jetty.io.bio.SocketEndPoint; import org.eclipse.jetty.server.Connector; @@ -45,7 +41,9 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; -public class WebSocketLoadD13Test +import static org.junit.Assert.assertTrue; + +public class WebSocketLoadRFC6455Test { private static Server _server; private static Connector _connector; @@ -127,7 +125,7 @@ public class WebSocketLoadD13Test { this.outbound = outbound; } - + public void onMessage(String data) { try @@ -155,7 +153,7 @@ public class WebSocketLoadD13Test private final CountDownLatch latch; private final SocketEndPoint _endp; private final WebSocketGeneratorRFC6455 _generator; - private final WebSocketParserD13 _parser; + private final WebSocketParserRFC6455 _parser; private final WebSocketParser.FrameHandler _handler = new WebSocketParser.FrameHandler() { public void onFrame(byte flags, byte opcode, Buffer buffer) @@ -168,7 +166,7 @@ public class WebSocketLoadD13Test } }; private volatile Buffer _response; - + public WebSocketClient(String host, int port, int readTimeout, CountDownLatch latch, int iterations) throws IOException { this.latch = latch; @@ -177,11 +175,11 @@ public class WebSocketLoadD13Test output = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), "ISO-8859-1")); input = new BufferedReader(new InputStreamReader(socket.getInputStream(), "ISO-8859-1")); this.iterations = iterations; - + _endp=new SocketEndPoint(socket); _generator = new WebSocketGeneratorRFC6455(new WebSocketBuffers(32*1024),_endp,new FixedMaskGen()); - _parser = new WebSocketParserD13(new WebSocketBuffers(32*1024),_endp,_handler,false); - + _parser = new WebSocketParserRFC6455(new WebSocketBuffers(32*1024),_endp,_handler,false); + } private void open() throws IOException @@ -216,9 +214,9 @@ public class WebSocketLoadD13Test byte[] data = message.getBytes(StringUtil.__UTF8); _generator.addFrame((byte)0x8,WebSocketConnectionRFC6455.OP_TEXT,data,0,data.length); _generator.flush(); - + //System.err.println("-> "+message); - + _response=null; while(_response==null) _parser.parseNext(); diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageRFC6455Test.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageRFC6455Test.java index 6c017e93175..3fe9942cb63 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageRFC6455Test.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageRFC6455Test.java @@ -15,8 +15,6 @@ *******************************************************************************/ package org.eclipse.jetty.websocket; -import static org.junit.Assert.*; - import java.io.EOFException; import java.io.IOException; import java.io.InputStream; @@ -30,11 +28,9 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; import java.util.zip.Deflater; import java.util.zip.Inflater; - import javax.servlet.http.HttpServletRequest; import junit.framework.Assert; - import org.eclipse.jetty.io.Buffer; import org.eclipse.jetty.io.ByteArrayEndPoint; import org.eclipse.jetty.server.Connector; @@ -48,6 +44,10 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + public class WebSocketMessageRFC6455Test { private static Server __server; @@ -78,7 +78,7 @@ public class WebSocketMessageRFC6455Test } }; wsHandler.getWebSocketFactory().setBufferSize(8192); - wsHandler.getWebSocketFactory().setMaxIdleTime(1000); + wsHandler.getWebSocketFactory().setMaxIdleTime(1000); wsHandler.setHandler(new DefaultHandler()); __server.setHandler(wsHandler); __server.start(); @@ -91,13 +91,13 @@ public class WebSocketMessageRFC6455Test __server.join(); } - + @Test public void testHash() { assertEquals("s3pPLMBiTxaQ9kYGzzhZRbK+xOo=",WebSocketConnectionRFC6455.hashKey("dGhlIHNhbXBsZSBub25jZQ==")); } - + @Test public void testServerSendBigStringMessage() throws Exception { @@ -119,7 +119,7 @@ public class WebSocketMessageRFC6455Test socket.setSoTimeout(1000); InputStream input = socket.getInputStream(); - + lookFor("HTTP/1.1 101 Switching Protocols\r\n",input); skipTo("Sec-WebSocket-Accept: ",input); lookFor("s3pPLMBiTxaQ9kYGzzhZRbK+xOo=",input); @@ -127,7 +127,7 @@ public class WebSocketMessageRFC6455Test assertTrue(__serverWebSocket.awaitConnected(1000)); assertNotNull(__serverWebSocket.connection); - + // Server sends a big message StringBuilder message = new StringBuilder(); String text = "0123456789ABCDEF"; @@ -167,7 +167,7 @@ public class WebSocketMessageRFC6455Test socket.setSoTimeout(1000); InputStream input = socket.getInputStream(); - + lookFor("HTTP/1.1 101 Switching Protocols\r\n",input); skipTo("Sec-WebSocket-Accept: ",input); lookFor("s3pPLMBiTxaQ9kYGzzhZRbK+xOo=",input); @@ -175,7 +175,7 @@ public class WebSocketMessageRFC6455Test assertTrue(__serverWebSocket.awaitConnected(1000)); assertNotNull(__serverWebSocket.connection); - + assertEquals(0x81,input.read()); assertEquals(0x0f,input.read()); lookFor("sent on connect",input); @@ -312,8 +312,8 @@ public class WebSocketMessageRFC6455Test assertTrue(__serverWebSocket.awaitConnected(1000)); assertNotNull(__serverWebSocket.connection); - - + + // Server sends a big message String text = "0123456789ABCDEF "; text=text+text+text+text; @@ -324,15 +324,15 @@ public class WebSocketMessageRFC6455Test deflater.setInput(data); deflater.finish(); byte[] buf=new byte[data.length]; - + buf[0]=(byte)((byte)0x7e); buf[1]=(byte)(data.length>>8); buf[2]=(byte)(data.length&0xff); - + int l=deflater.deflate(buf,3,buf.length-3); assertTrue(deflater.finished()); - + output.write(0xC1); output.write((byte)(0x80|(0xff&(l+3)))); output.write(0x00); @@ -341,41 +341,41 @@ public class WebSocketMessageRFC6455Test output.write(0x00); output.write(buf,0,l+3); output.flush(); - + assertEquals(0x40+WebSocketConnectionRFC6455.OP_TEXT,input.read()); assertEquals(0x20+3,input.read()); assertEquals(0x7e,input.read()); assertEquals(0x02,input.read()); assertEquals(0x20,input.read()); - + byte[] raw = new byte[32]; assertEquals(32,input.read(raw)); - + Inflater inflater = new Inflater(); inflater.setInput(raw); - + byte[] result = new byte[544]; assertEquals(544,inflater.inflate(result)); assertEquals(TypeUtil.toHexString(data,0,544),TypeUtil.toHexString(result)); - + assertEquals((byte)0xC0,(byte)input.read()); assertEquals(0x21+3,input.read()); assertEquals(0x7e,input.read()); assertEquals(0x02,input.read()); assertEquals(0x21,input.read()); - + assertEquals(32,input.read(raw)); - + inflater.reset(); inflater.setInput(raw); result = new byte[545]; assertEquals(545,inflater.inflate(result)); assertEquals(TypeUtil.toHexString(data,544,545),TypeUtil.toHexString(result)); - + } - + @Test public void testServerEcho() throws Exception { @@ -403,10 +403,10 @@ public class WebSocketMessageRFC6455Test output.write(bytes[i]^0xff); output.flush(); // Make sure the read times out if there are problems with the implementation - socket.setSoTimeout(1000); + socket.setSoTimeout(1000); InputStream input = socket.getInputStream(); - + lookFor("HTTP/1.1 101 Switching Protocols\r\n",input); skipTo("Sec-WebSocket-Accept: ",input); lookFor("s3pPLMBiTxaQ9kYGzzhZRbK+xOo=",input); @@ -414,12 +414,12 @@ public class WebSocketMessageRFC6455Test assertTrue(__serverWebSocket.awaitConnected(1000)); assertNotNull(__serverWebSocket.connection); - + assertEquals(0x84,input.read()); assertEquals(0x0f,input.read()); lookFor("this is an echo",input); } - + @Test public void testBlockedConsumer() throws Exception { @@ -436,7 +436,7 @@ public class WebSocketMessageRFC6455Test mesg[5]=(byte)0xff; for (int i=0;i>> "+i); output.flush(); - + long now=System.currentTimeMillis(); long duration=now-start; start=now; @@ -518,13 +518,13 @@ public class WebSocketMessageRFC6455Test assertEquals(count+1,__textCount.get()); // all messages assertTrue(max>2000); // was blocked } - + @Test public void testBlockedProducer() throws Exception { final Socket socket = new Socket("localhost", __connector.getLocalPort()); OutputStream output = socket.getOutputStream(); - + final int count = 100000; output.write( @@ -581,8 +581,8 @@ public class WebSocketMessageRFC6455Test } } }.start(); - - + + // Send enough messages to fill receive buffer long max=0; long start=System.currentTimeMillis(); @@ -593,7 +593,7 @@ public class WebSocketMessageRFC6455Test if (i%100==0) { output.flush(); - + long now=System.currentTimeMillis(); long duration=now-start; start=now; @@ -601,10 +601,10 @@ public class WebSocketMessageRFC6455Test max=duration; } } - + while(totalB.get()<(count*(mesg.length()+2))) Thread.sleep(100); - + assertEquals(count*(mesg.length()+2),totalB.get()); // all messages assertTrue(max>1000); // was blocked } @@ -635,7 +635,7 @@ public class WebSocketMessageRFC6455Test output.flush(); InputStream input = socket.getInputStream(); - + lookFor("HTTP/1.1 101 Switching Protocols\r\n",input); skipTo("Sec-WebSocket-Accept: ",input); lookFor("s3pPLMBiTxaQ9kYGzzhZRbK+xOo=",input); @@ -668,7 +668,7 @@ public class WebSocketMessageRFC6455Test socket.setSoTimeout(1000); InputStream input = socket.getInputStream(); - + lookFor("HTTP/1.1 101 Switching Protocols\r\n",input); skipTo("Sec-WebSocket-Accept: ",input); lookFor("s3pPLMBiTxaQ9kYGzzhZRbK+xOo=",input); @@ -676,10 +676,10 @@ public class WebSocketMessageRFC6455Test assertTrue(__serverWebSocket.awaitConnected(1000)); assertNotNull(__serverWebSocket.connection); - + __serverWebSocket.getConnection().setMaxTextMessageSize(10*1024); __serverWebSocket.getConnection().setAllowFrameFragmentation(true); - + output.write(0x81); output.write(0x80|0x7E); output.write((byte)((16*1024)>>8)); @@ -692,7 +692,7 @@ public class WebSocketMessageRFC6455Test for (int i=0;i<(16*1024);i++) output.write('X'); output.flush(); - + assertEquals(0x80|WebSocketConnectionRFC6455.OP_CLOSE,input.read()); assertEquals(33,input.read()); @@ -720,7 +720,7 @@ public class WebSocketMessageRFC6455Test socket.setSoTimeout(1000); InputStream input = socket.getInputStream(); - + lookFor("HTTP/1.1 101 Switching Protocols\r\n",input); skipTo("Sec-WebSocket-Accept: ",input); lookFor("s3pPLMBiTxaQ9kYGzzhZRbK+xOo=",input); @@ -728,9 +728,9 @@ public class WebSocketMessageRFC6455Test assertTrue(__serverWebSocket.awaitConnected(1000)); assertNotNull(__serverWebSocket.connection); - + __serverWebSocket.getConnection().setMaxTextMessageSize(15); - + output.write(0x01); output.write(0x8a); output.write(0xff); @@ -779,7 +779,7 @@ public class WebSocketMessageRFC6455Test socket.setSoTimeout(100000); InputStream input = socket.getInputStream(); - + lookFor("HTTP/1.1 101 Switching Protocols\r\n",input); skipTo("Sec-WebSocket-Accept: ",input); lookFor("s3pPLMBiTxaQ9kYGzzhZRbK+xOo=",input); @@ -787,9 +787,9 @@ public class WebSocketMessageRFC6455Test assertTrue(__serverWebSocket.awaitConnected(1000)); assertNotNull(__serverWebSocket.connection); - + __serverWebSocket.getConnection().setMaxTextMessageSize(15); - + output.write(0x01); output.write(0x94); output.write(0xff); @@ -800,9 +800,9 @@ public class WebSocketMessageRFC6455Test for (int i=0;i 15",input); } - - + + @Test public void testCloseIn() throws Exception { - int[][] tests = + int[][] tests = { {-1,0,-1}, {-1,0,-1}, @@ -960,7 +960,7 @@ public class WebSocketMessageRFC6455Test "", "mesg" }; - + String[] resp = { "", @@ -1007,14 +1007,14 @@ public class WebSocketMessageRFC6455Test int code=tests[t][0]; String m=mesg[t]; - + output.write(0x88); output.write(0x80 + (code<=0?0:(2+m.length()))); output.write(0x00); output.write(0x00); output.write(0x00); output.write(0x00); - + if (code>0) { output.write(code/0x100); @@ -1022,12 +1022,12 @@ public class WebSocketMessageRFC6455Test output.write(m.getBytes()); } output.flush(); - + __serverWebSocket.awaitDisconnected(1000); byte[] buf = new byte[128]; int len = input.read(buf); - + assertEquals(tst,2+tests[t][1],len); assertEquals(tst,(byte)0x88,buf[0]); @@ -1035,7 +1035,7 @@ public class WebSocketMessageRFC6455Test { code=(0xff&buf[2])*0x100+(0xff&buf[3]); assertEquals(tst,tests[t][2],code); - + if (len>4) { m = new String(buf,4,len-4,"UTF-8"); @@ -1044,19 +1044,19 @@ public class WebSocketMessageRFC6455Test } else assertEquals(tst,tests[t][2],-1); - + len = input.read(buf); assertEquals(tst,-1,len); } } - + @Test public void testCloseOut() throws Exception { - int[][] tests = + int[][] tests = { {-1,0,-1}, {-1,0,-1}, @@ -1127,7 +1127,7 @@ public class WebSocketMessageRFC6455Test { int code=(0xff&buf[2])*0x100+(0xff&buf[3]); assertEquals(tst,tests[t][2],code); - + if (len>4) { String m = new String(buf,4,len-4,"UTF-8"); @@ -1136,7 +1136,7 @@ public class WebSocketMessageRFC6455Test } else assertEquals(tst,tests[t][2],-1); - + try { output.write(0x88); @@ -1152,12 +1152,12 @@ public class WebSocketMessageRFC6455Test System.err.println("socket "+socket); throw e; } - + len = input.read(buf); assertEquals(tst,-1,len); - } + } } - + @Test public void testNotUTF8() throws Exception @@ -1225,7 +1225,7 @@ public class WebSocketMessageRFC6455Test socket.setSoTimeout(100000); InputStream input = socket.getInputStream(); - + lookFor("HTTP/1.1 101 Switching Protocols\r\n",input); skipTo("Sec-WebSocket-Accept: ",input); lookFor("s3pPLMBiTxaQ9kYGzzhZRbK+xOo=",input); @@ -1233,9 +1233,9 @@ public class WebSocketMessageRFC6455Test assertTrue(__serverWebSocket.awaitConnected(1000)); assertNotNull(__serverWebSocket.connection); - + __serverWebSocket.getConnection().setMaxBinaryMessageSize(15); - + output.write(0x02); output.write(0x94); output.write(0xff); @@ -1246,7 +1246,7 @@ public class WebSocketMessageRFC6455Test for (int i=0;i received = new AtomicReference(); ByteArrayEndPoint endp = new ByteArrayEndPoint(new byte[0],4096); - + WebSocketGeneratorRFC6455 gen = new WebSocketGeneratorRFC6455(new WebSocketBuffers(8096),endp,null); - + byte[] data = message.getBytes(StringUtil.__UTF8); gen.addFrame((byte)0x8,(byte)0x4,data,0,data.length); - + endp = new ByteArrayEndPoint(endp.getOut().asArray(),4096); - - WebSocketParserD13 parser = new WebSocketParserD13(new WebSocketBuffers(8096),endp,new WebSocketParser.FrameHandler() + + WebSocketParserRFC6455 parser = new WebSocketParserRFC6455(new WebSocketBuffers(8096),endp,new WebSocketParser.FrameHandler() { public void onFrame(byte flags, byte opcode, Buffer buffer) { @@ -1449,12 +1449,12 @@ public class WebSocketMessageRFC6455Test } },false); - + parser.parseNext(); - + assertEquals(message,received.get()); } - + @Test public void testParserAndGeneratorMasked() throws Exception { @@ -1463,14 +1463,14 @@ public class WebSocketMessageRFC6455Test ByteArrayEndPoint endp = new ByteArrayEndPoint(new byte[0],4096); MaskGen maskGen = new RandomMaskGen(); - + WebSocketGeneratorRFC6455 gen = new WebSocketGeneratorRFC6455(new WebSocketBuffers(8096),endp,maskGen); byte[] data = message.getBytes(StringUtil.__UTF8); gen.addFrame((byte)0x8,(byte)0x1,data,0,data.length); - + endp = new ByteArrayEndPoint(endp.getOut().asArray(),4096); - - WebSocketParserD13 parser = new WebSocketParserD13(new WebSocketBuffers(8096),endp,new WebSocketParser.FrameHandler() + + WebSocketParserRFC6455 parser = new WebSocketParserRFC6455(new WebSocketBuffers(8096),endp,new WebSocketParser.FrameHandler() { public void onFrame(byte flags, byte opcode, Buffer buffer) { @@ -1481,13 +1481,13 @@ public class WebSocketMessageRFC6455Test { } },true); - + parser.parseNext(); - + assertEquals(message,received.get()); } - - + + private void lookFor(String string,InputStream in) throws IOException { @@ -1535,7 +1535,7 @@ public class WebSocketMessageRFC6455Test state=0; } } - + private static class TestWebSocket implements WebSocket.OnFrame, WebSocket.OnBinaryMessage, WebSocket.OnTextMessage { @@ -1556,7 +1556,7 @@ public class WebSocketMessageRFC6455Test { this.connection = connection; } - + public void onOpen(Connection connection) { if (_onConnect) @@ -1582,14 +1582,14 @@ public class WebSocketMessageRFC6455Test { return disconnected.await(time, TimeUnit.MILLISECONDS); } - + public void onClose(int code,String message) { disconnected.countDown(); } public boolean onFrame(byte flags, byte opcode, byte[] data, int offset, int length) - { + { if (_echo) { switch(opcode) @@ -1598,7 +1598,7 @@ public class WebSocketMessageRFC6455Test case WebSocketConnectionRFC6455.OP_PING: case WebSocketConnectionRFC6455.OP_PONG: break; - + default: try { @@ -1642,7 +1642,7 @@ public class WebSocketMessageRFC6455Test e.printStackTrace(); } } - + if (_aggregate) { try diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketParserRFC6455Test.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketParserRFC6455Test.java index 34d0f1efdd1..5d9e920dd76 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketParserRFC6455Test.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketParserRFC6455Test.java @@ -15,8 +15,6 @@ *******************************************************************************/ package org.eclipse.jetty.websocket; -import static org.junit.Assert.*; - import java.util.ArrayList; import java.util.List; @@ -30,12 +28,16 @@ import org.eclipse.jetty.util.Utf8StringBuilder; import org.junit.Before; import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + public class WebSocketParserRFC6455Test { private ByteArrayEndPoint _endPoint; private MaskedByteArrayBuffer _in; private Handler _handler; - private WebSocketParserD13 _parser; + private WebSocketParserRFC6455 _parser; private byte[] _mask = new byte[] {(byte)0x00,(byte)0xF0,(byte)0x0F,(byte)0xFF}; private int _m; @@ -45,7 +47,7 @@ public class WebSocketParserRFC6455Test { super(4096); } - + public void sendMask() { super.poke(putIndex(),_mask,0,4); @@ -63,7 +65,7 @@ public class WebSocketParserRFC6455Test { super.put(b); } - + @Override public void put(byte b) { @@ -87,10 +89,10 @@ public class WebSocketParserRFC6455Test { return put(b,0,b.length); } - + }; - - + + @Before public void setUp() throws Exception { @@ -98,10 +100,10 @@ public class WebSocketParserRFC6455Test _endPoint = new ByteArrayEndPoint(); _endPoint.setNonBlocking(true); _handler = new Handler(); - _parser=new WebSocketParserD13(buffers, _endPoint,_handler,true); + _parser=new WebSocketParserRFC6455(buffers, _endPoint,_handler,true); _parser.setFakeFragments(false); _in = new MaskedByteArrayBuffer(); - + _endPoint.setIn(_in); } @@ -127,7 +129,7 @@ public class WebSocketParserRFC6455Test _parser.returnBuffer(); assertTrue(_parser.getBuffer()==null); } - + @Test public void testShortText() throws Exception { @@ -147,7 +149,7 @@ public class WebSocketParserRFC6455Test _parser.returnBuffer(); assertTrue(_parser.getBuffer()==null); } - + @Test public void testShortUtf8() throws Exception { @@ -169,7 +171,7 @@ public class WebSocketParserRFC6455Test assertTrue(_parser.isBufferEmpty()); assertTrue(_parser.getBuffer()==null); } - + @Test public void testMediumText() throws Exception { @@ -177,9 +179,9 @@ public class WebSocketParserRFC6455Test for (int i=0;i<4;i++) string = string+string; string += ". The end."; - + byte[] bytes = string.getBytes(StringUtil.__UTF8); - + _in.putUnmasked((byte)0x81); _in.putUnmasked((byte)(0x80|0x7E)); _in.putUnmasked((byte)(bytes.length>>8)); @@ -197,21 +199,21 @@ public class WebSocketParserRFC6455Test assertTrue(_parser.isBufferEmpty()); assertTrue(_parser.getBuffer()==null); } - + @Test public void testLongText() throws Exception { WebSocketBuffers buffers = new WebSocketBuffers(0x20000); ByteArrayEndPoint endPoint = new ByteArrayEndPoint(); - WebSocketParserD13 parser=new WebSocketParserD13(buffers, endPoint,_handler,false); + WebSocketParserRFC6455 parser=new WebSocketParserRFC6455(buffers, endPoint,_handler,false); ByteArrayBuffer in = new ByteArrayBuffer(0x20000); endPoint.setIn(in); - + String string = "Hell\uFF4f Big W\uFF4Frld "; for (int i=0;i<12;i++) string = string+string; string += ". The end."; - + byte[] bytes = string.getBytes("UTF-8"); _in.sendMask(); @@ -269,7 +271,7 @@ public class WebSocketParserRFC6455Test { // Buffers are only 1024, so this frame is too large _parser.setFakeFragments(false); - + _in.putUnmasked((byte)0x81); _in.putUnmasked((byte)(0x80|0x7E)); _in.putUnmasked((byte)(2048>>8)); @@ -280,8 +282,8 @@ public class WebSocketParserRFC6455Test assertTrue(progress>0); assertEquals(WebSocketConnectionRFC6455.CLOSE_POLICY_VIOLATION,_handler._code); - - + + for (int i=0;i<2048;i++) _in.put((byte)'a'); progress =_parser.parseNext(); @@ -289,7 +291,7 @@ public class WebSocketParserRFC6455Test assertTrue(progress>0); assertEquals(0,_handler._data.size()); assertEquals(0,_handler._utf8.length()); - + _handler._code=0; _in.putUnmasked((byte)0x81); @@ -310,7 +312,7 @@ public class WebSocketParserRFC6455Test { // Buffers are only 1024, so this frame will be fake fragmented _parser.setFakeFragments(true); - + _in.putUnmasked((byte)0x81); _in.putUnmasked((byte)(0x80|0x7E)); _in.putUnmasked((byte)(2048>>8)); @@ -318,7 +320,7 @@ public class WebSocketParserRFC6455Test _in.sendMask(); for (int i=0;i<2048;i++) _in.put((byte)('a'+i%26)); - + int progress =_parser.parseNext(); assertTrue(progress>0); @@ -355,21 +357,21 @@ public class WebSocketParserRFC6455Test _parser.returnBuffer(); assertTrue(_parser.isBufferEmpty()); assertTrue(_parser.getBuffer()==null); - + _in.clear(); _in.put(bytes); _endPoint.setIn(_in); progress =_parser.parseNext(); assertTrue(progress>0); - + _endPoint.shutdownInput(); - + progress =_parser.parseNext(); assertEquals(-1,progress); - + } - - + + private class Handler implements WebSocketParser.FrameHandler { Utf8StringBuilder _utf8 = new Utf8StringBuilder(); From 829686f1e10f0bab1fd63d882a20193d0a474831 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Mon, 9 Jan 2012 21:51:15 +0100 Subject: [PATCH 31/34] Removed JDK 1.6-ism. --- .../org/eclipse/jetty/client/HttpsProxyAuthenticationTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpsProxyAuthenticationTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpsProxyAuthenticationTest.java index 9076f054291..e04f93875e0 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpsProxyAuthenticationTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpsProxyAuthenticationTest.java @@ -48,7 +48,8 @@ public class HttpsProxyAuthenticationTest @Override protected boolean handleAuthentication(HttpServletRequest request, HttpServletResponse response, String address) throws ServletException, IOException { - if (!request.getHeader("Authorization").isEmpty()) + String authHeader = request.getHeader("Authorization"); + if (authHeader != null && authHeader.length() > 0) authHandlerSend = true; return super.handleAuthentication(request,response,address); } From 0fa4fa9b23fe88b1327c3be65f3eed8db20ac680 Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Mon, 9 Jan 2012 14:57:21 -0600 Subject: [PATCH 32/34] clean up some warnings from maven --- jetty-http/pom.xml | 1 - jetty-io/pom.xml | 1 - jetty-osgi/jetty-osgi-boot-jsp/pom.xml | 1 - jetty-osgi/jetty-osgi-boot-logback/pom.xml | 1 - jetty-osgi/jetty-osgi-boot-warurl/pom.xml | 1 - jetty-osgi/jetty-osgi-httpservice/pom.xml | 1 - jetty-osgi/test-jetty-osgi/pom.xml | 1 - jetty-policy/pom.xml | 1 - test-jetty-webapp/pom.xml | 1 - 9 files changed, 9 deletions(-) diff --git a/jetty-http/pom.xml b/jetty-http/pom.xml index 53d5c6e9641..48de7f48335 100644 --- a/jetty-http/pom.xml +++ b/jetty-http/pom.xml @@ -5,7 +5,6 @@ 7.6.0-SNAPSHOT 4.0.0 - org.eclipse.jetty jetty-http Jetty :: Http Utility diff --git a/jetty-io/pom.xml b/jetty-io/pom.xml index 8a5f69852a6..548bab2f30a 100644 --- a/jetty-io/pom.xml +++ b/jetty-io/pom.xml @@ -5,7 +5,6 @@ 7.6.0-SNAPSHOT 4.0.0 - org.eclipse.jetty jetty-io Jetty :: IO Utility diff --git a/jetty-osgi/jetty-osgi-boot-jsp/pom.xml b/jetty-osgi/jetty-osgi-boot-jsp/pom.xml index 76e530cde78..aed5c0202e0 100644 --- a/jetty-osgi/jetty-osgi-boot-jsp/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-jsp/pom.xml @@ -6,7 +6,6 @@ ../pom.xml 4.0.0 - org.eclipse.jetty.osgi jetty-osgi-boot-jsp Jetty :: OSGi :: Boot JSP Jetty OSGi Boot JSP bundle diff --git a/jetty-osgi/jetty-osgi-boot-logback/pom.xml b/jetty-osgi/jetty-osgi-boot-logback/pom.xml index 595e77a4b24..98a73a0ce47 100644 --- a/jetty-osgi/jetty-osgi-boot-logback/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-logback/pom.xml @@ -6,7 +6,6 @@ ../pom.xml 4.0.0 - org.eclipse.jetty.osgi jetty-osgi-boot-logback Jetty :: OSGi :: Boot Logback Jetty OSGi Boot Logback bundle diff --git a/jetty-osgi/jetty-osgi-boot-warurl/pom.xml b/jetty-osgi/jetty-osgi-boot-warurl/pom.xml index a0463cc5643..24e2cc919fa 100644 --- a/jetty-osgi/jetty-osgi-boot-warurl/pom.xml +++ b/jetty-osgi/jetty-osgi-boot-warurl/pom.xml @@ -6,7 +6,6 @@ ../pom.xml 4.0.0 - org.eclipse.jetty.osgi jetty-osgi-boot-warurl Jetty :: OSGi :: Boot :: Warurl Jetty OSGi Boot-Warurl bundle diff --git a/jetty-osgi/jetty-osgi-httpservice/pom.xml b/jetty-osgi/jetty-osgi-httpservice/pom.xml index e389254295d..cb8f9d76281 100644 --- a/jetty-osgi/jetty-osgi-httpservice/pom.xml +++ b/jetty-osgi/jetty-osgi-httpservice/pom.xml @@ -6,7 +6,6 @@ ../pom.xml 4.0.0 - org.eclipse.jetty.osgi jetty-httpservice Jetty :: OSGi :: HttpService Jetty OSGi HttpService bundle diff --git a/jetty-osgi/test-jetty-osgi/pom.xml b/jetty-osgi/test-jetty-osgi/pom.xml index f0ae38a1230..f2a0795b5db 100644 --- a/jetty-osgi/test-jetty-osgi/pom.xml +++ b/jetty-osgi/test-jetty-osgi/pom.xml @@ -6,7 +6,6 @@ ../pom.xml 4.0.0 - org.eclipse.jetty.osgi test-jetty-osgi Jetty :: OSGi :: Test Jetty OSGi Integration test diff --git a/jetty-policy/pom.xml b/jetty-policy/pom.xml index 64548024678..192234b2626 100644 --- a/jetty-policy/pom.xml +++ b/jetty-policy/pom.xml @@ -5,7 +5,6 @@ jetty-project 7.6.0-SNAPSHOT - org.eclipse.jetty jetty-policy Jetty :: Policy Tool jar diff --git a/test-jetty-webapp/pom.xml b/test-jetty-webapp/pom.xml index 5c9fbf6c19b..4162b96e66e 100644 --- a/test-jetty-webapp/pom.xml +++ b/test-jetty-webapp/pom.xml @@ -5,7 +5,6 @@ 7.6.0-SNAPSHOT 4.0.0 - org.eclipse.jetty test-jetty-webapp Test :: Jetty Test Webapp war From e0f117f2a84a3fa6e7c0dae14c01136f7fb2f5de Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Mon, 9 Jan 2012 15:16:59 -0600 Subject: [PATCH 33/34] resolve another maven warning --- jetty-osgi/jetty-osgi-boot/pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/jetty-osgi/jetty-osgi-boot/pom.xml b/jetty-osgi/jetty-osgi-boot/pom.xml index 87a7087125d..43ce529208f 100644 --- a/jetty-osgi/jetty-osgi-boot/pom.xml +++ b/jetty-osgi/jetty-osgi-boot/pom.xml @@ -6,7 +6,6 @@ ../pom.xml 4.0.0 - org.eclipse.jetty.osgi jetty-osgi-boot Jetty :: OSGi :: Boot Jetty OSGi Boot bundle From 083c793b1c7f251fc67d464e9a2449530782e9d9 Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Mon, 9 Jan 2012 15:18:25 -0600 Subject: [PATCH 34/34] http-spi is 1.6 compiler required for the interface when its part of the jvm being used for environment --- jetty-http-spi/pom.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/jetty-http-spi/pom.xml b/jetty-http-spi/pom.xml index 856673b86eb..cf4900757c7 100644 --- a/jetty-http-spi/pom.xml +++ b/jetty-http-spi/pom.xml @@ -31,6 +31,14 @@ + + maven-compiler-plugin + + 1.6 + 1.6 + false + + org.apache.felix maven-bundle-plugin