Skip to content

Commit

Permalink
Remove support for ALLOW_UNSUPPORTED_EXTENSIONS
Browse files Browse the repository at this point in the history
All extensions are optional. If an endpoint declares an extension that
isn't supported no need for an error - just exclude it from the result
of the negotiation.
  • Loading branch information
markt-asf committed Dec 8, 2021
1 parent 2c5cea0 commit 5fa1611
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 28 deletions.
2 changes: 0 additions & 2 deletions java/org/apache/tomcat/websocket/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ public class Constants {
*/
static final boolean DISABLE_BUILTIN_EXTENSIONS =
Boolean.getBoolean("org.apache.tomcat.websocket.DISABLE_BUILTIN_EXTENSIONS");
static final boolean ALLOW_UNSUPPORTED_EXTENSIONS =
Boolean.getBoolean("org.apache.tomcat.websocket.ALLOW_UNSUPPORTED_EXTENSIONS");

public static final boolean STRICT_SPEC_COMPLIANCE =
Boolean.getBoolean("org.apache.tomcat.websocket.STRICT_SPEC_COMPLIANCE");
Expand Down
2 changes: 0 additions & 2 deletions java/org/apache/tomcat/websocket/LocalStrings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ perMessageDeflate.invalidState=Invalid state
perMessageDeflate.invalidWindowSize=An invalid windows of [{1}] size was specified for [{0}]. Valid values are whole numbers from 8 to 15 inclusive.
perMessageDeflate.unknownParameter=An unknown extension parameter [{0}] was defined

transformerFactory.unsupportedExtension=The extension [{0}] is not supported

util.invalidMessageHandler=The message handler provided does not have an onMessage(Object) method
util.invalidType=Unable to coerce value [{0}] to type [{1}]. That type is not supported.
util.notToken=An illegal extension parameter was specified with name [{0}] and value [{1}]
Expand Down
2 changes: 0 additions & 2 deletions java/org/apache/tomcat/websocket/LocalStrings_fr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ perMessageDeflate.invalidState=Etat invalide
perMessageDeflate.invalidWindowSize=Une taille [{1}] de fenêtre invalide a été spécifiée pour [{0}], les valeurs valides sont les entiers de 8 à 15 inclus
perMessageDeflate.unknownParameter=Un paramètre d''extension inconnu [{0}] a été défini

transformerFactory.unsupportedExtension=L''extension [{0}] n''est pas supportée

util.invalidMessageHandler=Le gestionnaire de messages fourni n'a pas de méthode onMessage(Object)
util.invalidType=Incapable de convertir la valeur [{0}] en le type [{1}]. Ce type n''est pas supporté.
util.notToken=Un paramètre d''extension illégal a été spécifié avec le nom [{0}] et la valeur [{1}]
Expand Down
2 changes: 0 additions & 2 deletions java/org/apache/tomcat/websocket/LocalStrings_ja.properties
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ perMessageDeflate.invalidState=不正な状態です。
perMessageDeflate.invalidWindowSize=[{0}] のウインドウサイズに無効な値 [{1}] が指定されました。ウインドウサイズは 8 以上 15 以下でなければなりません。
perMessageDeflate.unknownParameter=未知の拡張パラメーター [{0}] が指定されました。

transformerFactory.unsupportedExtension=未対応の拡張 [{0}] です。

util.invalidMessageHandler=提供されたメッセージハンドラにonMessage(Object)メソッドがありません
util.invalidType=値[{0}]をタイプ[{1}]に強制できません。 このタイプはサポートされていません。
util.notToken=パラメーター名 [{0}]、値 [{1}] の不正な拡張パラメーターが指定されました。
Expand Down
2 changes: 0 additions & 2 deletions java/org/apache/tomcat/websocket/LocalStrings_ko.properties
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ perMessageDeflate.invalidState=유효하지 않은 상태
perMessageDeflate.invalidWindowSize=크기가 [{1}]인 유효하지 않은 윈도우들이 [{0}]을 위해 지정되었습니다. 유효한 값들의 범위는 8에서 15까지의 모든 숫자들입니다.
perMessageDeflate.unknownParameter=알 수 없는 확장 파라미터 [{0}]은(는), 정의되지 않았습니다.

transformerFactory.unsupportedExtension=Extension [{0}]은(는) 지원되지 않습니다.

util.invalidMessageHandler=제공된 메시지 핸들러에 onMessage(Object) 메소드가 없습니다.
util.invalidType=[{0}] 값을 타입 [{1}](으)로 강제 변환시킬 수 없습니다. 해당 타입은 지원되지 않습니다.
util.notToken=허용되지 않는 확장 파라미터가 지정되었습니다. 이름: [{0}], 값: [{1}].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ perMessageDeflate.invalidState=无效状态
perMessageDeflate.invalidWindowSize=为[{0}]指定了[{1}]大小的无效窗口。 有效值是从8到15(包括8和15)的整数。
perMessageDeflate.unknownParameter=定义了未知的扩展参数[{0}]

transformerFactory.unsupportedExtension=不支持扩展名[{0}]。

util.invalidMessageHandler=提供的消息处理程序没有onMessage(对象)方法。
util.invalidType=无法强制值[{0}]转为[{1}]类型(不支持次类型)。
util.notToken=一个非法的扩展参数被指定为名称[{0}]和值[{0}]
Expand Down
11 changes: 1 addition & 10 deletions java/org/apache/tomcat/websocket/TransformationFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@

import jakarta.websocket.Extension;

import org.apache.tomcat.util.res.StringManager;

public class TransformationFactory {

private static final StringManager sm = StringManager.getManager(TransformationFactory.class);

private static final TransformationFactory factory = new TransformationFactory();

private TransformationFactory() {
Expand All @@ -41,11 +37,6 @@ public Transformation create(String name, List<List<Extension.Parameter>> prefer
if (PerMessageDeflate.NAME.equals(name)) {
return PerMessageDeflate.negotiate(preferences, isServer);
}
if (Constants.ALLOW_UNSUPPORTED_EXTENSIONS) {
return null;
} else {
throw new IllegalArgumentException(
sm.getString("transformerFactory.unsupportedExtension", name));
}
return null;
}
}
11 changes: 11 additions & 0 deletions webapps/docs/changelog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,17 @@
</fix>
</changelog>
</subsection>
<subsection name="WebSocket">
<changelog>
<fix>
Remove the <code>ALLOW_UNSUPPORTED_EXTENSIONS</code> system property. As
per RFC 6455, all extensions are optional. If an endpoint declares an
extension that isn't supported there is no need to trigger an error. The
extension can just be excluded from the result of the negotiation.
(markt)
</fix>
</changelog>
</subsection>
</section>
<section name="Tomcat 10.1.0-M8 (markt)" rtext="2021-12-08">
<subsection name="Catalina">
Expand Down
6 changes: 0 additions & 6 deletions webapps/docs/config/systemprops.xml
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,6 @@

<properties>

<property name="org.apache.tomcat. websocket.ALLOW_UNSUPPORTED_EXTENSIONS">
<p>If <code>true</code>, allow unknown extensions to be declared by
the user.</p>
<p>The default value is <code>false</code>.</p>
</property>

<property name="org.apache.tomcat. websocket.DEFAULT_BUFFER_SIZE">
<p>The default size for buffers used in the Websockets container.</p>
<p>The default value is <code>8192</code> which corresponds to 8KB.</p>
Expand Down

0 comments on commit 5fa1611

Please sign in to comment.