From 88dad6ab1a1062749ba5e9ca5e0e9b98acbcddab Mon Sep 17 00:00:00 2001 From: Brian Bockelman Date: Mon, 10 Sep 2018 23:40:51 -0500 Subject: [PATCH 1/2] Do not increment reqstate when headers are incomplete. If the server got incomplete headers (I was able to reliably trigger this with connection reuse), the reqstate variable was still incremented. This resulted in the request state becoming inconsistent - notably, HEAD requests believed they always included a checksum. There are likely other strange XrdHttp behaviors that could have been triggered due to the same bug. --- src/XrdHttp/XrdHttpProtocol.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/XrdHttp/XrdHttpProtocol.cc b/src/XrdHttp/XrdHttpProtocol.cc index 193d88ba0a9..77c975a368b 100644 --- a/src/XrdHttp/XrdHttpProtocol.cc +++ b/src/XrdHttp/XrdHttpProtocol.cc @@ -692,6 +692,7 @@ int XrdHttpProtocol::Process(XrdLink *lp) // We ignore the argument here if (!CurrentReq.headerok) { TRACEI(REQ, " rc:" << rc << "Header not yet complete."); + CurrentReq.reqstate--; // Waiting for more data return 1; } From fbd3861df939d4c451b23b43a7d924c427f64da2 Mon Sep 17 00:00:00 2001 From: Brian Bockelman Date: Mon, 10 Sep 2018 23:44:38 -0500 Subject: [PATCH 2/2] Apply correct test for strcasecmp return value. We were applying the wrong test to strcasecmp's return value, resulting in the server often (incorrectly) assuming that we were supposed to compute the SHA1 checksum. --- src/XrdHttp/XrdHttpReq.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/XrdHttp/XrdHttpReq.cc b/src/XrdHttp/XrdHttpReq.cc index 6bb3d93707a..be83634edfd 100644 --- a/src/XrdHttp/XrdHttpReq.cc +++ b/src/XrdHttp/XrdHttpReq.cc @@ -72,13 +72,13 @@ static XrdOucString convert_digest_name(const std::string &rfc_name) return "md5"; } else if (!strcasecmp(rfc_name.c_str(), "adler32")) { return "adler32"; - } else if (strcasecmp(rfc_name.c_str(), "SHA")) { + } else if (!strcasecmp(rfc_name.c_str(), "SHA")) { return "sha1"; - } else if (strcasecmp(rfc_name.c_str(), "SHA-256")) { + } else if (!strcasecmp(rfc_name.c_str(), "SHA-256")) { return "sha256"; - } else if (strcasecmp(rfc_name.c_str(), "SHA-512")) { + } else if (!strcasecmp(rfc_name.c_str(), "SHA-512")) { return "sha512"; - } else if (strcasecmp(rfc_name.c_str(), "UNIXcksum")) { + } else if (!strcasecmp(rfc_name.c_str(), "UNIXcksum")) { return "cksum"; } return "unknown";