From 5510bb67194396342957301e2113dbaba887b18f Mon Sep 17 00:00:00 2001 From: Ritesh Varyani Date: Tue, 2 Jul 2024 00:55:21 +0530 Subject: [PATCH 1/3] Update ProxyHandler.java --- .../com/lyft/data/proxyserver/ProxyHandler.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/proxyserver/src/main/java/com/lyft/data/proxyserver/ProxyHandler.java b/proxyserver/src/main/java/com/lyft/data/proxyserver/ProxyHandler.java index 5923c5de..47c49cb1 100644 --- a/proxyserver/src/main/java/com/lyft/data/proxyserver/ProxyHandler.java +++ b/proxyserver/src/main/java/com/lyft/data/proxyserver/ProxyHandler.java @@ -54,14 +54,19 @@ protected void postConnectionHook( int offset, int length, Callback callback) { - try { - response.getOutputStream().write(buffer, offset, length); - callback.succeeded(); + try { + response.getOutputStream().write(buffer, offset, length); + if (response.getStatus() == HttpServletResponse.SC_BAD_GATEWAY) { + log.error("Received 502 Bad Gateway response for request URI: {}", request.getRequestURI()); + } + + callback.succeeded(); } catch (Throwable var9) { - callback.failed(var9); + log.error("Exception occurred while processing request URI: {}", request.getRequestURI(), var9); + callback.failed(var9); } } - + protected void debugLogHeaders(HttpServletRequest request) { if (log.isDebugEnabled()) { log.debug("-------HttpServletRequest headers---------"); From 09e893ee6bf691a682459a23789c0fa32cfe505a Mon Sep 17 00:00:00 2001 From: Ritesh Varyani Date: Mon, 1 Jul 2024 12:31:23 -0700 Subject: [PATCH 2/3] fixes --- .../lyft/data/proxyserver/ProxyHandler.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/proxyserver/src/main/java/com/lyft/data/proxyserver/ProxyHandler.java b/proxyserver/src/main/java/com/lyft/data/proxyserver/ProxyHandler.java index 47c49cb1..d05ca6bd 100644 --- a/proxyserver/src/main/java/com/lyft/data/proxyserver/ProxyHandler.java +++ b/proxyserver/src/main/java/com/lyft/data/proxyserver/ProxyHandler.java @@ -54,19 +54,19 @@ protected void postConnectionHook( int offset, int length, Callback callback) { - try { - response.getOutputStream().write(buffer, offset, length); - if (response.getStatus() == HttpServletResponse.SC_BAD_GATEWAY) { - log.error("Received 502 Bad Gateway response for request URI: {}", request.getRequestURI()); - } + try { + response.getOutputStream().write(buffer, offset, length); + if (response.getStatus() == HttpServletResponse.SC_BAD_GATEWAY) { + log.error("Received 502 Bad Gateway response for request URI: {}", request.getRequestURI()); + } - callback.succeeded(); + callback.succeeded(); } catch (Throwable var9) { - log.error("Exception occurred while processing request URI: {}", request.getRequestURI(), var9); - callback.failed(var9); + log.error("Exception occurred while processing request URI: {}", request.getRequestURI(), var9); + callback.failed(var9); } } - + protected void debugLogHeaders(HttpServletRequest request) { if (log.isDebugEnabled()) { log.debug("-------HttpServletRequest headers---------"); From ac4dc651c8cf9e94ef4ca2dbbf9cb364b6e94c09 Mon Sep 17 00:00:00 2001 From: Ritesh Varyani Date: Mon, 1 Jul 2024 12:39:43 -0700 Subject: [PATCH 3/3] more edits --- .../main/java/com/lyft/data/proxyserver/ProxyHandler.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/proxyserver/src/main/java/com/lyft/data/proxyserver/ProxyHandler.java b/proxyserver/src/main/java/com/lyft/data/proxyserver/ProxyHandler.java index d05ca6bd..71a9a5c7 100644 --- a/proxyserver/src/main/java/com/lyft/data/proxyserver/ProxyHandler.java +++ b/proxyserver/src/main/java/com/lyft/data/proxyserver/ProxyHandler.java @@ -57,12 +57,14 @@ protected void postConnectionHook( try { response.getOutputStream().write(buffer, offset, length); if (response.getStatus() == HttpServletResponse.SC_BAD_GATEWAY) { - log.error("Received 502 Bad Gateway response for request URI: {}", request.getRequestURI()); + log.error("Received 502 Bad Gateway response for request URI: {}", + request.getRequestURI()); } callback.succeeded(); } catch (Throwable var9) { - log.error("Exception occurred while processing request URI: {}", request.getRequestURI(), var9); + log.error("Exception occurred while processing request URI: {}", request.getRequestURI(), + var9); callback.failed(var9); } }