thomascorthals commented on pull request #495:
URL: https://github.com/apache/solr/pull/495#issuecomment-1005223884


   I'm afraid setting `Content-Length: 0` is incorrect for a `HEAD` request.
   
   https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.4 (emphasis mine)
   >  The HEAD method is identical to GET except that the server MUST NOT 
return a message-body in the response. The metainformation contained in the 
**HTTP headers in response to a HEAD request SHOULD be identical to the 
information sent in response to a GET request**. This method can be used for 
obtaining metainformation about the entity implied by the request without 
transferring the entity-body itself. This method is often used for testing 
hypertext links for validity, accessibility, and recent modification.
   > 
   > The response to a HEAD request MAY be cacheable in the sense that the 
information contained in the response MAY be used to update a previously cached 
entity from that resource. If the new field values indicate that the cached 
entity differs from the current entity (as would be indicated by a change in 
Content-Length, Content-MD5, ETag or Last-Modified), then the cache MUST treat 
the cache entry as stale. 
   
   The [MDN Web 
Docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD) even use 
this as an explicit example.
   
   > For example, if a URL might produce a large download, a `HEAD` request 
could read its `Content-Length` header to check the filesize without actually 
downloading the file.


-- 
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