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


   @epugh I hadn't paid attention to the `Content-Length` before. It seems to 
be an issue with `HEAD` requests in general.
   
   ```
   $ curl -si 'http://localhost:8983/solr/techproducts/select?q=*%3A*&rows=0'
   HTTP/1.1 200 OK
   Content-Security-Policy: default-src 'none'; base-uri 'none'; connect-src 
'self'; form-action 'self'; font-src 'self'; frame-ancestors 'none'; img-src 
'self'; media-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self'; 
worker-src 'self';
   X-Content-Type-Options: nosniff
   X-Frame-Options: SAMEORIGIN
   X-XSS-Protection: 1; mode=block
   Content-Type: application/json;charset=utf-8
   Vary: Accept-Encoding, User-Agent
   Content-Length: 180
   
   {
     "responseHeader":{
       "status":0,
       "QTime":0,
       "params":{
         "q":"*:*",
         "rows":"0"}},
     "response":{"numFound":57,"start":0,"numFoundExact":true,"docs":[]
     }}
   
   $ curl -sI 'http://localhost:8983/solr/techproducts/select?q=*%3A*&rows=0'
   HTTP/1.1 200 OK
   Content-Security-Policy: default-src 'none'; base-uri 'none'; connect-src 
'self'; form-action 'self'; font-src 'self'; frame-ancestors 'none'; img-src 
'self'; media-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self'; 
worker-src 'self';
   X-Content-Type-Options: nosniff
   X-Frame-Options: SAMEORIGIN
   X-XSS-Protection: 1; mode=block
   Content-Type: application/json;charset=utf-8
   Content-Length: 0
   ```
   
   As far as my use case is concerned, the status code is what really matters 
to me. You could consider "all `HEAD` requests should respond with the correct 
`Content-Length`" as a separate issue. 😉
   
   My guess is that Jetty sets the `Content-Length` to the number of bytes in 
the response body. Maybe it's as simple as passing it the full response and 
trusting it to discard the body and only send the headers? At a performance 
cost compared to not sending or even building the body at all, probably.


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