You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2014/11/28 21:33:20 UTC

svn commit: r1642360 - in /tomcat/trunk/java/org/apache/tomcat/websocket: Constants.java LocalStrings.properties TransformationFactory.java WsWebSocketContainer.java server/UpgradeUtil.java server/WsHandshakeRequest.java

Author: remm
Date: Fri Nov 28 20:33:20 2014
New Revision: 1642360

URL: http://svn.apache.org/r1642360
Log:
- Use the extensions specified by the configuration (and ignore if there are no associated transformations).
- Add an origin header on the client.
- Add path params as params too.
- Use the case insensitive map for all headers.

Modified:
    tomcat/trunk/java/org/apache/tomcat/websocket/Constants.java
    tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties
    tomcat/trunk/java/org/apache/tomcat/websocket/TransformationFactory.java
    tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
    tomcat/trunk/java/org/apache/tomcat/websocket/server/UpgradeUtil.java
    tomcat/trunk/java/org/apache/tomcat/websocket/server/WsHandshakeRequest.java

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/Constants.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/Constants.java?rev=1642360&r1=1642359&r2=1642360&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/Constants.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/Constants.java Fri Nov 28 20:33:20 2014
@@ -49,6 +49,7 @@ public class Constants {
     public static final String HOST_HEADER_NAME = "Host";
     public static final String UPGRADE_HEADER_NAME = "Upgrade";
     public static final String UPGRADE_HEADER_VALUE = "websocket";
+    public static final String ORIGIN_HEADER_NAME = "Origin";
     public static final String CONNECTION_HEADER_NAME = "Connection";
     public static final String CONNECTION_HEADER_VALUE = "upgrade";
     public static final String WS_VERSION_HEADER_NAME = "Sec-WebSocket-Version";

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties?rev=1642360&r1=1642359&r2=1642360&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties Fri Nov 28 20:33:20 2014
@@ -35,8 +35,6 @@ perMessageDeflate.duplicateParameter=Dup
 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.notToken=An illegal extension parameter was specified with name [{0}] and value [{1}]
 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.

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/TransformationFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/TransformationFactory.java?rev=1642360&r1=1642359&r2=1642360&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/TransformationFactory.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/TransformationFactory.java Fri Nov 28 20:33:20 2014
@@ -20,12 +20,8 @@ import java.util.List;
 
 import javax.websocket.Extension;
 
-import org.apache.tomcat.util.res.StringManager;
-
 public class TransformationFactory {
 
-    private static final StringManager sm = StringManager.getManager(Constants.PACKAGE_NAME);
-
     private static final TransformationFactory factory = new TransformationFactory();
 
     private TransformationFactory() {
@@ -41,7 +37,6 @@ public class TransformationFactory {
         if (PerMessageDeflate.NAME.equals(name)) {
             return PerMessageDeflate.negotiate(preferences, isServer);
         }
-        throw new IllegalArgumentException(
-                sm.getString("transformerFactory.unsupportedExtension", name));
+        return null;
     }
 }

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java?rev=1642360&r1=1642359&r2=1642360&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java Fri Nov 28 20:33:20 2014
@@ -218,7 +218,7 @@ public class WsWebSocketContainer
                     sm.getString("wsWebSocketContainer.pathNoHost"));
         }
         int port = path.getPort();
-        Map<String,List<String>> reqHeaders = createRequestHeaders(host, port,
+        Map<String,List<String>> reqHeaders = createRequestHeaders(path, host, port,
                 clientEndpointConfiguration.getPreferredSubprotocols(),
                 clientEndpointConfiguration.getExtensions());
         clientEndpointConfiguration.getConfigurator().
@@ -430,7 +430,7 @@ public class WsWebSocketContainer
         return result;
     }
 
-    private Map<String,List<String>> createRequestHeaders(String host,
+    private Map<String,List<String>> createRequestHeaders(URI path, String host,
             int port, List<String> subProtocols, List<Extension> extensions) {
 
         Map<String,List<String>> headers = new HashMap<>();
@@ -476,6 +476,11 @@ public class WsWebSocketContainer
                     generateExtensionHeaders(extensions));
         }
 
+        // Origin header
+        List<String> originValues = new ArrayList<>(1);
+        originValues.add(path.toString());
+        headers.put(Constants.ORIGIN_HEADER_NAME, originValues);
+
         return headers;
     }
 
@@ -571,7 +576,7 @@ public class WsWebSocketContainer
             ExecutionException, DeploymentException, EOFException,
             TimeoutException {
 
-        Map<String,List<String>> headers = new HashMap<>();
+        Map<String,List<String>> headers = new CaseInsensitiveKeyMap<>();
 
         boolean readStatus = false;
         boolean readHeaders = false;
@@ -606,7 +611,7 @@ public class WsWebSocketContainer
                 }
             }
         }
-
+System.out.println("Headers: " + headers);
         return new WsHandshakeResponse(headers);
     }
 

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/server/UpgradeUtil.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/server/UpgradeUtil.java?rev=1642360&r1=1642359&r2=1642360&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/server/UpgradeUtil.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/server/UpgradeUtil.java Fri Nov 28 20:33:20 2014
@@ -112,7 +112,7 @@ public class UpgradeUtil {
 
 
         // Origin check
-        String origin = req.getHeader("Origin");
+        String origin = req.getHeader(Constants.ORIGIN_HEADER_NAME);
         if (!sec.getConfigurator().checkOrigin(origin)) {
             resp.sendError(HttpServletResponse.SC_FORBIDDEN);
             return;
@@ -134,8 +134,16 @@ public class UpgradeUtil {
         // Negotiation phase 1. By default this simply filters out the
         // extensions that the server does not support but applications could
         // use a custom configurator to do more than this.
+        List<Extension> installedExtensions = null;
+        if (sec.getExtensions().size() == 0) {
+            installedExtensions = Constants.INSTALLED_EXTENSIONS;
+        } else {
+            installedExtensions = new ArrayList<>();
+            installedExtensions.addAll(sec.getExtensions());
+            installedExtensions.addAll(Constants.INSTALLED_EXTENSIONS);
+        }
         List<Extension> negotiatedExtensionsPhase1 = sec.getConfigurator().getNegotiatedExtensions(
-                Constants.INSTALLED_EXTENSIONS, extensionsRequested);
+                installedExtensions, extensionsRequested);
 
         // Negotiation phase 2. Create the Transformations that will be applied
         // to this connection. Note than an extension may be dropped at this
@@ -191,7 +199,7 @@ public class UpgradeUtil {
             resp.setHeader(Constants.WS_EXTENSIONS_HEADER_NAME, responseHeaderExtensions.toString());
         }
 
-        WsHandshakeRequest wsRequest = new WsHandshakeRequest(req);
+        WsHandshakeRequest wsRequest = new WsHandshakeRequest(req, pathParams);
         WsHandshakeResponse wsResponse = new WsHandshakeResponse();
         WsPerSessionServerEndpointConfig perSessionServerEndpointConfig =
                 new WsPerSessionServerEndpointConfig(sec);

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/server/WsHandshakeRequest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/server/WsHandshakeRequest.java?rev=1642360&r1=1642359&r2=1642360&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/websocket/server/WsHandshakeRequest.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/server/WsHandshakeRequest.java Fri Nov 28 20:33:20 2014
@@ -30,6 +30,8 @@ import java.util.Map.Entry;
 import javax.servlet.http.HttpServletRequest;
 import javax.websocket.server.HandshakeRequest;
 
+import org.apache.tomcat.websocket.CaseInsensitiveKeyMap;
+
 /**
  * Represents the request that this session was opened under.
  */
@@ -45,7 +47,7 @@ public class WsHandshakeRequest implemen
     private volatile HttpServletRequest request;
 
 
-    public WsHandshakeRequest(HttpServletRequest request) {
+    public WsHandshakeRequest(HttpServletRequest request, Map<String,String> pathParams) {
 
         this.request = request;
 
@@ -74,10 +76,15 @@ public class WsHandshakeRequest implemen
                     Collections.unmodifiableList(
                             Arrays.asList(entry.getValue())));
         }
+        for (String pathName : pathParams.keySet()) {
+            newParameters.put(pathName,
+                    Collections.unmodifiableList(
+                            Arrays.asList(pathParams.get(pathName))));
+        }
         parameterMap = Collections.unmodifiableMap(newParameters);
 
         // Headers
-        Map<String,List<String>> newHeaders = new HashMap<>();
+        Map<String,List<String>> newHeaders = new CaseInsensitiveKeyMap<>();
 
         Enumeration<String> headerNames = request.getHeaderNames();
         while (headerNames.hasMoreElements()) {



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r1642360 - in /tomcat/trunk/java/org/apache/tomcat/websocket: Constants.java LocalStrings.properties TransformationFactory.java WsWebSocketContainer.java server/UpgradeUtil.java server/WsHandshakeRequest.java

Posted by Rémy Maucherat <re...@apache.org>.
2014-12-04 11:55 GMT+01:00 Mark Thomas <ma...@apache.org>:

> It is more like "least worst" rather than "best".
>
> Most things have sensible defaults and the user is able to change them
> via properties set on ClientEndpointConfig.getUserProperties() or similar.
>
> For changing defaults I don't think there is much choice but to use
> system properties.
>
> Ok, so for now, I'll add a number of system properties for configuration
in my next commit (whenever it is), and everything will be reverted to the
previous behavior.

Rémy

Re: svn commit: r1642360 - in /tomcat/trunk/java/org/apache/tomcat/websocket: Constants.java LocalStrings.properties TransformationFactory.java WsWebSocketContainer.java server/UpgradeUtil.java server/WsHandshakeRequest.java

Posted by Mark Thomas <ma...@apache.org>.
On 02/12/2014 09:26, Rémy Maucherat wrote:
> 2014-12-02 10:04 GMT+01:00 Mark Thomas <ma...@apache.org>:
> 
>> Possible options:
>> a) Require servers to support a NO-OP extension. Kind of pointless since
>>    it would just be there to pass the tests.
>> b) Drop the test. Not ideal. If the API is there it should be tested.
>> c) Add a "ignore unknown extensions flag" we use just for running the
>>    tests.
>> d) Require compression support and then use that to test the API.
>> e) Add support for application provided extensions and then use that to
>>    test the API.
>>
>> c) for now followed by e) is probably the best solution with c) being
>> removed once e) was in place.
>>
> 
> What is the best option for the websockets implementation configuration
> options ?

It is more like "least worst" rather than "best".

Most things have sensible defaults and the user is able to change them
via properties set on ClientEndpointConfig.getUserProperties() or similar.

For changing defaults I don't think there is much choice but to use
system properties.

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r1642360 - in /tomcat/trunk/java/org/apache/tomcat/websocket: Constants.java LocalStrings.properties TransformationFactory.java WsWebSocketContainer.java server/UpgradeUtil.java server/WsHandshakeRequest.java

Posted by Rémy Maucherat <re...@apache.org>.
2014-12-02 10:04 GMT+01:00 Mark Thomas <ma...@apache.org>:

> Possible options:
> a) Require servers to support a NO-OP extension. Kind of pointless since
>    it would just be there to pass the tests.
> b) Drop the test. Not ideal. If the API is there it should be tested.
> c) Add a "ignore unknown extensions flag" we use just for running the
>    tests.
> d) Require compression support and then use that to test the API.
> e) Add support for application provided extensions and then use that to
>    test the API.
>
> c) for now followed by e) is probably the best solution with c) being
> removed once e) was in place.
>

What is the best option for the websockets implementation configuration
options ?

Rémy

Re: svn commit: r1642360 - in /tomcat/trunk/java/org/apache/tomcat/websocket: Constants.java LocalStrings.properties TransformationFactory.java WsWebSocketContainer.java server/UpgradeUtil.java server/WsHandshakeRequest.java

Posted by Mark Thomas <ma...@apache.org>.
On 01/12/2014 12:34, Rémy Maucherat wrote:
> 2014-12-01 11:19 GMT+01:00 Mark Thomas <ma...@apache.org>:
> 
>> On 28/11/2014 20:33, remm@apache.org wrote:
>>> Author: remm
>>> Date: Fri Nov 28 20:33:20 2014
>>> New Revision: 1642360
>>>
>>> URL: http://svn.apache.org/r1642360
>>> Log:
>>> - Use the extensions specified by the configuration (and ignore if there
>> are no associated transformations).
>>
>> I can see how this would make sense if there was a way for the
>> application to configure its own extensions but there isn't. At the
>> moment extensions have to be hard-coded into the container and there is
>> no requirement to support any extension. If a server endpoint requests
>> an unsupported extension then shouldn't that trigger some sort of error?
>>
> 
> The tests use extensions (to see if it's supported). They are declared and
> of course they do nothing special, but it is supposed to be usable. To
> enable some, it uses a ServerEndpointConfig that overrides getExtensions,
> declared using a ServerApplicationConfig. Creativity :) Basically, if you
> give these guys some APIs that are placeholders but are user accessible
> they'll try to test them anyway.

I can see where this test is coming from but disabling the check that a
valid extension is being requested just to pass the test is the wrong
thing to do - particularly given your next comment.

> Actually, the test is bad since having a builtin extension breaks it (it
> just matches the header), but I ignored that part after verifying it.

OK. That test needs to be challenged as well then. I see two issues from
this thread:

- The test requires the server to support arbitrary extensions which
  prevents the server from throwing an exception and preventing
  deployment when a server endpoint requests an unsupported extension.

- The test does not expect the server to support any other extensions
  and it is likely that implementations will support at some.

I'm not sure the best way of handling the first point. I can see the
need to test the API but it is more important to me that configuration /
coding errors that request an unsupported extension are reported early.

Possible options:
a) Require servers to support a NO-OP extension. Kind of pointless since
   it would just be there to pass the tests.
b) Drop the test. Not ideal. If the API is there it should be tested.
c) Add a "ignore unknown extensions flag" we use just for running the
   tests.
d) Require compression support and then use that to test the API.
e) Add support for application provided extensions and then use that to
   test the API.

c) for now followed by e) is probably the best solution with c) being
removed once e) was in place.

<snip/>

>>> - Add path params as params too.
>>
>> I don't see that discussed anywhere in the WebSocket spec.
>>
>> I went back through the EG discussions and the thread that I think led
>> up to this [1],[2] was very clear that this was the query parameters and
>> did not include the path parameters
>>
>> [1]
>>
>> https://java.net/projects/websocket-spec/lists/jsr356-experts/archive/2012-07/message/2
>> [2] http://markmail.org/message/qqwqcyg4npxv3bks
>>
> 
> Yes, I cannot find any mention of that, but the tests are quite explicit
> and they use both the query parameters and the path parameters names from
> that PathParam annotation. IMO it is not useless, users could maybe have
> asked for that. Moar creativity :)

I agree it has some uses. I think this also needs raising with the EG
for clarification.

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r1642360 - in /tomcat/trunk/java/org/apache/tomcat/websocket: Constants.java LocalStrings.properties TransformationFactory.java WsWebSocketContainer.java server/UpgradeUtil.java server/WsHandshakeRequest.java

Posted by Rémy Maucherat <re...@apache.org>.
2014-12-01 11:19 GMT+01:00 Mark Thomas <ma...@apache.org>:

> On 28/11/2014 20:33, remm@apache.org wrote:
> > Author: remm
> > Date: Fri Nov 28 20:33:20 2014
> > New Revision: 1642360
> >
> > URL: http://svn.apache.org/r1642360
> > Log:
> > - Use the extensions specified by the configuration (and ignore if there
> are no associated transformations).
>
> I can see how this would make sense if there was a way for the
> application to configure its own extensions but there isn't. At the
> moment extensions have to be hard-coded into the container and there is
> no requirement to support any extension. If a server endpoint requests
> an unsupported extension then shouldn't that trigger some sort of error?
>

The tests use extensions (to see if it's supported). They are declared and
of course they do nothing special, but it is supposed to be usable. To
enable some, it uses a ServerEndpointConfig that overrides getExtensions,
declared using a ServerApplicationConfig. Creativity :) Basically, if you
give these guys some APIs that are placeholders but are user accessible
they'll try to test them anyway.

Actually, the test is bad since having a builtin extension breaks it (it
just matches the header), but I ignored that part after verifying it.

>
> > - Add an origin header on the client.
>
> There are multiple issues with this part of the commit:
> - the target is added rather than the origin
> - the full URI is used rather than scheme, host and optional port
>
> See http://tools.ietf.org/html/rfc6454#section-7
>

Yes, I put some random URL I had on hand, I'll have to "improve" it.

>
> > - Add path params as params too.
>
> I don't see that discussed anywhere in the WebSocket spec.
>
> I went back through the EG discussions and the thread that I think led
> up to this [1],[2] was very clear that this was the query parameters and
> did not include the path parameters
>
> [1]
>
> https://java.net/projects/websocket-spec/lists/jsr356-experts/archive/2012-07/message/2
> [2] http://markmail.org/message/qqwqcyg4npxv3bks
>

Yes, I cannot find any mention of that, but the tests are quite explicit
and they use both the query parameters and the path parameters names from
that PathParam annotation. IMO it is not useless, users could maybe have
asked for that. Moar creativity :)

>
> > - Use the case insensitive map for all headers.
>
> Makes sense.
>
> Rémy

Re: svn commit: r1642360 - in /tomcat/trunk/java/org/apache/tomcat/websocket: Constants.java LocalStrings.properties TransformationFactory.java WsWebSocketContainer.java server/UpgradeUtil.java server/WsHandshakeRequest.java

Posted by Mark Thomas <ma...@apache.org>.
On 28/11/2014 20:33, remm@apache.org wrote:
> Author: remm
> Date: Fri Nov 28 20:33:20 2014
> New Revision: 1642360
> 
> URL: http://svn.apache.org/r1642360
> Log:
> - Use the extensions specified by the configuration (and ignore if there are no associated transformations).

I can see how this would make sense if there was a way for the
application to configure its own extensions but there isn't. At the
moment extensions have to be hard-coded into the container and there is
no requirement to support any extension. If a server endpoint requests
an unsupported extension then shouldn't that trigger some sort of error?

> - Add an origin header on the client.

There are multiple issues with this part of the commit:
- the target is added rather than the origin
- the full URI is used rather than scheme, host and optional port

See http://tools.ietf.org/html/rfc6454#section-7

> - Add path params as params too.

I don't see that discussed anywhere in the WebSocket spec.

I went back through the EG discussions and the thread that I think led
up to this [1],[2] was very clear that this was the query parameters and
did not include the path parameters

[1]
https://java.net/projects/websocket-spec/lists/jsr356-experts/archive/2012-07/message/2
[2] http://markmail.org/message/qqwqcyg4npxv3bks

> - Use the case insensitive map for all headers.

Makes sense.

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r1642360 - in /tomcat/trunk/java/org/apache/tomcat/websocket: Constants.java LocalStrings.properties TransformationFactory.java WsWebSocketContainer.java server/UpgradeUtil.java server/WsHandshakeRequest.java

Posted by Konstantin Kolinko <kn...@gmail.com>.
2014-11-28 23:33 GMT+03:00  <re...@apache.org>:
> Author: remm
> Date: Fri Nov 28 20:33:20 2014
> New Revision: 1642360
>
> URL: http://svn.apache.org/r1642360
> Log:
> - Use the extensions specified by the configuration (and ignore if there are no associated transformations).
> - Add an origin header on the client.
> - Add path params as params too.
> - Use the case insensitive map for all headers.
>
> Modified:
>     tomcat/trunk/java/org/apache/tomcat/websocket/Constants.java
>     tomcat/trunk/java/org/apache/tomcat/websocket/LocalStrings.properties
>     tomcat/trunk/java/org/apache/tomcat/websocket/TransformationFactory.java
>     tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
>     tomcat/trunk/java/org/apache/tomcat/websocket/server/UpgradeUtil.java
>     tomcat/trunk/java/org/apache/tomcat/websocket/server/WsHandshakeRequest.java
>

(...)

> Modified: tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java?rev=1642360&r1=1642359&r2=1642360&view=diff
> ==============================================================================
> --- tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java (original)
> +++ tomcat/trunk/java/org/apache/tomcat/websocket/WsWebSocketContainer.java Fri Nov 28 20:33:20 2014
> @@ -218,7 +218,7 @@ public class WsWebSocketContainer
>                      sm.getString("wsWebSocketContainer.pathNoHost"));
>          }
>          int port = path.getPort();
> -        Map<String,List<String>> reqHeaders = createRequestHeaders(host, port,
> +        Map<String,List<String>> reqHeaders = createRequestHeaders(path, host, port,
>                  clientEndpointConfiguration.getPreferredSubprotocols(),
>                  clientEndpointConfiguration.getExtensions());
>          clientEndpointConfiguration.getConfigurator().
> @@ -430,7 +430,7 @@ public class WsWebSocketContainer
>          return result;
>      }
>
> -    private Map<String,List<String>> createRequestHeaders(String host,
> +    private Map<String,List<String>> createRequestHeaders(URI path, String host,
>              int port, List<String> subProtocols, List<Extension> extensions) {
>
>          Map<String,List<String>> headers = new HashMap<>();
> @@ -476,6 +476,11 @@ public class WsWebSocketContainer
>                      generateExtensionHeaders(extensions));
>          }
>
> +        // Origin header
> +        List<String> originValues = new ArrayList<>(1);
> +        originValues.add(path.toString());
> +        headers.put(Constants.ORIGIN_HEADER_NAME, originValues);
> +
>          return headers;
>      }
>
> @@ -571,7 +576,7 @@ public class WsWebSocketContainer
>              ExecutionException, DeploymentException, EOFException,
>              TimeoutException {
>
> -        Map<String,List<String>> headers = new HashMap<>();
> +        Map<String,List<String>> headers = new CaseInsensitiveKeyMap<>();
>
>          boolean readStatus = false;
>          boolean readHeaders = false;
> @@ -606,7 +611,7 @@ public class WsWebSocketContainer
>                  }
>              }
>          }
> -
> +System.out.println("Headers: " + headers);

The above line does not belong here...

>          return new WsHandshakeResponse(headers);
>      }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org