There seems to be no way of specifying the Content-Length value for a HEAD request without actually sending also some body information. This limitation comes from the API of the XrdHttpExHandler more precisely SendSimpleReponse/StartSimpleResponse and then propagated to the XrdHttpProtocol corresponding methods.
https://github.com/xrootd/xrootd/blob/master/src/XrdHttp/XrdHttpProtocol.cc#L1564
Moreover there is no check to avoid collision between the already provided header info (*header_to_add parameter in the signature of the function above) and the ones which are added by default by this method.
The response to a simple HEAD request looks like this:
curl -L -v --capath /etc/grid-security/certificates --cert ~/.globus/usercert.pem --cacert ~/.globus/usercert.pem --key ~/.globus/userkey.pem -X HEAD https://esdss000.cern.ch:9000//eos/dev/replica/file2.dat
> HEAD //eos/dev/replica/file2.dat HTTP/1.1
> User-Agent: curl/7.29.0
> Host: esdss000.cern.ch:9000
> Accept: */*
>
< HTTP/1.1 200 OK
< Connection: Keep-Alive
< Content-Length: 0
< Accept-Ranges: bytes
< Content-Disposition: filename="file2.dat"
< Content-Type: application/octet-stream
< Date: Fri, 19 Jun 2020 11:15:35 GMT
< ETag: "24856854790144:74d77c3a"
< Last-Modified: Fri, 19 Jun 2020 11:08:31 GMT
<
* Connection #0 to host esdss000.cern.ch left intact
Note the Content-Length value 0 which corresponds to a 0-body response. If I try calling the SendSimpleResponse without a body but with some length then the client hangs due to the Keep-Alive
header which instructs the client the wait for data that will never come. The Content-Length
is now properly populated but there is no hook to remove the Keep-Alive
header.
If I try adding the Content-Length
value to the header_to_add
parameter, then the response contains two Content-Length
headers!!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Use REPLY-ALL to reply to list
To unsubscribe from the XROOTD-DEV list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=XROOTD-DEV&A=1