You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2019/06/07 15:19:23 UTC

[sling-whiteboard] 02/07: Send back user-agent to help identify which requests come through

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

rombert pushed a commit to branch url-connection-agent-cleanups
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git

commit b5294eeaf562137f718437fd8dd71259e04b1765
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Fri Jun 7 11:47:48 2019 +0200

    Send back user-agent to help identify which requests come through
---
 .../test/java/org/apache/sling/uca/impl/MisbehavingServerExtension.java | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/url-connection-agent/src/test/java/org/apache/sling/uca/impl/MisbehavingServerExtension.java b/url-connection-agent/src/test/java/org/apache/sling/uca/impl/MisbehavingServerExtension.java
index 702b82f..601adfd 100644
--- a/url-connection-agent/src/test/java/org/apache/sling/uca/impl/MisbehavingServerExtension.java
+++ b/url-connection-agent/src/test/java/org/apache/sling/uca/impl/MisbehavingServerExtension.java
@@ -94,6 +94,8 @@ class MisbehavingServerExtension implements BeforeAllCallback, AfterAllCallback,
             public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
                     throws IOException, ServletException {
                 response.setStatus(HttpServletResponse.SC_NO_CONTENT);
+                if ( baseRequest.getHeader("User-Agent") != null )
+                    response.addHeader("Original-User-Agent", baseRequest.getHeader("User-Agent"));
                 baseRequest.setHandled(true);
             }
         });