24 #ifndef __XRDHTTP_PROTOCOL_H__
25 #define __XRDHTTP_PROTOCOL_H__
39 #include <sys/types.h>
53 #include <openssl/ssl.h>
55 #include <unordered_map>
66 #define __attribute__(x)
76 struct XrdVersionInfo;
92 if (Resume) (*this.*Resume)();
109 int Stats(
char *buff,
int blen,
int do_sync = 0);
154 static bool InitSecurity();
157 int StartSimpleResp(
int code,
const char *desc,
const char *header_to_add,
long long bodylen,
bool keepalive);
160 int SendData(
const char *body,
int bodylen);
170 int HandleAuthentication(
XrdLink* lp);
181 int HandleGridMap(
XrdLink* lp,
const char * eechash);
185 int getDataOneShot(
int blen,
bool wait=
false);
188 static BIO *CreateBIO(
XrdLink *lp);
198 extHInfo(
const char *hName,
const char *hPath,
const char *hParm,
const bool hNoTlsOK)
199 : extHName(hName), extHPath(hPath), extHParm(hParm), extHNoTlsOK(hNoTlsOK) {}
203 static int Config(
const char *fn,
XrdOucEnv *myEnv);
204 static const char *Configed();
209 static int xexthandler(
XrdOucStream & Config, std::vector<extHInfo> &hiVec);
230 static bool isRequiredXtractor;
236 const char *libParms);
239 #define MAX_XRDHTTPEXTHANDLERS 4
240 static struct XrdHttpExtHandlerInfo {
244 static int exthandlercnt;
246 static int LoadExtHandlerNoTls(std::vector<extHInfo> &hiVec,
250 static int LoadExtHandler(std::vector<extHInfo> &hiVec,
254 const char *configFN,
const char *libParms,
264 static bool ExtHandlerLoaded(
const char *handlername);
269 char *myBuffStart, *myBuffEnd;
282 void BuffConsume(
int blen);
284 int BuffgetData(
int blen,
char **data,
bool wait);
289 int SendSimpleResp(
int code,
const char *desc,
const char *header_to_add,
const char *body,
long long bodylen,
bool keepalive);
293 int StartChunkedResp(
int code,
const char *desc,
const char *header_to_add,
long long bodylen,
bool keepalive);
297 int ChunkResp(
const char *body,
long long bodylen);
301 int ChunkRespHeader(
long long bodylen);
304 int ChunkRespFooter();
307 char *GetClientIPStr();
325 static BIO *sslbio_err;
458 static std::unordered_map<std::string, std::vector<std::pair<std::string, std::string>>>
m_staticheader_map;
#define MAX_XRDHTTPEXTHANDLERS
Main request/response class, handling the logical status of the communication.
static char * secretkey
The key used to calculate the url hashes.
static BIO_METHOD * m_bio_method
C-style vptr table for our custom BIO objects.
static char * gridmap
Gridmap file location. The same used by XrdSecGsi.
static XrdScheduler * Sched
static kXR_int32 myRole
Our role.
static XrdNetPMark * pmarkHandle
Packet marking handler pointer (assigned from the environment during the Config() call)
static char * Port_str
Our port, as a string.
XrdXrootd::Bridge * Bridge
The Bridge that we use to exercise the xrootd internals.
static char * staticredir
static bool selfhttps2http
If client is HTTPS, self-redirect with HTTP+token.
static XrdHttpChecksumHandler cksumHandler
static XrdOucGMap * servGMap
The instance of the DN mapper. Created only when a valid path is given.
static int hailWait
Timeout for reading the handshake.
int doChksum(const XrdOucString &fname)
Perform a checksum request.
static XrdOucHash< StaticPreloadInfo > * staticpreload
static char * xrd_cslist
The list of checksums that were configured via the xrd.cksum parameter on the server config file.
static char * sslcipherfilter
static int m_bio_type
Type identifier for our custom BIO objects.
static std::map< std::string, std::string > hdr2cgimap
Rules that turn HTTP headers to cgi tokens in the URL, for internal comsumption.
static char * sslcert
OpenSSL stuff.
XrdLink * Link
The link we are bound to.
int doStat(char *fname)
Perform a Stat request.
XrdObject< XrdHttpProtocol > ProtLink
static int readWait
Timeout for reading data.
void Recycle(XrdLink *lp, int consec, const char *reason)
Recycle this instance.
void DoIt()
Override from the base class.
XrdHttpProtocol operator=(const XrdHttpProtocol &rhs)
bool isHTTPS()
called via https
static bool compatNameGeneration
static bool isdesthttps
True if the redirections must be towards https targets.
static XrdObjectQ< XrdHttpProtocol > ProtStack
XrdProtocol * Match(XrdLink *lp)
Tells if the oustanding bytes on the socket match this protocol implementation.
static std::unordered_map< std::string, std::vector< std::pair< std::string, std::string > > > m_staticheader_map
The static headers to always return; map is from verb to a list of (header, val) pairs.
static bool isRequiredGridmap
static char * listredir
Url to redirect to in the case a listing is requested.
int Stats(char *buff, int blen, int do_sync=0)
Get activity stats.
static std::unordered_map< std::string, std::string > m_staticheaders
static int crlRefIntervalSec
CRL thread refresh interval.
static XrdHttpReadRangeHandler::Configuration ReadRangeConfig
configuration for the read range handler
static XrdSecService * CIA
static XrdBuffManager * BPool
static bool tpcForwardCreds
If set to true, the HTTP TPC transfers will forward the credentials to redirected hosts.
int Process(XrdLink *lp)
Process data incoming from the socket.
XrdHttpProtocol(const XrdHttpProtocol &)=default
Ctor, dtors and copy ctor.
static bool listdeny
If true, any form of listing is denied.
static int parseHeader2CGI(XrdOucStream &Config, XrdSysError &err, std::map< std::string, std::string > &header2cgi)
Use this function to parse header2cgi configurations.
XrdSecEntity SecEntity
Authentication area.
static bool embeddedstatic
If true, use the embedded css and icons.
static int sslverifydepth
Depth of verification of a certificate chain.
static int Configure(char *parms, XrdProtocol_Config *pi)
Read and apply the configuration.