[ 
https://issues.apache.org/jira/browse/KNOX-3248?focusedWorklogId=1003470&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1003470
 ]

ASF GitHub Bot logged work on KNOX-3248:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 04/Feb/26 12:57
            Start Date: 04/Feb/26 12:57
    Worklog Time Spent: 10m 
      Work Description: hanicz commented on code in PR #1143:
URL: https://github.com/apache/knox/pull/1143#discussion_r2763890590


##########
gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteResponseTest.java:
##########
@@ -165,6 +165,33 @@ public void testStreamResponse() throws IOException {
     testStreamResponse(content, rewriteResponse, "deflate");
   }
 
+  @Test
+  public void testStreamEmptyGzipResponse() throws IOException {

Review Comment:
   You can just add the below to make sure the filter is there.
   
   ```
       HttpServletRequest request = 
EasyMock.createNiceMock(HttpServletRequest.class);
       
EasyMock.expect(request.getContentType()).andReturn("application/json").anyTimes();
       HttpServletResponse response = 
EasyMock.createNiceMock(HttpServletResponse.class);
       
EasyMock.expect(response.getContentType()).andReturn("application/json").anyTimes();
   ```
   
   However it won't fix the test case. You provide the `gzip` contentType to 
testStreamResponse method which will create the GZIPOutputStream so it will 
walk into the isGzip case. You have to make sure also that the 
`contentEncoding` in UrlRewriteResponse class is set to `gzip`. You should 
write a test case that fails without your modification first and go from there. 





Issue Time Tracking
-------------------

    Worklog Id:     (was: 1003470)
    Time Spent: 1h 20m  (was: 1h 10m)

> Knox Gateway + Livy HA mode gzip exception results in duplicated requests and 
> unneeded failovers
> ------------------------------------------------------------------------------------------------
>
>                 Key: KNOX-3248
>                 URL: https://issues.apache.org/jira/browse/KNOX-3248
>             Project: Apache Knox
>          Issue Type: Improvement
>    Affects Versions: 2.0.0
>            Reporter: Nilesh Rathi
>            Priority: Major
>             Fix For: 2.1.0
>
>          Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> While using Apache Knox as a gateway for Livy in a High Availability (HA) 
> environment, a race condition/logic error occurs in the rewrite provider when 
> Knox receives a 307 Temporary Redirect from a standby node.
> throws:{{{}{}}}
> {code:java}
> IOException: Input is not in the .gz format{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to