You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by GitBox <gi...@apache.org> on 2022/10/27 03:48:59 UTC

[GitHub] [solr] risdenk opened a new pull request, #1140: SOLR-16274: HEAD request for managed resource returns 500 Server Error

risdenk opened a new pull request, #1140:
URL: https://github.com/apache/solr/pull/1140

   https://issues.apache.org/jira/browse/SOLR-16274


-- 
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-unsubscribe@solr.apache.org

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


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


[GitHub] [solr] risdenk commented on a diff in pull request #1140: SOLR-16274: HEAD request for managed resource returns 500 Server Error

Posted by GitBox <gi...@apache.org>.
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-unsubscribe@solr.apache.org

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


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


[GitHub] [solr] risdenk merged pull request #1140: SOLR-16274: HEAD request for managed resource returns 500 Server Error

Posted by GitBox <gi...@apache.org>.
risdenk merged PR #1140:
URL: https://github.com/apache/solr/pull/1140


-- 
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-unsubscribe@solr.apache.org

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


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