24#ifndef __XRDHTTP_PROTOCOL_H__
25#define __XRDHTTP_PROTOCOL_H__
53#include <openssl/ssl.h>
65#define __attribute__(x)
105 int Stats(
char *buff,
int blen,
int do_sync = 0);
153 int StartSimpleResp(
int code,
const char *desc,
const char *header_to_add,
long long bodylen,
bool keepalive);
194 extHInfo(
const char *hName,
const char *hPath,
const char *hParm)
229 const char *libParms);
232 #define MAX_XRDHTTPEXTHANDLERS 4
244 const char *configFN,
const char *libParms,
279 int SendSimpleResp(
int code,
const char *desc,
const char *header_to_add,
const char *body,
long long bodylen,
bool keepalive);
283 int StartChunkedResp(
int code,
const char *desc,
const char *header_to_add,
long long bodylen,
bool keepalive);
int kXR_int32
Definition XPtypes.hh:89
#define MAX_XRDHTTPEXTHANDLERS
Definition XrdHttpProtocol.hh:232
Main request/response class, handling the logical status of the communication.
Definition XrdBuffer.hh:72
Definition XrdBuffer.hh:42
Definition XrdCryptoFactory.hh:122
Definition XrdHttpChecksumHandler.hh:85
Definition XrdHttpExtHandler.hh:88
Definition XrdHttpExtHandler.hh:47
Definition XrdHttpProtocol.hh:79
void BuffConsume(int blen)
Consume some bytes from the buffer.
static XrdCryptoFactory * myCryptoFactory
Definition XrdHttpProtocol.hh:320
int BuffFree()
How many bytes free in the buffer.
static BIO * sslbio_err
bio to print SSL errors
Definition XrdHttpProtocol.hh:312
void Reset()
Reset values, counters, in order to reutilize an object of this class.
int BuffUsed()
How many bytes in the buffer.
int HandleGridMap(XrdLink *lp, const char *eechash)
static kXR_int32 myRole
Our role.
Definition XrdHttpProtocol.hh:424
static char * sslcafile
Definition XrdHttpProtocol.hh:382
int ChunkRespHeader(long long bodylen)
Send the beginning of a chunked response but not the body; useful when the size.
static int xlistredir(XrdOucStream &Config)
static int LoadExtHandler(std::vector< extHInfo > &hiVec, const char *cFN, XrdOucEnv &myEnv)
static XrdOucHash< StaticPreloadInfo > * staticpreload
Definition XrdHttpProtocol.hh:421
static char * listredir
Url to redirect to in the case a listing is requested.
Definition XrdHttpProtocol.hh:402
static bool InitTLS()
Initialization of the ssl security things.
static int Configure(char *parms, XrdProtocol_Config *pi)
Read and apply the configuration.
static int xsecretkey(XrdOucStream &Config)
static int xembeddedstatic(XrdOucStream &Config)
static const char * Configed()
XrdXrootd::Bridge * Bridge
The Bridge that we use to exercise the xrootd internals.
Definition XrdHttpProtocol.hh:357
static XrdSysError eDest
Definition XrdHttpProtocol.hh:343
static char * xrd_cslist
The list of checksums that were configured via the xrd.cksum parameter on the server config file.
Definition XrdHttpProtocol.hh:436
void Cleanup()
Deallocate resources, in order to reutilize an object of this class.
static bool selfhttps2http
If client is HTTPS, self-redirect with HTTP+token.
Definition XrdHttpProtocol.hh:408
static XrdHttpSecXtractor * secxtractor
Definition XrdHttpProtocol.hh:224
static XrdHttpChecksumHandler cksumHandler
Definition XrdHttpProtocol.hh:132
static int hailWait
Timeout for reading the handshake.
Definition XrdHttpProtocol.hh:370
static int xdesthttps(XrdOucStream &Config)
int doChksum(const XrdOucString &fname)
Perform a checksum request.
static int xexthandler(XrdOucStream &Config, std::vector< extHInfo > &hiVec)
static char * sslcipherfilter
Definition XrdHttpProtocol.hh:382
static int m_bio_type
Type identifier for our custom BIO objects.
Definition XrdHttpProtocol.hh:430
static std::map< std::string, std::string > hdr2cgimap
Rules that turn HTTP headers to cgi tokens in the URL, for internal comsumption.
Definition XrdHttpProtocol.hh:427
XrdHttpProtocol(bool imhttps)
static int xtlsreuse(XrdOucStream &Config)
static int xsslkey(XrdOucStream &Config)
static int LoadExtHandler(XrdSysError *eDest, const char *libName, const char *configFN, const char *libParms, XrdOucEnv *myEnv, const char *instName)
static int xgmap(XrdOucStream &Config)
static char * gridmap
Gridmap file location. The same used by XrdSecGsi.
Definition XrdHttpProtocol.hh:388
static int xselfhttps2http(XrdOucStream &Config)
static int xsslcafile(XrdOucStream &Config)
static int xstaticredir(XrdOucStream &Config)
static bool ExtHandlerLoaded(const char *handlername)
bool ssldone
Definition XrdHttpProtocol.hh:319
XrdLink * Link
The link we are bound to.
Definition XrdHttpProtocol.hh:347
static char * sslkey
Definition XrdHttpProtocol.hh:382
int doStat(char *fname)
Perform a Stat request.
XrdObject< XrdHttpProtocol > ProtLink
Definition XrdHttpProtocol.hh:125
static int readWait
Timeout for reading data.
Definition XrdHttpProtocol.hh:373
void Recycle(XrdLink *lp, int consec, const char *reason)
Recycle this instance.
BIO * sbio
Private SSL bio.
Definition XrdHttpProtocol.hh:309
int ChunkResp(const char *body, long long bodylen)
Send a (potentially partial) body in a chunked response; invoking with NULL body.
static int xsslcipherfilter(XrdOucStream &Config)
static XrdOucGMap * servGMap
The instance of the DN mapper. Created only when a valid path is given.
Definition XrdHttpProtocol.hh:354
void DoIt()
Override from the base class.
Definition XrdHttpProtocol.hh:90
static BIO * CreateBIO(XrdLink *lp)
Create a new BIO object from an XrdLink. Returns NULL on failure.
int GetVOMSData(XrdLink *lp)
XrdOucString tmpline
A nice var to hold the current header line.
Definition XrdHttpProtocol.hh:262
static int xheader2cgi(XrdOucStream &Config)
long ResumeBytes
Tells that we are just waiting to have N bytes in the buffer.
Definition XrdHttpProtocol.hh:303
static int LoadSecXtractor(XrdSysError *eDest, const char *libName, const char *libParms)
static int xsslcert(XrdOucStream &Config)
int BuffgetLine(XrdOucString &dest)
Copy a full line of text from the buffer into dest. Zero if no line can be found in the buffer.
static BIO_METHOD * m_bio_method
C-style vptr table for our custom BIO objects.
Definition XrdHttpProtocol.hh:433
static XrdScheduler * Sched
Definition XrdHttpProtocol.hh:341
static char * sslcadir
Definition XrdHttpProtocol.hh:382
int BuffAvailable()
How many bytes still fit into the buffer in a contiguous way.
static XrdSecService * CIA
Definition XrdHttpProtocol.hh:344
static char * Port_str
Our port, as a string.
Definition XrdHttpProtocol.hh:379
XrdHttpProtocol operator=(const XrdHttpProtocol &rhs)
static XrdBuffManager * BPool
Definition XrdHttpProtocol.hh:342
bool isHTTPS()
called via https
Definition XrdHttpProtocol.hh:138
static int xstaticpreload(XrdOucStream &Config)
static bool compatNameGeneration
Definition XrdHttpProtocol.hh:390
static int Config(const char *fn, XrdOucEnv *myEnv)
Functions related to the configuration.
static int xhttpsmode(XrdOucStream &Config)
int SendData(const char *body, int bodylen)
Send some generic data to the client.
static int xsecxtractor(XrdOucStream &Config)
static bool isdesthttps
True if the redirections must be towards https targets.
Definition XrdHttpProtocol.hh:399
XrdBuffer * myBuff
Circular Buffer used to read the request.
Definition XrdHttpProtocol.hh:257
int getDataOneShot(int blen, bool wait=false)
static char * secretkey
The key used to calculate the url hashes.
Definition XrdHttpProtocol.hh:393
XrdProtocol * Match(XrdLink *lp)
Tells if the oustanding bytes on the socket match this protocol implementation.
SSL * ssl
Private SSL context.
Definition XrdHttpProtocol.hh:306
static char * sslcert
OpenSSL stuff.
Definition XrdHttpProtocol.hh:382
static bool usingEC
Definition XrdHttpProtocol.hh:226
int BuffgetData(int blen, char **data, bool wait)
Get a pointer, valid for up to blen bytes from the buffer. Returns the validity.
static int xlistdeny(XrdOucStream &Config)
static bool isRequiredGridmap
Definition XrdHttpProtocol.hh:389
static int xtrace(XrdOucStream &Config)
int HandleAuthentication(XrdLink *lp)
int StartSimpleResp(int code, const char *desc, const char *header_to_add, long long bodylen, bool keepalive)
Start a response back to the client.
static struct XrdHttpProtocol::XrdHttpExtHandlerInfo exthandler[MAX_XRDHTTPEXTHANDLERS]
static int xsslverifydepth(XrdOucStream &Config)
int Stats(char *buff, int blen, int do_sync=0)
Get activity stats.
int SendSimpleResp(int code, const char *desc, const char *header_to_add, const char *body, long long bodylen, bool keepalive)
Sends a basic response. If the length is < 0 then it is calculated internally.
XrdHttpReq CurrentReq
Definition XrdHttpProtocol.hh:362
static int crlRefIntervalSec
CRL thread refresh interval.
Definition XrdHttpProtocol.hh:385
static bool isRequiredXtractor
Definition XrdHttpProtocol.hh:223
char * GetClientIPStr()
Gets a string that represents the IP address of the client. Must be freed.
int StartChunkedResp(int code, const char *desc, const char *header_to_add, long long bodylen, bool keepalive)
Starts a chunked response; body of request is sent over multiple parts using the SendChunkResp.
static int Port
Our port.
Definition XrdHttpProtocol.hh:376
static XrdHttpReadRangeHandler::Configuration ReadRangeConfig
configuration for the read range handler
Definition XrdHttpProtocol.hh:135
bool ishttps
Tells if the client is https.
Definition XrdHttpProtocol.hh:315
char * myBuffEnd
Definition XrdHttpProtocol.hh:259
static int exthandlercnt
Definition XrdHttpProtocol.hh:237
static bool InitSecurity()
Initialization fo security addon.
int Process(XrdLink *lp)
Process data incoming from the socket.
XrdHttpProtocol(const XrdHttpProtocol &)=default
Ctor, dtors and copy ctor.
static char * staticredir
Definition XrdHttpProtocol.hh:414
~XrdHttpProtocol()
Definition XrdHttpProtocol.hh:120
static int xsslcadir(XrdOucStream &Config)
bool DoingLogin
Tells that we are just logging in.
Definition XrdHttpProtocol.hh:300
static XrdNetPMark * pmarkHandle
Packet marking handler pointer (assigned from the environment during the Config() call)
Definition XrdHttpProtocol.hh:439
char * myBuffStart
The circular pointers.
Definition XrdHttpProtocol.hh:259
static bool listdeny
If true, any form of listing is denied.
Definition XrdHttpProtocol.hh:405
XrdSecEntity SecEntity
Authentication area.
Definition XrdHttpProtocol.hh:129
static XrdObjectQ< XrdHttpProtocol > ProtStack
Definition XrdHttpProtocol.hh:124
int ChunkRespFooter()
Send the footer of the chunk response.
static bool embeddedstatic
If true, use the embedded css and icons.
Definition XrdHttpProtocol.hh:411
char * Addr_str
Definition XrdHttpProtocol.hh:351
int(XrdHttpProtocol::* Resume)()
The resume function.
Definition XrdHttpProtocol.hh:144
static int sslverifydepth
Depth of verification of a certificate chain.
Definition XrdHttpProtocol.hh:396
static XrdHttpExtHandler * FindMatchingExtHandler(const XrdHttpReq &)
Definition XrdHttpReq.hh:71
Definition XrdHttpSecXtractor.hh:42
Definition XrdNetPMark.hh:39
Definition XrdObject.hh:90
Definition XrdObject.hh:52
Definition XrdOucEnv.hh:42
Definition XrdOucGMap.hh:49
Definition XrdOucHash.hh:128
Definition XrdOucStream.hh:47
Definition XrdOucString.hh:254
Definition XrdOucTokenizer.hh:33
Definition XrdOucTrace.hh:36
Definition XrdProtocol.hh:56
Definition XrdProtocol.hh:125
Definition XrdScheduler.hh:46
Definition XrdSecEntity.hh:65
Definition XrdSecInterface.hh:554
Definition XrdSysError.hh:90
Definition XrdXrootdProtocol.hh:156
Definition XrdXrootdBridge.hh:62
Definition XrdHttpProtocol.hh:417
char * data
Definition XrdHttpProtocol.hh:418
int len
Definition XrdHttpProtocol.hh:419
Definition XrdHttpProtocol.hh:233
char name[16]
Definition XrdHttpProtocol.hh:234
XrdHttpExtHandler * ptr
Definition XrdHttpProtocol.hh:235
Definition XrdHttpProtocol.hh:190
XrdOucString extHParm
Definition XrdHttpProtocol.hh:192
~extHInfo()
Definition XrdHttpProtocol.hh:196
XrdOucString extHPath
Definition XrdHttpProtocol.hh:191
XrdOucString extHName
Definition XrdHttpProtocol.hh:190
extHInfo(const char *hName, const char *hPath, const char *hParm)
Definition XrdHttpProtocol.hh:194
Definition XrdHttpReadRangeHandler.hh:54