24#ifndef __XRDHTTP_PROTOCOL_H__
25#define __XRDHTTP_PROTOCOL_H__
53#include <openssl/ssl.h>
65#define __attribute__(x)
91 if (Resume) (*this.*Resume)();
108 int Stats(
char *buff,
int blen,
int do_sync = 0);
150 static bool InitTLS();
153 static bool InitSecurity();
156 int StartSimpleResp(
int code,
const char *desc,
const char *header_to_add,
long long bodylen,
bool keepalive);
159 int SendData(
const char *body,
int bodylen);
169 int HandleAuthentication(
XrdLink* lp);
180 int HandleGridMap(
XrdLink* lp,
const char * eechash);
184 int getDataOneShot(
int blen,
bool wait=
false);
187 static BIO *CreateBIO(
XrdLink *lp);
197 extHInfo(
const char *hName,
const char *hPath,
const char *hParm,
const bool hNoTlsOK)
198 : extHName(hName), extHPath(hPath), extHParm(hParm), extHNoTlsOK(hNoTlsOK) {}
202 static int Config(
const char *fn,
XrdOucEnv *myEnv);
203 static const char *Configed();
208 static int xexthandler(
XrdOucStream & Config, std::vector<extHInfo> &hiVec);
227 static bool isRequiredXtractor;
233 const char *libParms);
236 #define MAX_XRDHTTPEXTHANDLERS 4
237 static struct XrdHttpExtHandlerInfo {
241 static int exthandlercnt;
243 static int LoadExtHandlerNoTls(std::vector<extHInfo> &hiVec,
247 static int LoadExtHandler(std::vector<extHInfo> &hiVec,
251 const char *configFN,
const char *libParms,
261 static bool ExtHandlerLoaded(
const char *handlername);
266 char *myBuffStart, *myBuffEnd;
279 void BuffConsume(
int blen);
281 int BuffgetData(
int blen,
char **data,
bool wait);
286 int SendSimpleResp(
int code,
const char *desc,
const char *header_to_add,
const char *body,
long long bodylen,
bool keepalive);
290 int StartChunkedResp(
int code,
const char *desc,
const char *header_to_add,
long long bodylen,
bool keepalive);
294 int ChunkResp(
const char *body,
long long bodylen);
298 int ChunkRespHeader(
long long bodylen);
301 int ChunkRespFooter();
304 char *GetClientIPStr();
322 static BIO *sslbio_err;
#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 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 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.