risdenk commented on code in PR #1140:
URL: https://github.com/apache/solr/pull/1140#discussion_r1006379673


##########
solr/core/src/java/org/apache/solr/rest/RestManager.java:
##########
@@ -355,10 +355,7 @@ public void delegateRequestToManagedResource() {
     }
 
     private void doHead(ManagedEndpoint managedEndpoint) {
-      // Setting the response to blank clears the content out,
-      // however it also means the Content-Length HTTP Header is set to 0
-      // which isn't compliant with the specification of how HEAD should work,
-      // it should instead return the length of the content if you did a GET.

Review Comment:
   This is an incorrect statement about head request and `Content-Length` see 
https://www.rfc-editor.org/rfc/rfc9110.html#name-head



##########
solr/core/src/java/org/apache/solr/core/SolrCore.java:
##########
@@ -2938,6 +2938,7 @@ public static void postDecorateResponse(
       SolrRequestHandler handler, SolrQueryRequest req, SolrQueryResponse rsp) 
{
     // TODO should check that responseHeader has not been replaced by handler
     NamedList<Object> responseHeader = rsp.getResponseHeader();
+    if (responseHeader == null) return;

Review Comment:
   This avoids NPE when there is no response header - like in a HEAD request.



##########
solr/test-framework/src/java/org/apache/solr/util/RestTestBase.java:
##########
@@ -152,6 +152,12 @@ public static void assertQ(String request, String... 
tests) {
     }
   }
 
+  public static void assertHead(String request, int expectedStatusCode) throws 
IOException {
+    String response = restTestHarness.head(request);

Review Comment:
   String is passed around to avoid tying `RestTestBase` to the actually 
httpclient implementation.



-- 
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: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to