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

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


The following commit(s) were added to refs/heads/9.0.x by this push:
     new ad64613  Improve logging for failed WebSocket connections
ad64613 is described below

commit ad64613a7d9dff6d19827453352bfd75ffe5805a
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 fb32a78..70bc4ca 100644
--- a/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
+++ b/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
@@ -482,8 +482,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 a54abc3..6953b49 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -122,6 +122,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