XRootD
XrdHttpCors.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the XRootD framework
3 //
4 // Copyright (c) 2025 by European Organization for Nuclear Research (CERN)
5 // Author: Cedric Caffy <cedric.caffy@cern.ch>
6 // File Date: Jun 2025
7 //------------------------------------------------------------------------------
8 // XRootD is free software: you can redistribute it and/or modify
9 // it under the terms of the GNU Lesser General Public License as published by
10 // the Free Software Foundation, either version 3 of the License, or
11 // (at your option) any later version.
12 //
13 // XRootD is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public License
19 // along with XRootD. If not, see <http://www.gnu.org/licenses/>.
20 //------------------------------------------------------------------------------
21 
22 #ifndef __XRD_HTTP_CORS_HEADERS__
23 #define __XRD_HTTP_CORS_HEADERS__
24 
25 #include <map>
26 #include <string>
27 #include <string_view>
28 #include <optional>
29 
30 
31 class XrdOucEnv;
32 class XrdOucErrInfo;
33 class XrdSysError;
34 
38 class XrdHttpCors {
39 public:
46  virtual int Configure(const char * configFN, XrdSysError *errP) = 0;
51  virtual void addAllowedOrigin(const std::string & origin) = 0;
61  virtual std::optional<std::string> getCORSAllowOriginHeader(const std::string & origin) = 0;
62 };
63 
64 typedef XrdHttpCors *(*XrdHttpCorsget_t)(XrdSysError *eDest,
65  const char *confg,
67 );
68 
69 // Define arguments to get the Cors handler here
70 #define XrdHttpCorsGetHandlerArgs
71 
73 
74 #endif
75 
static XrdSysError eDest(0,"crypto_")
#define XrdHttpCorsGetHandlerArgs
Definition: XrdHttpCors.hh:70
XrdHttpCors * XrdHttpCorsGetHandler(XrdHttpCorsGetHandlerArgs)
virtual void addAllowedOrigin(const std::string &origin)=0
virtual std::optional< std::string > getCORSAllowOriginHeader(const std::string &origin)=0
virtual int Configure(const char *configFN, XrdSysError *errP)=0
XrdOucEnv * envP
Definition: XrdPss.cc:109