Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[XrdHttp] Wrong checksum picked if weighted checksum passed by the user #1944

Closed
ccaffy opened this issue Mar 7, 2023 · 2 comments · Fixed by #1950
Closed

[XrdHttp] Wrong checksum picked if weighted checksum passed by the user #1944

ccaffy opened this issue Mar 7, 2023 · 2 comments · Fixed by #1950
Assignees
Milestone

Comments

@ccaffy
Copy link
Contributor

ccaffy commented Mar 7, 2023

When the server has two checksums configured xrootd.cksum crc32 adler32, if they
give the "Want-Digest" header value sha-512,sha-256;q=0.8,sha;q=0.6,md5;q=0.4,adler32;q=0.2,
the first configured checksum will be returned.

This is due to the string comparison to choose the checksum algorithm to run that does not take into account the weight ";q=xx" that can be given by the user.

@ccaffy ccaffy self-assigned this Mar 7, 2023
@amadio amadio added this to the 5.5.4 milestone Mar 7, 2023
@xrootd-dev
Copy link

xrootd-dev commented Mar 7, 2023 via email

@ccaffy
Copy link
Contributor Author

ccaffy commented Mar 7, 2023

That's what I found when I tried to put this weighted-checksum want-digest value.

$ cat xrd_http.cfg | grep chksum
xrootd.chksum crc32 adler32
[xrootddev@xrootd-ccaffy-dev01 http_server_certificate_tests]$ curl -I -H "Want-Digest: sha-512,sha-256;q=0.8,sha;q=0.6,md5;q=0.4,adler32;q=0.2"  -L https://xrootd-ccaffy-dev01.cern.ch:1096/tmp/bigfile_5M_copy
HTTP/1.1 200 OK
Connection: Keep-Alive
Server: XrootD/v5.2.0-99-osghotfix...687
Content-Length: 15
Digest: crc32=06c3f8e8

I asked the adler32 checksum in the list, but you see, I get a CRC32 one because it is the first configured in the server config list.

That's because the algorithm looking for the checksum to run from the user list does strict string comparison --> no algorithm is found and the first configured one is computed.

With my new fix that discards the ;q=xx (not pushed yet), it works as expected:

[xrootddev@xrootd-ccaffy-dev01 http_server_certificate_tests]$ curl -I -H "Want-Digest: sha-512,sha-256;q=0.8,sha;q=0.6,md5;q=0.4,adler32;q=0.2"  -L https://xrootd-ccaffy-dev01.cern.ch:1096/tmp/bigfile_5M_copy
HTTP/1.1 200 OK
Connection: Keep-Alive
Server: XrootD/v5.2.0-99-osghotfix...687
Content-Length: 15
Digest: adler32=2204040b
Accept-Ranges: byte

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants