From c469ba6e072e88da7bd706f015178bdde8f9a6e1 Mon Sep 17 00:00:00 2001 From: Brian Bockelman Date: Sat, 30 Jan 2021 09:12:06 -0600 Subject: [PATCH] XrdHttp: Fix empty PUT If the remote client is trying to create an empty file, the state machine broke because it was waiting for more bytes from the bridge before advancing the query. This short-circuits the wait and causes an immediate callback, allowing XrdHttp to immediately close the file. --- src/XrdHttp/XrdHttpReq.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/XrdHttp/XrdHttpReq.cc b/src/XrdHttp/XrdHttpReq.cc index 89898c462f2..460a1108ccc 100644 --- a/src/XrdHttp/XrdHttpReq.cc +++ b/src/XrdHttp/XrdHttpReq.cc @@ -1365,8 +1365,9 @@ int XrdHttpReq::ProcessHTTPReq() { // We want to be invoked again after this request is finished - // Only if there is data to fetch from the socket - if (prot->BuffUsed() > 0) + // Only if there is data to fetch from the socket or there will + // never be more data + if (prot->BuffUsed() > 0 || length == 0) return 0; return 1;