From 56b8cfc06e510c694977810c0dbadf8c295c27d1 Mon Sep 17 00:00:00 2001 From: Andreas Joachim Peters Date: Thu, 10 Jan 2019 09:42:36 +0100 Subject: [PATCH] XrdHttp: allow to use StartSimpleResp and SendData without breaking ABI - otherwise large files cannot be returned using the external handler --- src/XrdHttp/XrdHttpExtHandler.cc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/XrdHttp/XrdHttpExtHandler.cc b/src/XrdHttp/XrdHttpExtHandler.cc index d73c13bc6b5..ba4ce8dccb5 100644 --- a/src/XrdHttp/XrdHttpExtHandler.cc +++ b/src/XrdHttp/XrdHttpExtHandler.cc @@ -31,7 +31,20 @@ int XrdHttpExtReq::SendSimpleResp(int code, const char* desc, const char* header_to_add, const char* body, long long int bodylen) { if (!prot) return -1; - + + // @FIXME + // - need this to circumvent missing API calls and keep ABI compatibility + // - when large files are returned we cannot return them in a single buffer + // @TODO: for XRootD 5.0 this two hidden calls should just be added to the external handler API and the code here can be removed + + if ( code == 0 ) { + return prot->StartSimpleResp(200, desc, header_to_add, bodylen, true); + } + + if ( code == 1 ) { + return prot->SendData(body, bodylen); + } + return prot->SendSimpleResp(code, desc, header_to_add, body, bodylen, true); }