goutamadwant commented on code in PR #19178:
URL: https://github.com/apache/pinot/pull/19178#discussion_r4112677271


##########
pinot-common/src/main/java/org/apache/pinot/common/utils/http/HttpClient.java:
##########
@@ -343,13 +398,58 @@ public SimpleHttpResponse sendMultipartPostRequest(String 
url, String body, @Nul
 
   private static String httpEntityToString(HttpEntity httpEntity)
       throws IOException {
+    return httpEntityToString(httpEntity, Integer.MAX_VALUE);
+  }
+
+  private static String httpEntityToString(HttpEntity httpEntity, int 
maxResponseLength)
+      throws IOException {
     try {
-      return EntityUtils.toString(httpEntity);
+      return EntityUtils.toString(httpEntity, maxResponseLength);
     } catch (ParseException exception) {
       throw new RuntimeException(exception);
     }
   }
 
+  private static BoundedResponseContent readResponseContent(HttpEntity 
httpEntity, int maxResponseLength)
+      throws IOException {
+    Preconditions.checkArgument(maxResponseLength >= 0, "Maximum response 
length must be non-negative");
+    if (maxResponseLength == Integer.MAX_VALUE) {

Review Comment:
   Moved the null-entity check ahead of both bounded and default response 
decoding, so bodyless responses return their HTTP status without attempting 
entity conversion.
   
   Added regressions for a bodyless 304 through both the default and bounded 
request paths, plus a bodyless HEAD 503 response.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to