This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
     new 3e9a970  Improve logging for failed WebSocket connections
3e9a970 is described below

commit 3e9a970235da035d6ca4a7c6572caecaff711b32
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Jun 3 08:55:54 2020 +0100

    Improve logging for failed WebSocket connections
    
    Primarily to help with debugging unit test failures.
---
 java/org/apache/tomcat/websocket/LocalStrings.properties   | 2 +-
 java/org/apache/tomcat/websocket/WsWebSocketContainer.java | 3 +--
 webapps/docs/changelog.xml                                 | 4 ++++
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/tomcat/websocket/LocalStrings.properties 
b/java/org/apache/tomcat/websocket/LocalStrings.properties
index 744619a..9412ffe 100644
--- a/java/org/apache/tomcat/websocket/LocalStrings.properties
+++ b/java/org/apache/tomcat/websocket/LocalStrings.properties
@@ -128,7 +128,7 @@ wsWebSocketContainer.asynchronousSocketChannelFail=Unable 
to open a connection t
 wsWebSocketContainer.defaultConfiguratorFail=Failed to create the default 
configurator
 wsWebSocketContainer.endpointCreateFail=Failed to create a local endpoint of 
type [{0}]
 wsWebSocketContainer.failedAuthentication=Failed to handle HTTP response code 
[{0}]. Authentication header was not accepted by server.
-wsWebSocketContainer.httpRequestFailed=The HTTP request to initiate the 
WebSocket connection failed
+wsWebSocketContainer.httpRequestFailed=The HTTP request to initiate the 
WebSocket connection to [{0}] failed
 wsWebSocketContainer.invalidExtensionParameters=The server responded with 
extension parameters the client is unable to support
 wsWebSocketContainer.invalidHeader=Unable to parse HTTP header as no colon is 
present to delimit header name and header value in [{0}]. The header has been 
skipped.
 wsWebSocketContainer.invalidStatus=The HTTP response from the server [{0}] did 
not permit the HTTP upgrade to WebSocket
diff --git a/java/org/apache/tomcat/websocket/WsWebSocketContainer.java 
b/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
index b938ade..dbe4c12 100644
--- a/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
+++ b/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
@@ -483,8 +483,7 @@ public class WsWebSocketContainer implements 
WebSocketContainer, BackgroundProce
             success = true;
         } catch (ExecutionException | InterruptedException | SSLException |
                 EOFException | TimeoutException | URISyntaxException | 
AuthenticationException e) {
-            throw new DeploymentException(
-                    sm.getString("wsWebSocketContainer.httpRequestFailed"), e);
+            throw new 
DeploymentException(sm.getString("wsWebSocketContainer.httpRequestFailed", 
path), e);
         } finally {
             if (!success) {
                 channel.close();
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 67be36b..db22cf3 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -124,6 +124,10 @@
         endpoint path is specified and catch invalid endpoint paths earlier.
         (markt)
       </fix>
+      <add>
+        Include the target URL in the log message when a WebSocket connection
+        fails. (markt)
+      </add>
     </changelog>
   </subsection>
   <subsection name="Other">


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

Reply via email to