Codebase list tomcat9 / 4924647
New upstream version 8.5.18 Emmanuel Bourg 6 years ago
81 changed file(s) with 796 addition(s) and 429 deletion(s). Raw diff Collapse all Expand all
2424 # ----- Version Control Flags -----
2525 version.major=8
2626 version.minor=5
27 version.build=17
27 version.build=18
2828 version.patch=0
2929 version.suffix=
3030
565565 <exclude name="test/webresources/**"/>
566566 <!-- Exclude test files with unusual encodings -->
567567 <exclude name="test/webapp/jsp/encoding/**"/>
568 <!-- Exclude developer specific local files -->
569 <exclude name="build.properties" />
570 <exclude name="res/maven/mvn.properties" />
568571 </fileset>
569572 <fileset dir="modules/jdbc-pool" >
570573 <exclude name=".*/**"/>
13271330 <fileset dir="test">
13281331 <include name="META-INF/**"/>
13291332 <include name="**/service-config.txt"/>
1333 <include name="**/logging-non-rotatable.properties"/>
13301334 </fileset>
13311335 </copy>
13321336 </target>
1111 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 # See the License for the specific language governing permissions and
1313 # limitations under the License.
14
1415 propertyNotFound = Propiedad [{1}] no hallada en el tipo [{0}]
1516 propertyNotReadable = Propiedad [{1}] no legible para el tipo [{0}]
1617 propertyNotWritable = Propiedad [{1}] no grabable para el tipo [{0}]
1111 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 # See the License for the specific language governing permissions and
1313 # limitations under the License.
14
1415 err.not_iso8859_1 = No es un car\u00E1cter ISO 8859-1: [{0}]
1516 value.true = true
1617 value.false = false
1111 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 # See the License for the specific language governing permissions and
1313 # limitations under the License.
14
1415 err.cookie_name_is_token = El nombre de Cookie [{0}] es una palabra reservada
1516 err.cookie_name_blank = El nombre del Cookie no puede ser nulo o de longitud cero
1617 err.io.negativelength = Longitud Negativa en el metodo write
1111 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 # See the License for the specific language governing permissions and
1313 # limitations under the License.
14
1415 authenticator.certificates = No hay cadena de certificados del cliente en esta petici\u00F3n
1516 authenticator.formlogin = Referencia directa al formulario de conexi\u00F3n (p\u00E1gina de formulario de login) inv\u00E1lida
1617 authenticator.loginFail = No pude ingresar
10541054 CharChunk cc = uri.getCharChunk();
10551055 cc.allocate(length, -1);
10561056
1057 String enc = connector.getURIEncoding();
1058 if (enc != null) {
1059 B2CConverter conv = request.getURIConverter();
1060 try {
1061 if (conv == null) {
1062 conv = new B2CConverter(B2CConverter.getCharset(enc), true);
1063 request.setURIConverter(conv);
1064 } else {
1065 conv.recycle();
1066 }
1067 } catch (IOException e) {
1068 log.error(sm.getString("coyoteAdapter.invalidEncoding"));
1069 connector.setURIEncoding(null);
1070 }
1071 if (conv != null) {
1072 try {
1073 conv.convert(bc, cc, true);
1074 uri.setChars(cc.getBuffer(), cc.getStart(), cc.getLength());
1075 return;
1076 } catch (IOException ioe) {
1077 // Should never happen as B2CConverter should replace
1078 // problematic characters
1079 request.getResponse().sendError(
1080 HttpServletResponse.SC_BAD_REQUEST);
1081 }
1082 }
1083 }
1084
1085 // Default encoding: fast conversion for ISO-8859-1
1086 byte[] bbuf = bc.getBuffer();
1087 char[] cbuf = cc.getBuffer();
1088 int start = bc.getStart();
1089 for (int i = 0; i < length; i++) {
1090 cbuf[i] = (char) (bbuf[i + start] & 0xff);
1091 }
1092 uri.setChars(cbuf, 0, length);
1057 Charset charset = connector.getURICharset();
1058
1059 B2CConverter conv = request.getURIConverter();
1060 if (conv == null) {
1061 conv = new B2CConverter(charset, true);
1062 request.setURIConverter(conv);
1063 } else {
1064 conv.recycle();
1065 }
1066
1067 try {
1068 conv.convert(bc, cc, true);
1069 uri.setChars(cc.getBuffer(), cc.getStart(), cc.getLength());
1070 } catch (IOException ioe) {
1071 // Should never happen as B2CConverter should replace
1072 // problematic characters
1073 request.getResponse().sendError(HttpServletResponse.SC_BAD_REQUEST);
1074 }
10931075 }
10941076
10951077
1111 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 # See the License for the specific language governing permissions and
1313 # limitations under the License.
14
1415 coyoteAdapter.accesslogFail=Exception while attempting to add an entry to the access log
1516 coyoteAdapter.asyncDispatch=Exception while processing an asynchronous request
1617 coyoteAdapter.authenticate=Authenticated user [{0}] provided by connector
1819 coyoteAdapter.checkRecycled.request=Encountered a non-recycled request and recycled it forcedly.
1920 coyoteAdapter.checkRecycled.response=Encountered a non-recycled response and recycled it forcedly.
2021 coyoteAdapter.debug=The variable [{0}] has value [{1}]
21 coyoteAdapter.invalidEncoding=Invalid URI encoding, using HTTP default
2222 coyoteAdapter.parsePathParam=Unable to parse the path parameters using encoding [{0}]. The path parameters in the URL will be ignored.
2323
2424 coyoteConnector.invalidEncoding=The encoding [{0}] is not recognised by the JRE. The Connector will continue to use [{1}]
983983 */
984984 @Override
985985 public String getCharacterEncoding() {
986 Charset charset = coyoteRequest.getCharset();
987 if (charset != null) {
988 return charset.name();
986 String characterEncoding = coyoteRequest.getCharacterEncoding();
987 if (characterEncoding != null) {
988 return characterEncoding;
989989 }
990990
991991 Context context = getContext();
998998
999999
10001000 private Charset getCharset() {
1001 Charset charset = coyoteRequest.getCharset();
1001 Charset charset = null;
1002 try {
1003 charset = coyoteRequest.getCharset();
1004 } catch (UnsupportedEncodingException e) {
1005 // Ignore
1006 }
10021007 if (charset != null) {
10031008 return charset;
10041009 }
29092914 partsParseException = e;
29102915 }
29112916 } finally {
2917 // This might look odd but is correct. setParseFailedReason() only
2918 // sets the failure reason if none is currently set. This code could
2919 // be more efficient but it is written this way to be robust with
2920 // respect to changes in the remainder of the method.
29122921 if (partsParseException != null || !success) {
29132922 parameters.setParseFailedReason(FailReason.UNKNOWN);
29142923 }
1111 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 # See the License for the specific language governing permissions and
1313 # limitations under the License.
14
1415 applicationContext.addFilter.ise = No se pueden a\u00F1adir filtros al contexto [{0}] ya que \u00E9ste ha sido inicializado
1516 applicationContext.addListener.iae.cnfe = No puedo crear una instancia del tipo [{0}]
1617 applicationContext.addListener.iae.wrongType = El tipo especificado [{0}] no es uno de los tipos de escuchador esperados
1111 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 # See the License for the specific language governing permissions and
1313 # limitations under the License.
14
1111 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 # See the License for the specific language governing permissions and
1313 # limitations under the License.
14
1415 namingResources.cleanupCloseFailed=Failed to invoke method [{0}] for resource [{1}] in container [{2}] so no cleanup was performed for that resource
1516 namingResources.cleanupCloseSecurity=Unable to retrieve method [{0}] for resource [{1}] in container [{2}] so no cleanup was performed for that resource
1617 namingResources.cleanupNoClose=Resource [{0}] in container [{1}] does not have a [{2}] method so no cleanup was performed for that resource
1111 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 # See the License for the specific language governing permissions and
1313 # limitations under the License.
14
1415 addDefaultCharset.unsupportedCharset = El conjunto especificado de caracteres [{0}] no se encuentra soportado
1516 csrfPrevention.invalidRandomClass = No pude crear fuente al azar usando la clase [{0}]
1617 filterbase.noSuchProperty = La propiedad [{0}] no est\u00E1 definida para los filtros del tipo [{1}]
1111 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 # See the License for the specific language governing permissions and
1313 # limitations under the License.
14
1415 deltaManager.createSession.newSession = Creada una DeltaSession con Id [{0}] Total contador=[{1}]
1516 deltaManager.createMessage.access = Gestor [{0}]: creado mensaje de sesi\u00F3n [{1}] acceso.
1617 deltaManager.createMessage.accessChangePrimary = Gestor [{0}]: creado mensaje de sesi\u00F3n [{1}] acceso para cambiar el primario.
1111 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 # See the License for the specific language governing permissions and
1313 # limitations under the License.
14
1415 webappClassLoader.illegalJarPath = Detectada entrada ilegal de JAR con nombre [{0}]
1516 webappClassLoader.jdbcRemoveFailed = Ha fallado el desregistro del conductor JDBC para la aplicaci\u00F3n web [{0}]
1617 webappClassLoader.stopped = Acceso ilegal: esta instancia de aplicaci\u00F3n web ya ha sido parada. Could not load [{0}]. La eventual traza de pila que sigue ha sido motivada por un error lanzado con motivos de depuraci\u00F3n as\u00ED como para intentar terminar el hilo que motiv\u00F3 el acceso ilegal y no tiene impacto funcional.
1111 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 # See the License for the specific language governing permissions and
1313 # limitations under the License.
14
1415 htmlManagerServlet.appsAvailable = Ejecut\u00E1ndose
1516 htmlManagerServlet.appsName = Nombre a Mostrar
1617 htmlManagerServlet.appsPath = Trayectoria
1111 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 # See the License for the specific language governing permissions and
1313 # limitations under the License.
14
1415 hostManagerServlet.alreadyStarted = FALLO - La m\u00E1qiuina [{0}] ya ha arrancado
1516 hostManagerServlet.alreadyStopped = FALLO - La m\u00E1quina [{0}] ya se ha parado
1617 hostManagerServlet.appBaseCreateFail = FALLO - No pude crear appBase [{0}] para la m\u00E1quina [{1}]
0 jaasRealm.beginLogin = JAASRealm login requerido para nombre de usuario [{0}] usando LoginContext para aplicaci\u00F3n [{1}]
10 # Licensed to the Apache Software Foundation (ASF) under one or more
21 # contributor license agreements. See the NOTICE file distributed with
32 # this work for additional information regarding copyright ownership.
1817 jaasRealm.accountExpired = El usuario [{0}] NO ha sido autentificado porque ha expirado su cuenta
1918 jaasRealm.authenticateFailure = Nombre de usuario [{0}] NO autenticado con \u00E9xito
2019 jaasRealm.authenticateSuccess = Nombre de usuario [{0}] autenticado con \u00E9xito como Principal [{1}] -- Tambi\u00E9n se ha creado el Asunto
20 jaasRealm.beginLogin = JAASRealm login requerido para nombre de usuario [{0}] usando LoginContext para aplicaci\u00F3n [{1}]
2121 jaasRealm.credentialExpired = El usuario [{0}] NO ha sido autentificado porque ha expirado su credencial
2222 jaasRealm.failedLogin = El usuario [{0}] NO ha sido autentificado porque ha fallado el login
2323 jaasRealm.loginException = Excepci\u00F3n de Login autenticando nombre de usuario [{0}]
1111 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 # See the License for the specific language governing permissions and
1313 # limitations under the License.
14
1415 SecurityUtil.doAsPrivilege = Ha tenido lugar una excepci\u00F3n al ejecutar el bloque PrivilegedExceptionAction.
1516 SecurityListener.checkUmaskFail = Intentado arranque con valor de umask de [{0}]. Ejecutando Tomcat sin umask al menos tan restrictivo como [{1}] ha sido bloqueado por el oyente de Ciclo de Vida org.apache.catalina.security.SecurityListener (normalmente configurado en CATALINA_BASE/conf/server.xml)
1617 SecurityListener.checkUmaskNone = No se ha hallado valor de umask en propiedad de sistema [{0}]. Si embargo, parece que Tomcat est\u00E1 siendo ejecutado en una plataforma que soporta umask. La propiedad del sistema se pone normalmente en CATALINA_HOME/bin/catalina.sh. El oyente de Ciclo de Vida org.apache.catalina.security.SecurityListener (normalmente configurado en CATALINA_BASE/conf/server.xml) espera un umask al menos tan restrictivo como [{1}]
968968 ranges = FULL;
969969 }
970970
971 String outputEncoding = response.getCharacterEncoding();
972 Charset charset = B2CConverter.getCharset(outputEncoding);
973 boolean conversionRequired;
974 if (!usingPrecompressedVersion && isText(contentType) &&
975 !charset.equals(fileEncodingCharset)) {
976 conversionRequired = true;
977 // Conversion often results fewer/more/different bytes.
978 // That does not play nicely with range requests.
979 ranges = FULL;
980 } else {
981 conversionRequired = false;
982 }
983
971984 if (resource.isDirectory() ||
972985 isError ||
973986 ( (ranges == null || ranges.isEmpty())
9871000 log("DefaultServlet.serveFile: contentLength=" +
9881001 contentLength);
9891002 // Don't set a content length if something else has already
990 // written to the response.
991 if (contentWritten == 0) {
1003 // written to the response or if conversion will be taking place
1004 if (contentWritten == 0 && !conversionRequired) {
9921005 response.setContentLengthLong(contentLength);
9931006 }
9941007 }
10161029 } else {
10171030 // Output is content of resource
10181031 // Check to see if conversion is required
1019 String outputEncoding = response.getCharacterEncoding();
1020 Charset charset = B2CConverter.getCharset(outputEncoding);
1021 if (!isText(contentType) || charset.equals(fileEncodingCharset)) {
1032 if (conversionRequired) {
1033 // A conversion is required from fileEncoding to
1034 // response encoding
1035 byte[] resourceBody = resource.getContent();
1036 InputStream source;
1037 if (resourceBody == null) {
1038 source = resource.getInputStream();
1039 } else {
1040 source = new ByteArrayInputStream(resourceBody);
1041 }
1042 OutputStreamWriter osw = new OutputStreamWriter(ostream, charset);
1043 PrintWriter pw = new PrintWriter(osw);
1044 copy(source, pw, fileEncoding);
1045 pw.flush();
1046 } else {
10221047 if (!checkSendfile(request, response, resource,
10231048 contentLength, null)) {
10241049 // sendfile not possible so check if resource
10331058 ostream.write(resourceBody);
10341059 }
10351060 }
1036 } else {
1037 // A conversion is required from fileEncoding to
1038 // response encoding
1039 byte[] resourceBody = resource.getContent();
1040 InputStream source;
1041 if (resourceBody == null) {
1042 source = resource.getInputStream();
1043 } else {
1044 source = new ByteArrayInputStream(resourceBody);
1045 }
1046 OutputStreamWriter osw = new OutputStreamWriter(ostream, charset);
1047 PrintWriter pw = new PrintWriter(osw);
1048 copy(source, pw, fileEncoding);
1049 pw.flush();
10501061 }
10511062 }
10521063 // If a stream was configured, it needs to be copied to
0 defaultServlet.missingResource = El recurso requerido [{0}] no se encuentra disponible
10 # Licensed to the Apache Software Foundation (ASF) under one or more
21 # contributor license agreements. See the NOTICE file distributed with
32 # this work for additional information regarding copyright ownership.
1211 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1312 # See the License for the specific language governing permissions and
1413 # limitations under the License.
14
15 defaultServlet.missingResource = El recurso requerido [{0}] no se encuentra disponible
1516 defaultservlet.skipfail = S\u00F3lo se han saltado [{0}] cuando se requirieron [{1}]
1617 webdavservlet.jaxpfailed = Fall\u00F3 la inicializaci\u00F3n de JAXP
1718 webdavservlet.enternalEntityIgnored = El requerimiento inclu\u00EDa una referencia a una entidad externa con PublicID [{0}] y SystemID [{1}] que fue ignorada
1111 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 # See the License for the specific language governing permissions and
1313 # limitations under the License.
14
1415 fileStore.saving = Salvando Sesi\u00F3n [{0}] en archivo [{1}]
1516 fileStore.loading = Cargando Sesi\u00F3n [{0}] desde archivo [{1}]
1617 fileStore.removing = Quitando Sesi\u00F3n [{0}] en archivo [{1}]
1717
1818
1919 import java.io.IOException;
20 import java.io.UnsupportedEncodingException;
2021 import java.net.URL;
2122 import java.net.URLConnection;
2223 import java.nio.charset.Charset;
250251 // Get encoding settings from request / connector if
251252 // possible
252253 if (req instanceof Request) {
253 requestCharset = ((Request)req).getCoyoteRequest().getCharset();
254 try {
255 requestCharset = ((Request)req).getCoyoteRequest().getCharset();
256 } catch (UnsupportedEncodingException e) {
257 // Ignore
258 }
254259 Connector connector = ((Request)req).getConnector();
255260 uriCharset = connector.getURICharset();
256261 useBodyEncodingForURI = connector.getUseBodyEncodingForURI();
1111 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 # See the License for the specific language governing permissions and
1313 # limitations under the License.
14
1415 catalina.configFail = No pude cargar la configuraci\u00F3n del servidor desde [{0}]
1516 catalina.shutdownHookFail = El gancho de apagado ha experimentado un error al intentar para el servidor
1617 catalina.stopServer = No se ha configurado puerto de apagado. Apagando el servidor a trav\u00E9s de se\u00F1al de SO. Servidor no apagado.
5959 // create registry
6060 registry = new JmxRegistry();
6161 registry.baseOname = baseOn;
62 registryCache.putIfAbsent(channel.getName(), registry);
62 // It doesn't matter if existing object gets over-written. This object
63 // holds minimal state and that state will be the same for all objects
64 // created for the same channel.
65 registryCache.put(channel.getName(), registry);
6366 return registry;
6467 }
6568
1111 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 # See the License for the specific language governing permissions and
1313 # limitations under the License.
14
1415 bioSender.ack.eof = EOF alcanzado en puerto local [{0}:{1,number,integer}]
1516 bioSender.ack.missing = No puedo leer reconocimiento desde [{0}:{1,number,integer}] en {2,number,integer} ms. Desconectando conector e intentando otra vez.
1617 bioSender.ack.wrong = Falta ACK correcto tras 10 bytes le\u00EDdos en puerto local [{0}:{1,number,integer}]
1111 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 # See the License for the specific language governing permissions and
1313 # limitations under the License.
14
1415 memoryUserDatabase.notPersistable = La base de datos de usuario no es persistible - no hay permisos de grabaci\u00F3n sobre el directorio
1516 memoryUserDatabase.nullGroup = Se ha especificado un nombre de grupo nulo o de tama\u00F1o cero. Se ignora el grupo.
1617 memoryUserDatabase.nullRole = Se ha especificado un nombre rol nulo o de tama\u00F1o cero. Se ignora el rol.
1111 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 # See the License for the specific language governing permissions and
1313 # limitations under the License.
14
1415 parameterMap.locked = No se permiten modificaciones en un ParameterMap bloqueado
1516 resourceSet.locked = No se permiten modificaciones en un ResourceSet bloqueado
1617 hexUtil.bad = D\u00EDgito hexadecimal incorrecto
1111 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 # See the License for the specific language governing permissions and
1313 # limitations under the License.
14
1415 jdbcAccessLogValve.exception = Excepci\u00F3n realizando entrada de acceso a inserci\u00F3n
1516 accessLogValve.closeFail = No pude cerrar fichero de historial
1617 accessLogValve.openDirFail = No pude crear directorio [{0}] para historiales de acceso
1111 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 # See the License for the specific language governing permissions and
1313 # limitations under the License.
14
1415 abstractConnectionHandler.connectionsGet=Found processor [{0}] for socket [{1}]
1516 abstractConnectionHandler.error=Error reading request, ignored
1617 abstractConnectionHandler.ioexception.debug=IOExceptions are normal, ignored
130130 private long contentLength = -1;
131131 private MessageBytes contentTypeMB = null;
132132 private Charset charset = null;
133 // Retain the original, user specified character encoding so it can be
134 // returned even if it is invalid
135 private String characterEncoding = null;
136
133137 /**
134138 * Is there an expectation ?
135139 */
287291 * @return The value set via {@link #setCharacterEncoding(String)} or if no
288292 * call has been made to that method try to obtain if from the
289293 * content type.
290 *
291 * @deprecated This method will be removed in Tomcat 9.0.x
292 */
293 @Deprecated
294 */
294295 public String getCharacterEncoding() {
295 Charset charset = getCharset();
296 if (charset == null) {
297 return null;
298 }
299 return charset.name();
296 if (characterEncoding == null) {
297 characterEncoding = getCharsetFromContentType(getContentType());
298 }
299
300 return characterEncoding;
300301 }
301302
302303
306307 * @return The value set via {@link #setCharacterEncoding(String)} or if no
307308 * call has been made to that method try to obtain if from the
308309 * content type.
309 */
310 public Charset getCharset() {
311 if (charset != null) {
312 return charset;
313 }
314
315 charset = getCharsetFromContentType(getContentType());
310 *
311 * @throws UnsupportedEncodingException If the user agent has specified an
312 * invalid character encoding
313 */
314 public Charset getCharset() throws UnsupportedEncodingException {
315 if (charset == null) {
316 getCharacterEncoding();
317 if (characterEncoding != null) {
318 charset = B2CConverter.getCharset(characterEncoding);
319 }
320 }
316321
317322 return charset;
318323 }
333338
334339 public void setCharset(Charset charset) {
335340 this.charset = charset;
336 }
341 this.characterEncoding = charset.name();
342 }
343
337344
338345 public void setContentLength(long len) {
339346 this.contentLength = len;
633640 contentLength = -1;
634641 contentTypeMB = null;
635642 charset = null;
643 characterEncoding = null;
636644 expectation = false;
637645 headers.recycle();
638646 serverNameMB.recycle();
693701 *
694702 * @param contentType a content type header
695703 */
696 private static Charset getCharsetFromContentType(String contentType) {
704 private static String getCharsetFromContentType(String contentType) {
697705
698706 if (contentType == null) {
699707 return null;
713721 encoding = encoding.substring(1, encoding.length() - 1);
714722 }
715723
716 Charset result = null;
717
718 try {
719 result = B2CConverter.getCharset(encoding.trim());
720 } catch (UnsupportedEncodingException e) {
721 // Ignore
722 }
723
724 return result;
725 }
726
724 return encoding.trim();
725 }
727726 }
1111 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 # See the License for the specific language governing permissions and
1313 # limitations under the License.
14
1415 ajpprotocol.noBio=The AJP BIO connector has been removed in Tomcat 8.5.x onwards. The AJP BIO connector configuration has been automatically switched to use the AJP NIO connector instead.
1516 ajpprotocol.noSSL=SSL is not supported with AJP. The SSL host configuration for [{0}] was ignored
1617 ajpprotocol.noUpgrade=Upgrade is not supported with AJP. The UpgradeProtocol configuration for [{0}] was ignored
1111 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 # See the License for the specific language governing permissions and
1313 # limitations under the License.
14
1415 ajpprotocol.proto.error = Error leyendo requerimiento, ignorado
1516 ajpprocessor.failedread = Fallo en lectura de Conector
1617 ajpprocessor.failedsend = No pude enviar mensaje AJP
1111 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 # See the License for the specific language governing permissions and
1313 # limitations under the License.
14
1415 http11processor.header.parse = Error analizando cabecera de requerimiento HTTP
1516 http11processor.neverused = Este m\u00E9todo no deber\u00EDa de usarse nunca
1617 http11processor.request.prepare = Error preparando requerimiento
3333 public void validateHeaders() throws StreamException {
3434 // NO-OP
3535 }
36
37 @Override
38 public void setHeaderException(StreamException streamException) {
39 // NO-OP
40 // The connection is already closing so no need to process additional
41 // errors
42 }
3643 }
355355 void emitHeader(String name, String value) throws HpackException;
356356
357357 /**
358 * Inform the recipient of the headers that a stream error needs to be
359 * triggered using the given message when {@link #validateHeaders()} is
360 * called. This is used when the Parser becomes aware of an error that
361 * is not visible to the recipient.
362 *
363 * @param streamException The exception to use when resetting the stream
364 */
365 void setHeaderException(StreamException streamException);
366
367 /**
358368 * Are the headers pass to the recipient so far valid? The decoder needs
359369 * to process all the headers to maintain state even if there is a
360370 * problem. In addition, it is easy for the the intended recipient to
4444 ByteBuffer.allocate(Constants.DEFAULT_HEADER_READ_BUFFER_SIZE);
4545 private volatile int headersCurrentStream = -1;
4646 private volatile boolean headersEndStream = false;
47 private volatile boolean streamReset = false;
4847
4948 Http2Parser(String connectionId, Input input, Output output) {
5049 this.connectionId = connectionId;
378377 readHeaderPayload(streamId, payloadSize);
379378
380379 if (Flags.isEndOfHeaders(flags)) {
380 headersCurrentStream = -1;
381381 onHeadersComplete(streamId);
382 headersCurrentStream = -1;
383382 }
384383 }
385384
426425 headerReadBuffer.compact();
427426 remaining -= toRead;
428427
429 if (hpackDecoder.isHeaderCountExceeded() && !streamReset) {
430 streamReset = true;
431 throw new StreamException(sm.getString("http2Parser.headerLimitCount", connectionId,
432 Integer.valueOf(streamId)), Http2Error.ENHANCE_YOUR_CALM, streamId);
433 }
434
435 if (hpackDecoder.isHeaderSizeExceeded(headerReadBuffer.position()) && !streamReset) {
436 streamReset = true;
437 throw new StreamException(sm.getString("http2Parser.headerLimitSize", connectionId,
438 Integer.valueOf(streamId)), Http2Error.ENHANCE_YOUR_CALM, streamId);
428 if (hpackDecoder.isHeaderCountExceeded()) {
429 StreamException headerException = new StreamException(sm.getString(
430 "http2Parser.headerLimitCount", connectionId, Integer.valueOf(streamId)),
431 Http2Error.ENHANCE_YOUR_CALM, streamId);
432 hpackDecoder.getHeaderEmitter().setHeaderException(headerException);
433 }
434
435 if (hpackDecoder.isHeaderSizeExceeded(headerReadBuffer.position())) {
436 StreamException headerException = new StreamException(sm.getString(
437 "http2Parser.headerLimitSize", connectionId, Integer.valueOf(streamId)),
438 Http2Error.ENHANCE_YOUR_CALM, streamId);
439 hpackDecoder.getHeaderEmitter().setHeaderException(headerException);
439440 }
440441
441442 if (hpackDecoder.isHeaderSwallowSizeExceeded(headerReadBuffer.position())) {
443444 connectionId, Integer.valueOf(streamId)), Http2Error.ENHANCE_YOUR_CALM);
444445 }
445446 }
446
447 hpackDecoder.getHeaderEmitter().validateHeaders();
448447 }
449448
450449
456455 Http2Error.COMPRESSION_ERROR);
457456 }
458457
458 // Delay validation (and triggering any exception) until this point
459 // since all the headers still have to be read if a StreamException is
460 // going to be thrown.
461 hpackDecoder.getHeaderEmitter().validateHeaders();
462
459463 output.headersEnd(streamId);
460464
461465 if (headersEndStream) {
466470 // Reset size for new request if the buffer was previously expanded
467471 if (headerReadBuffer.capacity() > Constants.DEFAULT_HEADER_READ_BUFFER_SIZE) {
468472 headerReadBuffer = ByteBuffer.allocate(Constants.DEFAULT_HEADER_READ_BUFFER_SIZE);
469 }
470
471 // Clear the 'stream has been reset' flag, if set
472 if (streamReset) {
473 streamReset = false;
474473 }
475474 }
476475
6060 private final StreamStateMachine state;
6161 // State machine would be too much overhead
6262 private int headerState = HEADER_STATE_START;
63 private String headerStateErrorMsg = null;
63 private StreamException headerException = null;
6464 // TODO: null these when finished to reduce memory used by closed stream
6565 private final Request coyoteRequest;
6666 private StringBuilder cookieHeader = null;
259259 }
260260 }
261261
262 if (headerStateErrorMsg != null) {
262 if (headerException != null) {
263263 // Don't bother processing the header since the stream is going to
264264 // be reset anyway
265265 return;
268268 boolean pseudoHeader = name.charAt(0) == ':';
269269
270270 if (pseudoHeader && headerState != HEADER_STATE_PSEUDO) {
271 headerStateErrorMsg = sm.getString("stream.header.unexpectedPseudoHeader",
272 getConnectionId(), getIdentifier(), name);
271 headerException = new StreamException(sm.getString(
272 "stream.header.unexpectedPseudoHeader", getConnectionId(), getIdentifier(),
273 name), Http2Error.PROTOCOL_ERROR, getIdentifier().intValue());
273274 // No need for further processing. The stream will be reset.
274275 return;
275276 }
355356 coyoteRequest.setExpectation(true);
356357 }
357358 if (pseudoHeader) {
358 headerStateErrorMsg = sm.getString("stream.header.unknownPseudoHeader",
359 getConnectionId(), getIdentifier(), name);
359 headerException = new StreamException(sm.getString(
360 "stream.header.unknownPseudoHeader", getConnectionId(), getIdentifier(),
361 name), Http2Error.PROTOCOL_ERROR, getIdentifier().intValue());
360362 }
361363 // Assume other HTTP header
362364 coyoteRequest.getMimeHeaders().addValue(name).setString(value);
366368
367369
368370 @Override
371 public void setHeaderException(StreamException streamException) {
372 if (headerException == null) {
373 headerException = streamException;
374 }
375 }
376
377
378 @Override
369379 public void validateHeaders() throws StreamException {
370 if (headerStateErrorMsg == null) {
380 if (headerException == null) {
371381 return;
372382 }
373383
374 throw new StreamException(headerStateErrorMsg, Http2Error.PROTOCOL_ERROR,
375 getIdentifier().intValue());
384 throw headerException;
376385 }
377386
378387
1111 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 # See the License for the specific language governing permissions and
1313 # limitations under the License.
14
1415 error.convert = No puedo convertir [{0}] desde tipo [{1}] a [{2}]
1516 error.compare = No puedo comparar [{0}] con [{1}]
1617 error.function = Problemas llamando a funci\u00F3n [{0}]
204204 protected boolean failOnError = true;
205205
206206 /**
207 * Should a separate process be forked to perform the compilation?
208 */
209 private boolean fork = false;
210
211 /**
207212 * The file extensions to be handled as JSP files.
208213 * Default list is .jsp and .jspx.
209214 */
781786 */
782787 @Override
783788 public boolean getFork() {
784 return false;
789 return fork;
790 }
791
792 public void setFork(boolean fork) {
793 this.fork = fork;
785794 }
786795
787796 /**
388388 if (suffix == null) {
389389 suffix = getProperty(className + ".suffix", ".log");
390390 }
391
392 // https://bz.apache.org/bugzilla/show_bug.cgi?id=61232
393 boolean shouldCheckForRedundantSeparator = !rotatable && !prefix.isEmpty()
394 && !suffix.isEmpty();
395 // assuming separator is just one char, if there are use cases with
396 // more, the notion of separator might be introduced
397 if (shouldCheckForRedundantSeparator
398 && (prefix.charAt(prefix.length() - 1) == suffix.charAt(0))) {
399 suffix = suffix.substring(1);
400 }
401
391402 pattern = Pattern.compile("^(" + Pattern.quote(prefix) + ")\\d{4}-\\d{1,2}-\\d{1,2}("
392403 + Pattern.quote(suffix) + ")$");
393404 String sMaxDays = getProperty(className + ".maxDays", String.valueOf(DEFAULT_MAX_DAYS));
560571 }
561572
562573 private String obtainDateFromPath(Path path) {
563 String date = path.getFileName().toString();
574 Path fileName = path.getFileName();
575 if (fileName == null) {
576 return null;
577 }
578 String date = fileName.toString();
564579 if (pattern.matcher(date).matches()) {
565580 date = date.substring(prefix.length());
566581 return date.substring(0, date.length() - suffix.length());
1111 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 # See the License for the specific language governing permissions and
1313 # limitations under the License.
14
1415 filterDef.invalidFilterName=Invalid <filter-name> [{0}] in filter definition.
1516
1617 securityConstraint.uncoveredHttpMethod=For security constraints with URL pattern [{0}] only the HTTP methods [{1}] are covered. All other methods are uncovered.
1111 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 # See the License for the specific language governing permissions and
1313 # limitations under the License.
14 #
1415 # HttpMessages. The values in this file will be used in HTTP headers and as such
1516 # may only contain TEXT as defined by RFC 2616
1617 sc.100 = Continuar
1111 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 # See the License for the specific language governing permissions and
1313 # limitations under the License.
14 #
1415 # net resources
1516 endpoint.err.handshake = Acuerdo fallido
1617 endpoint.err.unexpected = Error inesperado al procesar conector
3131 * authenticate itself to SSL clients.
3232 *
3333 * @author Jan Luehe
34 *
35 * @deprecated Unused. This class will be removed in Tomcat 9.
3436 */
37 @Deprecated
3538 public final class JSSEKeyManager extends X509ExtendedKeyManager {
3639
3740 private X509KeyManager delegate;
5151 import javax.net.ssl.SSLSessionContext;
5252 import javax.net.ssl.TrustManager;
5353 import javax.net.ssl.TrustManagerFactory;
54 import javax.net.ssl.X509KeyManager;
5554
5655 import org.apache.juli.logging.Log;
5756 import org.apache.juli.logging.LogFactory;
170169
171170 @Override
172171 public KeyManager[] getKeyManagers() throws Exception {
173 String keystoreType = certificate.getCertificateKeystoreType();
174172 String keyAlias = certificate.getCertificateKeyAlias();
175173 String algorithm = sslHostConfig.getKeyManagerAlgorithm();
176174 String keyPass = certificate.getCertificateKeyPassword();
180178 keyPass = certificate.getCertificateKeystorePassword();
181179 }
182180
183 KeyManager[] kms = null;
184
185181 KeyStore ks = certificate.getCertificateKeystore();
186182
183 /*
184 * Always use an in memory key store.
185 * For PEM format keys and certificates, it allows them to be imported
186 * into the expected format.
187 * For Java key stores, it enables Tomcat to handle the case where
188 * multiple keys exist in the key store, each with a different password.
189 * The KeyManagerFactory can't handle that so using an in memory key
190 * store with just the required key works around that.
191 */
192 KeyStore inMemoryKeyStore = KeyStore.getInstance("JKS");
193 inMemoryKeyStore.load(null, null);
194
195 char[] keyPassArray = keyPass.toCharArray();
196
187197 if (ks == null) {
188 // create an in-memory keystore and import the private key
189 // and the certificate chain from the PEM files
190 ks = KeyStore.getInstance("JKS");
191 ks.load(null, null);
192
193198 PEMFile privateKeyFile = new PEMFile(SSLHostConfig.adjustRelativePath
194199 (certificate.getCertificateKeyFile() != null ? certificate.getCertificateKeyFile() : certificate.getCertificateFile()),
195200 keyPass);
205210 if (keyAlias == null) {
206211 keyAlias = "tomcat";
207212 }
208 ks.setKeyEntry(keyAlias, privateKeyFile.getPrivateKey(), keyPass.toCharArray(), chain.toArray(new Certificate[chain.size()]));
209 }
210
211 if (keyAlias != null && !ks.isKeyEntry(keyAlias)) {
212 throw new IOException(sm.getString("jsse.alias_no_key_entry", keyAlias));
213 }
213 inMemoryKeyStore.setKeyEntry(keyAlias, privateKeyFile.getPrivateKey(), keyPass.toCharArray(), chain.toArray(new Certificate[chain.size()]));
214 } else {
215 if (keyAlias != null && !ks.isKeyEntry(keyAlias)) {
216 throw new IOException(sm.getString("jsse.alias_no_key_entry", keyAlias));
217 } else if (keyAlias == null) {
218 Enumeration<String> aliases = ks.aliases();
219 if (!aliases.hasMoreElements()) {
220 throw new IOException(sm.getString("jsse.noKeys"));
221 }
222 keyAlias = aliases.nextElement();
223 }
224
225 inMemoryKeyStore.setKeyEntry(keyAlias, ks.getKey(keyAlias, keyPassArray), keyPassArray,
226 ks.getCertificateChain(keyAlias));
227 }
228
214229
215230 KeyManagerFactory kmf = KeyManagerFactory.getInstance(algorithm);
216 kmf.init(ks, keyPass.toCharArray());
217
218 kms = kmf.getKeyManagers();
219 if (kms == null) {
220 return kms;
221 }
222
223 if (keyAlias != null) {
224 String alias = keyAlias;
225 // JKS keystores always convert the alias name to lower case
226 if ("JKS".equals(keystoreType)) {
227 alias = alias.toLowerCase(Locale.ENGLISH);
228 }
229 for(int i = 0; i < kms.length; i++) {
230 kms[i] = new JSSEKeyManager((X509KeyManager)kms[i], alias);
231 }
232 }
233
234 return kms;
231 kmf.init(inMemoryKeyStore, keyPassArray);
232
233 return kmf.getKeyManagers();
235234 }
236235
237236
2121 jsse.excludeProtocol=The SSL protocol [{0}] which is supported in this JRE was excluded from the protocols available to Tomcat
2222 jsse.noDefaultCiphers=Unable to determine a default for ciphers for [{0}]. Set an explicit value to ensure the connector can start.
2323 jsse.noDefaultProtocols=Unable to determine a default for sslEnabledProtocols. Set an explicit value to ensure the connector can start.
24 jsse.noKeys=No aliases for private keys found in key store
2425 jsse.exceptionOnClose=Failure to close socket.
2526 jsse.pemParseError=Unable to parse the key from [{0}]
2627
1111 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 # See the License for the specific language governing permissions and
1313 # limitations under the License.
14
1415 jsse.alias_no_key_entry = El nombre de Alias [{0}] no identifica una entrada de clave
1516 jsse.invalid_ssl_conf = La configuraci\u00F3n SSL no es v\u00E1lida debido a [{0}]
1617 jsse.invalidTrustManagerClassName = El trustManagerClassName suministrado [{0}] no implementa javax.net.ssl.TrustManager
4949 import org.apache.tomcat.util.net.SSLHostConfig;
5050 import org.apache.tomcat.util.net.SSLHostConfigCertificate;
5151 import org.apache.tomcat.util.net.SSLHostConfigCertificate.Type;
52 import org.apache.tomcat.util.net.jsse.JSSEKeyManager;
5352 import org.apache.tomcat.util.net.openssl.ciphers.OpenSSLCipherConfigurationParser;
5453 import org.apache.tomcat.util.res.StringManager;
5554
373372
374373 private static X509KeyManager chooseKeyManager(KeyManager[] managers) throws Exception {
375374 for (KeyManager manager : managers) {
376 if (manager instanceof JSSEKeyManager) {
377 return (JSSEKeyManager) manager;
378 }
379 }
380 for (KeyManager manager : managers) {
381375 if (manager instanceof X509KeyManager) {
382376 return (X509KeyManager) manager;
383377 }
676676 }
677677
678678 @Override
679 public String[] getEnabledCipherSuites() {
679 public synchronized String[] getEnabledCipherSuites() {
680 if (destroyed) {
681 return new String[0];
682 }
680683 String[] enabled = SSL.getCiphers(ssl);
681684 if (enabled == null) {
682685 return new String[0];
692695 }
693696
694697 @Override
695 public void setEnabledCipherSuites(String[] cipherSuites) {
698 public synchronized void setEnabledCipherSuites(String[] cipherSuites) {
696699 if (cipherSuites == null) {
697700 throw new IllegalArgumentException(sm.getString("engine.nullCipherSuite"));
701 }
702 if (destroyed) {
703 return;
698704 }
699705 final StringBuilder buf = new StringBuilder();
700706 for (String cipherSuite : cipherSuites) {
732738 }
733739
734740 @Override
735 public String[] getEnabledProtocols() {
741 public synchronized String[] getEnabledProtocols() {
742 if (destroyed) {
743 return new String[0];
744 }
736745 List<String> enabled = new ArrayList<>();
737746 // Seems like there is no way to explicitly disable SSLv2Hello in OpenSSL so it is always enabled
738747 enabled.add(Constants.SSL_PROTO_SSLv2Hello);
761770 }
762771
763772 @Override
764 public void setEnabledProtocols(String[] protocols) {
773 public synchronized void setEnabledProtocols(String[] protocols) {
765774 if (protocols == null) {
766775 // This is correct from the API docs
767776 throw new IllegalArgumentException();
777 }
778 if (destroyed) {
779 return;
768780 }
769781 boolean sslv2 = false;
770782 boolean sslv3 = false;
12511263
12521264 @Override
12531265 public String getCipherSuite() {
1254 if (!handshakeFinished) {
1255 return INVALID_CIPHER;
1256 }
12571266 if (cipher == null) {
12581267 String ciphers;
12591268 synchronized (OpenSSLEngine.this) {
1269 if (!handshakeFinished) {
1270 return INVALID_CIPHER;
1271 }
12601272 if (destroyed) {
12611273 return INVALID_CIPHER;
12621274 }
1111 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 # See the License for the specific language governing permissions and
1313 # limitations under the License.
14
1415 threadPoolExecutor.threadStoppedToAvoidPotentialLeak = Parando hilo [{0}] para evita fallos potenciales de memoria tras haberse parado un contexto.
1111 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 # See the License for the specific language governing permissions and
1313 # limitations under the License.
14
1415 serverContainer.addNotAllowed=No further Endpoints may be registered once an attempt has been made to use one of the previously registered endpoints
1516 serverContainer.configuratorFail=Failed to create configurator of type [{0}] for POJO of type [{1}]
1617 serverContainer.duplicatePaths=Multiple Endpoints may not be deployed to the same path [{0}] : existing endpoint was [{1}] and new endpoint is [{2}]
3030 <module name="RegexpHeader">
3131 <property name="headerFile" value="${basedir}/res/checkstyle/header-al2.txt"/>
3232 <property name="multiLines" value="1, 2, 3, 4"/>
33 <property name="fileExtensions" value="java,xml,jsp,txt,sh,bat"/>
33 <property name="fileExtensions" value="java,xml,jsp,txt,sh,bat,properties"/>
3434 </module>
3535
3636 <!-- Whitespace -->
3838 maven.asf.release.repo.repositoryId=apache.releases.https
3939
4040 # Release version info
41 maven.asf.release.deploy.version=8.5.17
41 maven.asf.release.deploy.version=8.5.18
4242
4343 #Where do we load the libraries from
4444 tomcat.lib.path=../../output/build/lib
4242 !include "StrFunc.nsh"
4343 !include "LogicLib.nsh"
4444 !include "FileFunc.nsh"
45 !include "TextFunc.nsh"
4546 ${StrRep}
4647
4748 Var JavaHome
358359
359360 SectionEnd
360361
362 !define ReadFromConfigIni "!insertmacro ReadFromConfigIni"
363 !macro ReadFromConfigIni Return_Variable Key_Name Config_File
364 Push "${Config_File}"
365 Push "${Return_Variable}"
366 Push "${Key_Name}"
367 Call ReadFromConfigIni
368 IfErrors +2
369 StrCpy ${Return_Variable} $1
370 !macroend
371
372 Function ReadFromConfigIni
373 ClearErrors
374 ; Stack: <Key_Name> <Return_Variable> <Config_File>
375 Pop $0 ; <Key_Name> Stack: <Return_Variable> <Config_File>
376 Pop $1 ; <Return_Variable> Stack: <Config_File>
377 Pop $2 ; <Config_File> Stack: -empty-
378
379 ${ConfigRead} $2 '$0=' $1 ; <Config_File> <Key_Name> <Return_Variable>
380 FunctionEnd
381
361382 Function .onInit
362383 !ifdef UNINSTALLONLY
363384 ; If UNINSTALLONLY is defined, then we aren't supposed to do anything except write out
374395 ${IfNot} ${Errors}
375396 MessageBox MB_OK|MB_ICONINFORMATION 'Available options:$\r$\n\
376397 /S - Silent install.$\r$\n\
398 /C=config.ini - specify full path of config file to override default values.$\r$\n\
377399 /D=INSTDIR - Specify installation directory.'
378400 Abort
379401 ${EndIf}
396418 StrCpy $TomcatAdminUsername ""
397419 StrCpy $TomcatAdminPassword ""
398420 StrCpy $TomcatAdminRoles ""
421
422 ;override default values in case config file was passed in
423 ${GetOptions} "$R0" "/C=" $R2
424 ${IfNot} ${Errors}
425 ${ReadFromConfigIni} $JavaHome "JavaHome" $R2
426 ${ReadFromConfigIni} $TomcatPortShutdown "TomcatPortShutdown" $R2
427 ${ReadFromConfigIni} $TomcatPortHttp "TomcatPortHttp" $R2
428 ${ReadFromConfigIni} $TomcatPortAjp "TomcatPortAjp" $R2
429 ${ReadFromConfigIni} $TomcatMenuEntriesEnable "TomcatMenuEntriesEnable" $R2
430 ${ReadFromConfigIni} $TomcatShortcutAllUsers "TomcatShortcutAllUsers" $R2
431 ${ReadFromConfigIni} $TomcatServiceDefaultName "TomcatServiceDefaultName" $R2
432 ${ReadFromConfigIni} $TomcatServiceName "TomcatServiceName" $R2
433 ${ReadFromConfigIni} $TomcatServiceFileName "TomcatServiceFileName" $R2
434 ${ReadFromConfigIni} $TomcatServiceManagerFileName "TomcatServiceManagerFileName" $R2
435 ${ReadFromConfigIni} $TomcatAdminEnable "TomcatAdminEnable" $R2
436 ${ReadFromConfigIni} $TomcatAdminUsername "TomcatAdminUsername" $R2
437 ${ReadFromConfigIni} $TomcatAdminPassword "TomcatAdminPassword" $R2
438 ${ReadFromConfigIni} $TomcatAdminRoles "TomcatAdminRoles" $R2
439 ${EndIf}
440 ClearErrors
441
399442 FunctionEnd
400443
401444 Function pageChooseJVM
879922 IfFileExists "$2" FoundJvmDll
880923
881924 ClearErrors
882 ;Step tree: Read defaults from registry
925 ;Step three: Read defaults from registry
883926
884927 ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" "CurrentVersion"
885928 ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment\$1" "RuntimeLib"
2424 import java.net.HttpURLConnection;
2525 import java.net.URL;
2626 import java.util.ArrayList;
27 import java.util.Arrays;
2728 import java.util.Enumeration;
29 import java.util.HashMap;
2830 import java.util.List;
2931 import java.util.Locale;
32 import java.util.Map;
3033 import java.util.TreeMap;
3134
3235 import javax.servlet.ServletException;
902905
903906 System.out.println(time);
904907 }
908
909
910 @Test
911 public void testGetReaderValidEncoding() throws Exception {
912 doTestGetReader("ISO-8859-1", true);
913 }
914
915
916 @Test
917 public void testGetReaderInvalidEbcoding() throws Exception {
918 doTestGetReader("X-Invalid", false);
919 }
920
921
922 private void doTestGetReader(String userAgentCharaceterEncoding, boolean expect200)
923 throws Exception {
924
925 // Setup Tomcat instance
926 Tomcat tomcat = getTomcatInstance();
927
928 // No file system docBase required
929 Context ctx = tomcat.addContext("", null);
930
931 Tomcat.addServlet(ctx, "servlet", new Bug61264GetReaderServlet());
932 ctx.addServletMappingDecoded("/", "servlet");
933
934 tomcat.start();
935
936 byte[] body = "Test".getBytes();
937 ByteChunk bc = new ByteChunk();
938 Map<String,List<String>> reqHeaders = new HashMap<>();
939 reqHeaders.put("Content-Type",
940 Arrays.asList(new String[] {"text/plain;charset=" + userAgentCharaceterEncoding}));
941
942 int rc = postUrl(body, "http://localhost:" + getPort() + "/", bc, reqHeaders, null);
943
944 if (expect200) {
945 assertEquals(200, rc);
946 } else {
947 assertEquals(500, rc);
948 }
949 }
950
951
952 private class Bug61264GetReaderServlet extends HttpServlet {
953
954 private static final long serialVersionUID = 1L;
955
956 @Override
957 protected void doGet(HttpServletRequest req, HttpServletResponse resp)
958 throws ServletException, IOException {
959 // This is intended for POST requests
960 resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
961 }
962
963 @Override
964 protected void doPost(HttpServletRequest req, HttpServletResponse resp)
965 throws ServletException, IOException {
966 // Container will handle any errors
967 req.getReader();
968 }
969 }
905970 }
26012601 }
26022602
26032603
2604 @Override
26042605 @Before
2605 public void setup() {
2606 public void setUp() throws Exception {
2607 super.setUp();
26062608 // Required by testBug61185()
26072609 // Does not impact other tests in this class
26082610 System.setProperty("org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH", "true");
5353 import org.apache.catalina.startup.TomcatBaseTest;
5454 import org.apache.tomcat.util.buf.B2CConverter;
5555 import org.apache.tomcat.util.buf.ByteChunk;
56 import org.apache.tomcat.util.descriptor.web.ErrorPage;
5657 import org.apache.tomcat.util.http.parser.MediaType;
5758 import org.apache.tomcat.websocket.server.WsContextListener;
5859
119120 Wrapper defaultServlet = Tomcat.addServlet(ctxt, "default",
120121 "org.apache.catalina.servlets.DefaultServlet");
121122 defaultServlet.addInitParameter("gzip", "true");
123 defaultServlet.addInitParameter("fileEncoding", "ISO-8859-1");
122124 ctxt.addServletMappingDecoded("/", "default");
123125
124126 ctxt.addMimeMapping("html", "text/html");
174176 Wrapper defaultServlet = Tomcat.addServlet(ctxt, "default",
175177 "org.apache.catalina.servlets.DefaultServlet");
176178 defaultServlet.addInitParameter("precompressed", "true");
179 defaultServlet.addInitParameter("fileEncoding", "ISO-8859-1");
177180
178181 ctxt.addServletMappingDecoded("/", "default");
179182 ctxt.addMimeMapping("html", "text/html");
284287 Wrapper defaultServlet = Tomcat.addServlet(ctxt, "default",
285288 DefaultServlet.class.getName());
286289 defaultServlet.addInitParameter("precompressed", "br=.br,gzip=.gz");
290 defaultServlet.addInitParameter("fileEncoding", "ISO-8859-1");
287291
288292 ctxt.addServletMappingDecoded("/", "default");
289293 ctxt.addMimeMapping("html", "text/html");
454458 */
455459 @Test
456460 public void testCustomErrorPage() throws Exception {
457 File appDir = new File(getTemporaryDirectory(), "MyApp");
458 File webInf = new File(appDir, "WEB-INF");
459 addDeleteOnTearDown(appDir);
460 if (!webInf.mkdirs() && !webInf.isDirectory()) {
461 fail("Unable to create directory [" + webInf + "]");
462 }
463
464 File webxml = new File(appDir, "WEB-INF/web.xml");
465 try (FileOutputStream fos = new FileOutputStream(webxml);
466 Writer w = new OutputStreamWriter(fos, "UTF-8");) {
467 w.write("<?xml version='1.0' encoding='UTF-8'?>\n"
468 + "<web-app xmlns='http://java.sun.com/xml/ns/j2ee' "
469 + " xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'"
470 + " xsi:schemaLocation='http://java.sun.com/xml/ns/j2ee "
471 + " http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd'"
472 + " version='2.4'>\n"
473 + "<error-page>\n<error-code>404</error-code>\n"
474 + "<location>/404.html</location>\n</error-page>\n"
475 + "</web-app>\n");
476 }
477
478 File error404 = new File(appDir, "404.html");
479 try (FileOutputStream fos = new FileOutputStream(error404);
480 Writer w = new OutputStreamWriter(fos, "ISO-8859-1")) {
481 w.write("It is 404.html");
482 }
483
484 Tomcat tomcat = getTomcatInstance();
485 String contextPath = "/MyApp";
486 tomcat.addWebapp(null, contextPath, appDir.getAbsolutePath());
461
462 Tomcat tomcat = getTomcatInstance();
463
464 File appDir = new File("test/webapp");
465
466 // app dir is relative to server home
467 Context ctxt = tomcat.addContext("", appDir.getAbsolutePath());
468 Wrapper defaultServlet = Tomcat.addServlet(ctxt, "default",
469 DefaultServlet.class.getName());
470 defaultServlet.addInitParameter("fileEncoding", "ISO-8859-1");
471
472 ctxt.addServletMappingDecoded("/", "default");
473 ctxt.addMimeMapping("html", "text/html");
474 ErrorPage ep = new ErrorPage();
475 ep.setErrorCode(404);
476 ep.setLocation("/404.html");
477 ctxt.addErrorPage(ep);
478
487479 tomcat.start();
488480
489481 TestCustomErrorClient client =
2121 import java.io.InputStream;
2222 import java.io.OutputStream;
2323 import java.net.Socket;
24 import java.net.SocketException;
2425 import java.nio.ByteBuffer;
2526 import java.nio.charset.StandardCharsets;
2627 import java.util.ArrayList;
3536 import javax.servlet.http.HttpServletResponse;
3637
3738 import org.junit.Assert;
39 import org.junit.Assume;
3840
3941 import org.apache.catalina.Context;
4042 import org.apache.catalina.LifecycleException;
804806 }
805807
806808
809 void handleGoAwayResponse(int lastStream) throws Http2Exception, IOException {
810 handleGoAwayResponse(lastStream, Http2Error.PROTOCOL_ERROR);
811 }
812
813
814 void handleGoAwayResponse(int lastStream, Http2Error expectedError)
815 throws Http2Exception, IOException {
816 try {
817 parser.readFrame(true);
818
819 Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
820 "0-Goaway-[" + lastStream + "]-[" + expectedError.getCode() + "]-["));
821 } catch (SocketException se) {
822 // On some platform / Connector combinations (e.g. Windows / NIO2),
823 // the TCP connection close will be processed before the client gets
824 // a chance to read the connection close frame.
825 Tomcat tomcat = getTomcatInstance();
826 Connector connector = tomcat.getConnector();
827
828 Assume.assumeTrue("This test is only expected to trigger an exception with NIO2",
829 connector.getProtocolHandlerClassName().contains("Nio2"));
830
831 Assume.assumeTrue("This test is only expected to trigger an exception on Windo9ws",
832 System.getProperty("os.name").startsWith("Windows"));
833 }
834 }
835
836
807837 private static class TestInput implements Http2Parser.Input {
808838
809839 private final InputStream is;
946976
947977
948978 @Override
979 public void setHeaderException(StreamException streamException) {
980 // NO-OP: Accept anything the server sends for the unit tests
981 }
982
983
984 @Override
949985 public void headersEnd(int streamId) {
950986 trace.append(streamId + "-HeadersEnd\n");
951987 }
7979 headers.setValue(name).setString(value);
8080 }
8181 @Override
82 public void setHeaderException(StreamException streamException) {
83 // NO-OP
84 }
85 @Override
8286 public void validateHeaders() throws StreamException {
8387 // NO-OP
8488 }
1616 package org.apache.coyote.http2;
1717
1818 import java.io.IOException;
19 import java.net.SocketException;
1920 import java.nio.ByteBuffer;
2021 import java.util.ArrayList;
2122 import java.util.List;
2223 import java.util.Random;
2324
25 import org.hamcrest.Description;
26 import org.hamcrest.TypeSafeMatcher;
27
2428 import org.junit.Assert;
2529 import org.junit.Test;
2630
3337 @Test
3438 public void testHeaderLimits1x128() throws Exception {
3539 // Well within limits
36 doTestHeaderLimits(1, 128, 0);
40 doTestHeaderLimits(1, 128, FailureMode.NONE);
3741 }
3842
3943
4145 public void testHeaderLimits100x32() throws Exception {
4246 // Just within default maxHeaderCount
4347 // Note request has 4 standard headers
44 doTestHeaderLimits(96, 32, 0);
48 doTestHeaderLimits(96, 32, FailureMode.NONE);
4549 }
4650
4751
4852 @Test
4953 public void testHeaderLimits101x32() throws Exception {
5054 // Just above default maxHeaderCount
51 doTestHeaderLimits(97, 32, 1);
55 doTestHeaderLimits(97, 32, FailureMode.STREAM_RESET);
5256 }
5357
5458
5559 @Test
5660 public void testHeaderLimits20x32WithLimit10() throws Exception {
5761 // Check lower count limit is enforced
58 doTestHeaderLimits(20, 32, -1, 10, Constants.DEFAULT_MAX_HEADER_SIZE, 0, 1);
62 doTestHeaderLimits(20, 32, -1, 10, Constants.DEFAULT_MAX_HEADER_SIZE, 0,
63 FailureMode.STREAM_RESET);
5964 }
6065
6166
6368 public void testHeaderLimits8x1144() throws Exception {
6469 // Just within default maxHttpHeaderSize
6570 // per header overhead plus standard 3 headers
66 doTestHeaderLimits(7, 1144, 0);
71 doTestHeaderLimits(7, 1144, FailureMode.NONE);
6772 }
6873
6974
7075 @Test
7176 public void testHeaderLimits8x1145() throws Exception {
7277 // Just above default maxHttpHeaderSize
73 doTestHeaderLimits(7, 1145, 1);
78 doTestHeaderLimits(7, 1145, FailureMode.STREAM_RESET);
7479 }
7580
7681
7782 @Test
7883 public void testHeaderLimits3x1024WithLimit2048() throws Exception {
7984 // Check lower size limit is enforced
80 doTestHeaderLimits(3, 1024, -1, Constants.DEFAULT_MAX_HEADER_COUNT, 2 * 1024, 0, 1);
85 doTestHeaderLimits(3, 1024, -1, Constants.DEFAULT_MAX_HEADER_COUNT, 2 * 1024, 0,
86 FailureMode.STREAM_RESET);
8187 }
8288
8389
8490 @Test
8591 public void testHeaderLimits1x12k() throws Exception {
8692 // Bug 60232
87 doTestHeaderLimits(1, 12*1024, 1);
93 doTestHeaderLimits(1, 12*1024, FailureMode.STREAM_RESET);
8894 }
8995
9096
9197 @Test
9298 public void testHeaderLimits1x12kin1kChunks() throws Exception {
9399 // Bug 60232
94 doTestHeaderLimits(1, 12*1024, 1024, 1);
100 doTestHeaderLimits(1, 12*1024, 1024, FailureMode.STREAM_RESET);
95101 }
96102
97103
98104 @Test
99105 public void testHeaderLimits1x12kin1kChunksThenNewRequest() throws Exception {
100106 // Bug 60232
101 doTestHeaderLimits(1, 12*1024, 1024, 1);
107 doTestHeaderLimits(1, 12*1024, 1024, FailureMode.STREAM_RESET);
108
102109
103110 output.clearTrace();
104111 sendSimpleGetRequest(5);
111118 @Test
112119 public void testHeaderLimits1x32k() throws Exception {
113120 // Bug 60232
114 doTestHeaderLimits(1, 32*1024, 1);
121 doTestHeaderLimits(1, 32*1024, FailureMode.CONNECTION_RESET);
115122 }
116123
117124
121128 // 500ms per frame write delay to give server a chance to process the
122129 // stream reset and the connection reset before the request is fully
123130 // sent.
124 doTestHeaderLimits(1, 32*1024, 1024, 500, 2);
131 doTestHeaderLimits(1, 32*1024, 1024, 500, FailureMode.CONNECTION_RESET);
125132 }
126133
127134
128135 @Test
129136 public void testHeaderLimits1x128k() throws Exception {
130137 // Bug 60232
131 doTestHeaderLimits(1, 128*1024, 2);
138 doTestHeaderLimits(1, 128*1024, FailureMode.CONNECTION_RESET);
132139 }
133140
134141
135142 @Test
136143 public void testHeaderLimits1x512k() throws Exception {
137144 // Bug 60232
138 doTestHeaderLimits(1, 512*1024, 2);
145 doTestHeaderLimits(1, 512*1024, FailureMode.CONNECTION_RESET);
139146 }
140147
141148
142149 @Test
143150 public void testHeaderLimits10x512k() throws Exception {
144151 // Bug 60232
145 doTestHeaderLimits(10, 512*1024, 2);
146 }
147
148
149 private void doTestHeaderLimits(int headerCount, int headerSize, int failMode) throws Exception {
152 doTestHeaderLimits(10, 512*1024, FailureMode.CONNECTION_RESET);
153 }
154
155
156 private void doTestHeaderLimits(int headerCount, int headerSize, FailureMode failMode)
157 throws Exception {
150158 doTestHeaderLimits(headerCount, headerSize, -1, failMode);
151159 }
152160
153161
154162 private void doTestHeaderLimits(int headerCount, int headerSize, int maxHeaderPayloadSize,
155 int failMode) throws Exception {
163 FailureMode failMode) throws Exception {
156164 doTestHeaderLimits(headerCount, headerSize, maxHeaderPayloadSize, 0, failMode);
157165 }
158166
159167
160168 private void doTestHeaderLimits(int headerCount, int headerSize, int maxHeaderPayloadSize,
161 int delayms, int failMode) throws Exception {
169 int delayms, FailureMode failMode) throws Exception {
162170 doTestHeaderLimits(headerCount, headerSize, maxHeaderPayloadSize,
163171 Constants.DEFAULT_MAX_HEADER_COUNT, Constants.DEFAULT_MAX_HEADER_SIZE, delayms,
164172 failMode);
166174
167175
168176 private void doTestHeaderLimits(int headerCount, int headerSize, int maxHeaderPayloadSize,
169 int maxHeaderCount, int maxHeaderSize, int delayms, int failMode) throws Exception {
177 int maxHeaderCount, int maxHeaderSize, int delayms, FailureMode failMode)
178 throws Exception {
170179
171180 // Build the custom headers
172181 List<String[]> customHeaders = new ArrayList<>();
225234 }
226235
227236 switch (failMode) {
228 case 0: {
237 case NONE: {
229238 // Expect a normal response
230239 readSimpleGetResponse();
231240 Assert.assertEquals(getSimpleResponseTrace(3), output.getTrace());
232241 Assert.assertNull(e);
233242 break;
234243 }
235 case 1: {
244 case STREAM_RESET: {
236245 // Expect a stream reset
237246 parser.readFrame(true);
238247 Assert.assertEquals("3-RST-[11]\n", output.getTrace());
239248 Assert.assertNull(e);
240249 break;
241250 }
242 case 2: {
243 // Behaviour depends on timing. If reset is processed fast enough,
244 // frames will be swallowed before the connection reset limit is
245 // reached
246 if (e == null) {
251 case CONNECTION_RESET: {
252 // Connection reset. Connection ID will vary so use a pattern
253 // On some platform / Connector combinations (e.g. Windows / APR),
254 // the TCP connection close will be processed before the client gets
255 // a chance to read the connection close frame
256 try {
247257 parser.readFrame(true);
248 Assert.assertEquals("3-RST-[11]\n", output.getTrace());
249 Assert.assertNull(e);
258 Assert.assertThat(output.getTrace(), RegexMatcher.matchesRegex(
259 "0-Goaway-\\[1\\]-\\[11\\]-\\[Connection \\[\\d++\\], Stream \\[3\\], .*"));
260 } catch (SocketException se) {
261 // Expected on Windows
250262 }
251 // Else is non-null as expected for a connection reset
252 break;
253 }
254 default: {
255 Assert.fail("Unknown failure mode");
263 break;
256264 }
257265 }
258266 }
399407 @Test
400408 public void doTestPostWithTrailerHeadersDefaultLimit() throws Exception{
401409 doTestPostWithTrailerHeaders(Constants.DEFAULT_MAX_TRAILER_COUNT,
402 Constants.DEFAULT_MAX_TRAILER_SIZE, true);
410 Constants.DEFAULT_MAX_TRAILER_SIZE, FailureMode.NONE);
403411 }
404412
405413
406414 @Test
407415 public void doTestPostWithTrailerHeadersCount0() throws Exception{
408 doTestPostWithTrailerHeaders(0, Constants.DEFAULT_MAX_TRAILER_SIZE, false);
416 doTestPostWithTrailerHeaders(0, Constants.DEFAULT_MAX_TRAILER_SIZE,
417 FailureMode.STREAM_RESET);
409418 }
410419
411420
412421 @Test
413422 public void doTestPostWithTrailerHeadersSize0() throws Exception{
414 doTestPostWithTrailerHeaders(Constants.DEFAULT_MAX_TRAILER_COUNT, 0, false);
415 }
416
417
418 private void doTestPostWithTrailerHeaders(int maxTrailerCount, int maxTrailerSize, boolean ok)
419 throws Exception {
423 doTestPostWithTrailerHeaders(Constants.DEFAULT_MAX_TRAILER_COUNT, 0,
424 FailureMode.CONNECTION_RESET);
425 }
426
427
428 private void doTestPostWithTrailerHeaders(int maxTrailerCount, int maxTrailerSize,
429 FailureMode failMode) throws Exception {
420430 enableHttp2();
421431
422432 Http2Protocol http2Protocol =
448458 // Trailers
449459 writeFrame(trailerFrameHeader, trailerPayload);
450460
451 parser.readFrame(true);
452 if (ok) {
461 switch (failMode) {
462 case NONE: {
463 parser.readFrame(true);
453464 parser.readFrame(true);
454465 parser.readFrame(true);
455466 parser.readFrame(true);
467478 "\n" +
468479 "3-EndOfStream\n",
469480 output.getTrace());
470 } else {
481 break;
482 }
483 case STREAM_RESET: {
484 parser.readFrame(true);
471485 Assert.assertEquals("3-RST-[11]\n", output.getTrace());
486 break;
487 }
488 case CONNECTION_RESET: {
489 // Connection reset
490 do {
491 // NIO2 can sometimes send window updates depending on the
492 // timing of the connection close
493 output.clearTrace();
494 parser.readFrame(true);
495 } while (output.getTrace().contains("WindowSize"));
496
497 // Connection ID will vary so use a pattern
498 Assert.assertThat(output.getTrace(), RegexMatcher.matchesRegex(
499 "0-Goaway-\\[3\\]-\\[11\\]-\\[Connection \\[\\d++\\], Stream \\[3\\], .*"));
500 break;
501 }
502 }
503 }
504
505
506 private enum FailureMode {
507 NONE,
508 STREAM_RESET,
509 CONNECTION_RESET,
510
511 }
512
513
514 private static class RegexMatcher extends TypeSafeMatcher<String> {
515
516 private final String pattern;
517
518
519 public RegexMatcher(String pattern) {
520 this.pattern = pattern;
521 }
522
523
524 @Override
525 public void describeTo(Description description) {
526 description.appendText("match to regular expression pattern [" + pattern + "]");
527
528 }
529
530 @Override
531 protected boolean matchesSafely(String item) {
532 return item.matches(pattern);
533 }
534
535
536 public static RegexMatcher matchesRegex(String pattern) {
537 return new RegexMatcher(pattern);
472538 }
473539 }
474540 }
5454
5555 os.write(settings);
5656
57 // Read GOAWAY frame
58 parser.readFrame(true);
59
60 Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
61 "0-Goaway-[1]-[" + Http2Error.FRAME_SIZE_ERROR.getCode() + "]-["));
57 handleGoAwayResponse(1, Http2Error.FRAME_SIZE_ERROR);
6258 }
6359
6460 @Test
8076
8177 os.write(ping);
8278
83 // Read GOAWAY frame
84 parser.readFrame(true);
85
86 Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
87 "0-Goaway-[1]-[" + Http2Error.FRAME_SIZE_ERROR.getCode() + "]-["));
79 handleGoAwayResponse(1, Http2Error.FRAME_SIZE_ERROR);
8880 }
8981
9082
10698
10799 os.write(ping);
108100
109 // Read GOAWAY frame
110 parser.readFrame(true);
111
112 Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
113 "0-Goaway-[1]-[" + Http2Error.FRAME_SIZE_ERROR.getCode() + "]-["));
101 handleGoAwayResponse(1, Http2Error.FRAME_SIZE_ERROR);
114102 }
115103
116104
133121
134122 os.write(priority);
135123
136 // Read GOAWAY frame
124 // Read Stream reset frame
137125 parser.readFrame(true);
138126
139127 Assert.assertTrue(output.getTrace(),
4545 // Process the request
4646 writeFrame(frameHeader, headersPayload);
4747
48 // Read GOAWAY frame
49 parser.readFrame(true);
50
51 Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
52 "0-Goaway-[1]-[" + Http2Error.COMPRESSION_ERROR.getCode() + "]-["));
48 handleGoAwayResponse(1, Http2Error.COMPRESSION_ERROR);
5349 }
5450
5551
9086
9187 sendPing();
9288
93 // Read GOAWAY frame
94 parser.readFrame(true);
95
96 Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
97 "0-Goaway-[1]-[" + Http2Error.COMPRESSION_ERROR.getCode() + "]-["));
89 handleGoAwayResponse(1, Http2Error.COMPRESSION_ERROR);
9890 }
9991 }
3535
3636 sendWindowUpdate(3, 200);
3737
38 parser.readFrame(true);
39
40 Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
41 "0-Goaway-[1]-[" + Http2Error.PROTOCOL_ERROR.getCode() + "]-["));
38 handleGoAwayResponse(1);
4239 }
4340
4441
4845
4946 sendData(3, new byte[] {});
5047
51 parser.readFrame(true);
52
53 Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
54 "0-Goaway-[1]-[" + Http2Error.PROTOCOL_ERROR.getCode() + "]-["));
48 handleGoAwayResponse(1);
5549 }
5650
5751
6963 Assert.assertEquals(getSimpleResponseTrace(3), output.getTrace());
7064 output.clearTrace();
7165
72 // This should trigger a stream error
66 // This should trigger a connection error
7367 sendData(3, new byte[] {});
74 parser.readFrame(true);
75
76 Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
77 "0-Goaway-[3]-[" + Http2Error.STREAM_CLOSED.getCode() + "]-["));
68
69 handleGoAwayResponse(3, Http2Error.STREAM_CLOSED);
7870 }
7971
8072
110102 public void testClosedInvalidFrame02() throws Exception {
111103 http2Connect();
112104
113 // Stream 1 is closed. This should trigger a stream error
105 // Stream 1 is closed. This should trigger a connection error
114106 sendData(1, new byte[] {});
115 parser.readFrame(true);
116
117 Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
118 "0-Goaway-[1]-[" + Http2Error.STREAM_CLOSED.getCode() + "]-["));
107
108 handleGoAwayResponse(1, Http2Error.STREAM_CLOSED);
119109 }
120110
121111
134124 buildSimpleGetRequestPart1(frameHeader, headersPayload, 4);
135125 writeFrame(frameHeader, headersPayload);
136126
137 // headers
138 parser.readFrame(true);
139
140 Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
141 "0-Goaway-[1]-[" + Http2Error.PROTOCOL_ERROR.getCode() + "]-["));
127 handleGoAwayResponse(1);
142128 }
143129
144130
159145 os.write(frameHeader);
160146 os.flush();
161147
162 // headers
163 parser.readFrame(true);
164
165 Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
166 "0-Goaway-[5]-[" + Http2Error.PROTOCOL_ERROR.getCode() + "]-["));
148 handleGoAwayResponse(5);
167149 }
168150
169151
183165 // closed.
184166 sendSimpleGetRequest(3);
185167
186 parser.readFrame(true);
187
188 Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
189 "0-Goaway-[5]-[" + Http2Error.PROTOCOL_ERROR.getCode() + "]-["));
168 handleGoAwayResponse(5);
190169 }
191170
192171
9090 os.write(UNKNOWN_FRAME);
9191 os.flush();
9292
93 // Read GOAWAY frame
94 parser.readFrame(true);
95
96 Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
97 "0-Goaway-[1]-[" + Http2Error.COMPRESSION_ERROR.getCode() + "]-["));
93 handleGoAwayResponse(1, Http2Error.COMPRESSION_ERROR);
9894 }
99
10095 }
111111 os.write(dataFrame);
112112 os.flush();
113113
114 parser.readFrame(true);
115
116 String trace = output.getTrace();
117 Assert.assertTrue(trace, trace.startsWith("0-Goaway-[1]-[1]-["));
114 handleGoAwayResponse(1);
118115 }
119116
120117
138135 os.write(dataFrame);
139136 os.flush();
140137
141 parser.readFrame(true);
142
143 String trace = output.getTrace();
144 Assert.assertTrue(trace, trace.startsWith("0-Goaway-[1]-[1]-["));
138 handleGoAwayResponse(1);
145139 }
146140
147141
4040 buildSimpleGetRequestPart1(frameHeader, headersPayload, 0);
4141 writeFrame(frameHeader, headersPayload);
4242
43 // Go away
44 parser.readFrame(true);
45
46 Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
47 "0-Goaway-[1]-[" + Http2Error.PROTOCOL_ERROR.getCode() + "]-["));
43 handleGoAwayResponse(1);
4844 }
4945
5046
6965
7066 sendSimpleGetRequest(3, padding);
7167
72 // Goaway
73 parser.readFrame(true);
74
75 Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
76 "0-Goaway-[1]-[" + Http2Error.PROTOCOL_ERROR.getCode() + "]-["));
68 handleGoAwayResponse(1);
7769 }
7870
7971
9789 os.write(headerFrame);
9890 os.flush();
9991
100 parser.readFrame(true);
101
102 String trace = output.getTrace();
103 Assert.assertTrue(trace, trace.startsWith("0-Goaway-[1]-[1]-["));
92 handleGoAwayResponse(1);
10493 }
10594
10695
3636
3737 sendPriority(0, 1, 15);
3838
39 // Go away
40 parser.readFrame(true);
41
42 Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
43 "0-Goaway-[1]-[" + Http2Error.PROTOCOL_ERROR.getCode() + "]-["));
39 handleGoAwayResponse(1);
4440 }
4541
4642
5753
5854 sendPriority(5, 3, 15);
5955
60 // Read GOAWAY frame
61 parser.readFrame(true);
62
63 Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
64 "0-Goaway-[1]-[" + Http2Error.COMPRESSION_ERROR.getCode() + "]-["));
56 handleGoAwayResponse(1, Http2Error.COMPRESSION_ERROR);
6557 }
6658
6759
8476 os.write(priorityFrame);
8577 os.flush();
8678
87 // Read GOAWAY frame
79 // Read reset frame
8880 parser.readFrame(true);
8981
9082 Assert.assertEquals("3-RST-[" + Http2Error.FRAME_SIZE_ERROR.getCode() + "]\n",
3434
3535 sendRst(0, Http2Error.NO_ERROR.getCode());
3636
37 // Go away
38 parser.readFrame(true);
39
40 Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
41 "0-Goaway-[1]-[" + Http2Error.PROTOCOL_ERROR.getCode() + "]-["));
37 handleGoAwayResponse(1);
4238 }
4339
4440
5046 sendPriority(3, 0, 15);
5147 sendRst(3, Http2Error.NO_ERROR.getCode());
5248
53 // Go away
54 parser.readFrame(true);
55
56 Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
57 "0-Goaway-[1]-[" + Http2Error.PROTOCOL_ERROR.getCode() + "]-["));
49 handleGoAwayResponse(1);
5850 }
5951
6052
7769 os.write(resetFrame);
7870 os.flush();
7971
80 // Read GOAWAY frame
72 // Read reset frame
8173 parser.readFrame(true);
8274
8375 Assert.assertEquals("3-RST-[" + Http2Error.FRAME_SIZE_ERROR.getCode() + "]\n",
3535
3636 sendSettings(0, true, new SettingValue(1,1));
3737
38 // Go away
39 parser.readFrame(true);
40
41 Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
42 "0-Goaway-[1]-[" + Http2Error.FRAME_SIZE_ERROR.getCode() + "]-["));
38 handleGoAwayResponse(1, Http2Error.FRAME_SIZE_ERROR);
4339 }
4440
4541
5147 sendPriority(3, 0, 15);
5248 sendSettings(3, true, new SettingValue(1,1));
5349
54 // Go away
55 parser.readFrame(true);
56
57 Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
58 "0-Goaway-[1]-[" + Http2Error.PROTOCOL_ERROR.getCode() + "]-["));
50 handleGoAwayResponse(1);
5951 }
6052
6153
7769 os.write(resetFrame);
7870 os.flush();
7971
80 // Read GOAWAY frame
81 parser.readFrame(true);
82
83 Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
84 "0-Goaway-[1]-[" + Http2Error.FRAME_SIZE_ERROR.getCode() + "]-["));
72 handleGoAwayResponse(1, Http2Error.FRAME_SIZE_ERROR);
8573 }
8674
8775
9482
9583 sendSettings(0, false, new SettingValue(0x2,0x2));
9684
97 // Go away
98 parser.readFrame(true);
99
100 Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
101 "0-Goaway-[1]-[" + Http2Error.PROTOCOL_ERROR.getCode() + "]-["));
85 handleGoAwayResponse(1);
10286 }
10387
10488
10993
11094 sendSettings(0, false, new SettingValue(0x4,1 << 31));
11195
112 // Go away
113 parser.readFrame(true);
114
115 Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
116 "0-Goaway-[1]-[" + Http2Error.FLOW_CONTROL_ERROR.getCode() + "]-["));
96 handleGoAwayResponse(1, Http2Error.FLOW_CONTROL_ERROR);
11797 }
11898
11999
124104
125105 sendSettings(0, false, new SettingValue(0x5,1 << 31));
126106
127 // Go away
128 parser.readFrame(true);
129
130 Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
131 "0-Goaway-[1]-[" + Http2Error.PROTOCOL_ERROR.getCode() + "]-["));
107 handleGoAwayResponse(1);
132108 }
133109
134110
6666
6767 sendPing(1, false, "76543210".getBytes(StandardCharsets.ISO_8859_1));
6868
69 // Go away
70 parser.readFrame(true);
71
72 Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
73 "0-Goaway-[1]-[" + Http2Error.PROTOCOL_ERROR.getCode() + "]-["));
69 handleGoAwayResponse(1);
7470 }
7571
7672
8177
8278 sendPing(0, false, "6543210".getBytes(StandardCharsets.ISO_8859_1));
8379
84 // Go away
85 parser.readFrame(true);
86
87 Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
88 "0-Goaway-[1]-[" + Http2Error.FRAME_SIZE_ERROR.getCode() + "]-["));
80 handleGoAwayResponse(1, Http2Error.FRAME_SIZE_ERROR);
8981 }
90
9182 }
9090
9191 sendGoaway(1, 1, Http2Error.NO_ERROR.getCode(), null);
9292
93 // Go away
94 parser.readFrame(true);
95
96 Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
97 "0-Goaway-[1]-[" + Http2Error.PROTOCOL_ERROR.getCode() + "]-["));
93 handleGoAwayResponse(1);
9894 }
9995
10096
3535
3636 sendWindowUpdate(0, 0);
3737
38 parser.readFrame(true);
39
40 Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
41 "0-Goaway-[1]-[" + Http2Error.PROTOCOL_ERROR.getCode() + "]-["));
38 handleGoAwayResponse(1);
4239 }
4340
4441
8885 os.write(zeroLengthWindowFrame);
8986 os.flush();
9087
91 parser.readFrame(true);
92
93 Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
94 "0-Goaway-[1]-[" + Http2Error.FRAME_SIZE_ERROR.getCode() + "]-["));
88 handleGoAwayResponse(1, Http2Error.FRAME_SIZE_ERROR);
9589 }
9690
9791
149143 // Super size the flow control window.
150144 sendWindowUpdate(0, (1 << 31) - 1);
151145
152 parser.readFrame(true);
153
154 Assert.assertTrue(output.getTrace(), output.getTrace().startsWith(
155 "0-Goaway-[1]-[" + Http2Error.FLOW_CONTROL_ERROR.getCode() + "]-["));
146 handleGoAwayResponse(1, Http2Error.FLOW_CONTROL_ERROR);
156147 }
157148
158149
6666
6767 @After
6868 public void tearDown() {
69 for (File file : logsDir.listFiles()) {
70 file.delete();
69 File[] files = logsDir.listFiles();
70 if (files != null) {
71 for (File file : files) {
72 file.delete();
73 }
74 logsDir.delete();
7175 }
72 logsDir.delete();
7376 }
7477
7578 @SuppressWarnings("unused")
7780 public void testCleanOnInitOneHandler() throws Exception {
7881 generateLogFiles(logsDir, PREFIX_1, SUFIX_1, 3);
7982
80 FileHandler handler = new FileHandler(logsDir.getAbsolutePath(), PREFIX_1, SUFIX_1, 2);
83 new FileHandler(logsDir.getAbsolutePath(), PREFIX_1, SUFIX_1, 2);
8184
8285 Thread.sleep(1000);
8386
8992 public void testCleanOnInitMultipleHandlers() throws Exception {
9093 generateLogFiles(logsDir, PREFIX_1, SUFIX_1, 3);
9194
92 FileHandler handler1 = new FileHandler(logsDir.getAbsolutePath(), PREFIX_1, SUFIX_1, 2);
93 FileHandler handler2 = new FileHandler(logsDir.getAbsolutePath(), PREFIX_1, SUFIX_2, 2);
94 FileHandler handler3 = new FileHandler(logsDir.getAbsolutePath(), PREFIX_2, SUFIX_1, 2);
95 FileHandler handler4 = new FileHandler(logsDir.getAbsolutePath(), PREFIX_3, SUFIX_1, 2);
95 new FileHandler(logsDir.getAbsolutePath(), PREFIX_1, SUFIX_1, 2);
96 new FileHandler(logsDir.getAbsolutePath(), PREFIX_1, SUFIX_2, 2);
97 new FileHandler(logsDir.getAbsolutePath(), PREFIX_2, SUFIX_1, 2);
98 new FileHandler(logsDir.getAbsolutePath(), PREFIX_3, SUFIX_1, 2);
9699
97100 Thread.sleep(1000);
98101
104107 public void testCleanDisabled() throws Exception {
105108 generateLogFiles(logsDir, PREFIX_1, SUFIX_1, 3);
106109
107 FileHandler handler = new FileHandler(logsDir.getAbsolutePath(), PREFIX_1, SUFIX_1, -1);
110 new FileHandler(logsDir.getAbsolutePath(), PREFIX_1, SUFIX_1, -1);
108111
109112 Thread.sleep(1000);
110113
0 /*
1 * Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.apache.juli;
17
18 import java.io.File;
19 import java.net.URLDecoder;
20
21 import static org.junit.Assert.assertTrue;
22
23 import org.junit.After;
24 import org.junit.BeforeClass;
25 import org.junit.Test;
26
27 import org.apache.catalina.startup.LoggingBaseTest;
28
29 public class TestFileHandlerNonRotatable extends LoggingBaseTest {
30 private FileHandler testHandler;
31
32 @BeforeClass
33 public static void setUpPerTestClass() throws Exception {
34 System.setProperty("java.util.logging.manager",
35 "org.apache.juli.ClassLoaderLogManager");
36 String configLoggingPath = TestFileHandlerNonRotatable.class
37 .getResource("logging-non-rotatable.properties")
38 .getFile();
39 System.setProperty("java.util.logging.config.file",
40 URLDecoder.decode(configLoggingPath, java.nio.charset.StandardCharsets.UTF_8.toString()));
41 }
42
43 @Override
44 @After
45 public void tearDown() throws Exception {
46 if (testHandler != null) {
47 testHandler.close();
48 }
49 super.tearDown();
50 }
51
52 @Test
53 public void testBug61232() throws Exception {
54 testHandler = new FileHandler(this.getTemporaryDirectory().toString(),
55 "juli.", ".log");
56
57 File logFile = new File(this.getTemporaryDirectory(), "juli.log");
58 assertTrue(logFile.exists());
59 }
60
61 @Test
62 public void testCustomSuffixWithoutSeparator() throws Exception {
63 testHandler = new FileHandler(this.getTemporaryDirectory().toString(),
64 "juli.", "log");
65
66 File logFile = new File(this.getTemporaryDirectory(), "juli.log");
67 assertTrue(logFile.exists());
68 }
69
70 @Test
71 public void testCustomPrefixWithoutSeparator() throws Exception {
72 testHandler = new FileHandler(this.getTemporaryDirectory().toString(),
73 "juli", ".log");
74
75 File logFile = new File(this.getTemporaryDirectory(), "juli.log");
76 assertTrue(logFile.exists());
77 }
78 }
0 # Licensed to the Apache Software Foundation (ASF) under one or more
1 # contributor license agreements. See the NOTICE file distributed with
2 # this work for additional information regarding copyright ownership.
3 # The ASF licenses this file to You under the Apache License, Version 2.0
4 # (the "License"); you may not use this file except in compliance with
5 # the License. You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 org.apache.juli.FileHandler.rotatable = false
0 It is 404.html
4343 They eventually become mixed with the numbered issues. (I.e., numbered
4444 issues do not "pop up" wrt. others).
4545 -->
46 <section name="Tomcat 8.5.17 (markt)">
46 <section name="Tomcat 8.5.18 (markt)">
47 <subsection name="Catalina">
48 <changelog>
49 <fix>
50 <bug>61232</bug>: When log rotation is disabled only one separator will
51 be used when generating the log file name. For example if the prefix is
52 <code>catalina.</code> and the suffix is <code>.log</code> then the log
53 file name will be <code>catalina.log</code> instead of
54 <code>catalina..log</code>. Patch provided by Katya Stoycheva.
55 (violetagg)
56 </fix>
57 <fix>
58 <bug>61264</bug>: Correct a regression in the refactoring to use
59 <code>Charset</code> rather than <code>String</code> to store request
60 character encoding that prevented <code>getReader()</code> throwing an
61 <code>UnsupportedEncodingException</code> if the user agent specifies
62 an unsupported character encoding. (markt)
63 </fix>
64 <fix>
65 Correct a regression in the fix for <bug>49464</bug> that could cause an
66 incorrect <code>Content-Length</code> header to be sent by the
67 <code>DefaultServlet</code> if the encoding of a static is not
68 consistent with the encoding of the response. (markt)
69 </fix>
70 </changelog>
71 </subsection>
72 <subsection name="Coyote">
73 <changelog>
74 <fix>
75 Enable TLS connectors to use Java key stores that contain multiple keys
76 where each key has a separate password. Based on a patch by Frank
77 Taffelt. (markt)
78 </fix>
79 <fix>
80 Improve the handling of HTTP/2 stream resets due to excessive headers
81 when a continuation frame is used. (markt)
82 </fix>
83 </changelog>
84 </subsection>
85 <subsection name="Jasper">
86 <changelog>
87 <add>
88 <bug>53031</bug>: Add support for the <code>fork</code> option when
89 compiling JSPs with the Jasper Ant task and javac. (markt)
90 </add>
91 </changelog>
92 </subsection>
93 <subsection name="Other">
94 <changelog>
95 <add>
96 <bug>52791</bug>: Add the ability to set the defaults used by the
97 Windows installer from a configuration file. Patch provided by Sandra
98 Madden. (markt)
99 </add>
100 </changelog>
101 </subsection>
102 </section>
103 <section name="Tomcat 8.5.17 (markt)" rtext="not released">
47104 <subsection name="Catalina">
48105 <changelog>
49106 <fix>
6060 <p>
6161 In addition to dynamic discovery, Apache Tribes also supports static membership, with membership verification.
6262 To achieve this add the <code>org.apache.catalina.tribes.group.interceptors.StaticMembershipInterceptor</code>
63 underneath the <code>org.apache.catalina.tribes.group.interceptors.TcpFailureDetector</code> interceptor.
63 after the <code>org.apache.catalina.tribes.group.interceptors.TcpFailureDetector</code> interceptor.
6464 Inside the <code>StaticMembershipInterceptor</code> you can add the static members you wish to have.
6565 The <code>TcpFailureDetector</code> will do a health check on the static members,and also monitor them for crashes
6666 so they will have the same level of notification mechanism as the members that are automatically discovered.</p>
7070 will not be any tray icon present when Tomcat is running. Note that
7171 when choosing to run Tomcat at the end of installation, the tray
7272 icon will be used even if Tomcat was installed as a service.</li>
73 <li><strong>Defaults</strong>: The defaults used by the installer may be
74 overridden by use of the <code>/C=&lt;config file&gt;</code> command
75 line argument. The configuration file uses the format
76 <code>name=value</code> with each pair on a separate line. The names
77 of the available configuration options are:
78 <ul>
79 <li>JavaHome</li>
80 <li>TomcatPortShutdown</li>
81 <li>TomcatPortHttp</li>
82 <li>TomcatPortAjp</li>
83 <li>TomcatMenuEntriesEnable</li>
84 <li>TomcatShortcutAllUsers</li>
85 <li>TomcatServiceDefaultName</li>
86 <li>TomcatServiceName</li>
87 <li>TomcatServiceFileName</li>
88 <li>TomcatServiceManagerFileName</li>
89 <li>TomcatAdminEnable</li>
90 <li>TomcatAdminUsername</li>
91 <li>TomcatAdminPassword</li>
92 <li>TomcatAdminRoles</li>
93 </ul>
94 By using <code>/C=...</code> along with <code>/S</code> and
95 <code>/D=</code> it is possible to perform fully configured
96 unattended installs of Apache Tomact.
97 </li>
7398 <li>Refer to the
7499 <a href="windows-service-howto.html">Windows Service HOW-TO</a>
75100 for information on how to manage Tomcat as a Windows service.
1111 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 # See the License for the specific language governing permissions and
1313 # limitations under the License.
14
1415 helloworld.title = Hola Mundo!
1516 requestinfo.title = Ejemplo de Informacion de Requerimiento:
1617 requestinfo.label.method = M\u00E9todo: