Go to the documentation of this file.
24 #ifndef __XRDHTTP_PROTOCOL_H__
25 #define __XRDHTTP_PROTOCOL_H__
39 #include <sys/types.h>
51 #include <openssl/ssl.h>
63 #define __attribute__(x)
73 struct XrdVersionInfo;
103 int Stats(
char *buff,
int blen,
int do_sync = 0);
148 int StartSimpleResp(
int code,
const char *desc,
const char *header_to_add,
long long bodylen,
bool keepalive);
206 const char *libParms);
209 #define MAX_XRDHTTPEXTHANDLERS 4
218 const char *configFN,
const char *libParms,
253 int SendSimpleResp(
int code,
const char *desc,
const char *header_to_add,
const char *body,
long long bodylen,
bool keepalive);
257 int StartChunkedResp(
int code,
const char *desc,
const char *header_to_add,
bool keepalive);
static int LoadSecXtractor(XrdSysError *eDest, const char *libName, const char *libParms)
int kXR_int32
Definition: XPtypes.hh:89
static int readWait
Timeout for reading data.
Definition: XrdHttpProtocol.hh:349
static int xlistdeny(XrdOucStream &Config)
static int Configure(char *parms, XrdProtocol_Config *pi)
Read and apply the configuration.
static X509_STORE * PrepareStore()
Generate a new cert store.
char * myBuffEnd
Definition: XrdHttpProtocol.hh:233
int BuffgetData(int blen, char **data, bool wait)
Get a pointer, valid for up to blen bytes from the buffer. Returns the validity.
XrdHttpProtocol operator=(const XrdHttpProtocol &rhs)
long ResumeBytes
Tells that we are just waiting to have N bytes in the buffer.
Definition: XrdHttpProtocol.hh:270
XrdLink * Link
The link we are bound to.
Definition: XrdHttpProtocol.hh:323
int doChksum(const XrdOucString &fname)
Perform a checksum request.
void Reset()
Reset values, counters, in order to reutilize an object of this class.
Definition: XrdOucGMap.hh:49
Definition: XrdXrootdBridge.hh:62
static struct XrdHttpProtocol::XrdHttpExtHandlerInfo exthandler[MAX_XRDHTTPEXTHANDLERS]
int SendData(const char *body, int bodylen)
Send some generic data to the client.
static int xdesthttps(XrdOucStream &Config)
static int exthandlercnt
Definition: XrdHttpProtocol.hh:214
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:402
static XrdObjectQ< XrdHttpProtocol > ProtStack
Definition: XrdHttpProtocol.hh:122
static XrdSysError eDest
Definition: XrdHttpProtocol.hh:319
static int m_bio_type
Type identifier for our custom BIO objects.
Definition: XrdHttpProtocol.hh:405
static bool listdeny
If true, any form of listing is denied.
Definition: XrdHttpProtocol.hh:380
Definition: XrdHttpProtocol.hh:392
static bool embeddedstatic
If true, use the embedded css and icons.
Definition: XrdHttpProtocol.hh:386
static XrdSysRWLock x509_store_lock
Definition: XrdHttpProtocol.hh:277
static char * sslcadir
Definition: XrdHttpProtocol.hh:361
void Cleanup()
Deallocate resources, in order to reutilize an object of this class.
XrdXrootd::Bridge * Bridge
The Bridge that we use to exercise the xrootd internals.
Definition: XrdHttpProtocol.hh:333
Definition: XrdBuffer.hh:75
int Process(XrdLink *lp)
Process data incoming from the socket.
static kXR_int32 myRole
Our role.
Definition: XrdHttpProtocol.hh:399
Definition: XrdSecInterface.hh:536
bool ssldone
Definition: XrdHttpProtocol.hh:293
Definition: XrdProtocol.hh:55
static bool ExtHandlerLoaded(const char *handlername)
Definition: XrdOucHash.hh:128
int HandleAuthentication(XrdLink *lp)
static BIO * sslbio_err
bio to print SSL errors
Definition: XrdHttpProtocol.hh:286
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 int Config(const char *fn, XrdOucEnv *myEnv)
Functions related to the configuration.
Definition: XrdSysPthread.hh:296
static int xstaticredir(XrdOucStream &Config)
Definition: XrdHttpExtHandler.hh:79
XrdHttpReq CurrentReq
Definition: XrdHttpProtocol.hh:338
static char * listredir
Url to redirect to in the case a listing is requested.
Definition: XrdHttpProtocol.hh:377
static int LoadExtHandler(XrdSysError *eDest, const char *libName, const char *configFN, const char *libParms, XrdOucEnv *myEnv, const char *instName)
static char * sslcipherfilter
Definition: XrdHttpProtocol.hh:361
Definition: XrdOucStream.hh:46
static int xselfhttps2http(XrdOucStream &Config)
XrdHttpExtHandler * ptr
Definition: XrdHttpProtocol.hh:212
int ChunkResp(const char *body, long long bodylen)
Send a (potentially partial) body in a chunked response; invoking with NULL body.
Definition: XrdHttpReq.hh:77
bool isHTTPS()
called via https
Definition: XrdHttpProtocol.hh:130
static char * sslcert
OpenSSL stuff.
Definition: XrdHttpProtocol.hh:361
static char * sslkey
Definition: XrdHttpProtocol.hh:361
char * data
Definition: XrdHttpProtocol.hh:393
XrdOucString tmpline
A nice var to hold the current header line.
Definition: XrdHttpProtocol.hh:236
char * myBuffStart
The circular pointers.
Definition: XrdHttpProtocol.hh:233
char name[16]
Definition: XrdHttpProtocol.hh:211
static XrdSecService * CIA
Definition: XrdHttpProtocol.hh:320
void DoIt()
Override from the base class.
Definition: XrdHttpProtocol.hh:88
static int xsslcert(XrdOucStream &Config)
int doStat(char *fname)
Perform a Stat request.
XrdHttpProtocol(const XrdHttpProtocol &)=default
Ctor, dtors and copy ctor.
Definition: XrdOucEnv.hh:42
Definition: XrdHttpSecXtractor.hh:42
char * Addr_str
Definition: XrdHttpProtocol.hh:327
static BIO * CreateBIO(XrdLink *lp)
Create a new BIO object from an XrdLink. Returns NULL on failure.
static int xgmap(XrdOucStream &Config)
static XrdScheduler * Sched
Definition: XrdHttpProtocol.hh:317
static int sslverifydepth
Depth of verification of a certificate chain.
Definition: XrdHttpProtocol.hh:371
#define MAX_XRDHTTPEXTHANDLERS
Definition: XrdHttpProtocol.hh:209
Definition: XrdScheduler.hh:45
static int xembeddedstatic(XrdOucStream &Config)
int GetVOMSData(XrdLink *lp)
int len
Definition: XrdHttpProtocol.hh:394
static int xtrace(XrdOucStream &Config)
bool DoingLogin
Tells that we are just logging in.
Definition: XrdHttpProtocol.hh:267
static bool selfhttps2http
If client is HTTPS, self-redirect with HTTP+token.
Definition: XrdHttpProtocol.hh:383
XrdProtocol * Match(XrdLink *lp)
Tells if the oustanding bytes on the socket match this protocol implementation.
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.
static XrdHttpSecXtractor * secxtractor
Definition: XrdHttpProtocol.hh:202
Definition: XrdLink.hh:64
static XrdHttpExtHandler * FindMatchingExtHandler(const XrdHttpReq &)
static int xsslcafile(XrdOucStream &Config)
Definition: XrdHttpProtocol.hh:77
static bool isRequiredXtractor
Definition: XrdHttpProtocol.hh:201
void Recycle(XrdLink *lp, int consec, const char *reason)
Recycle this instance.
static SSL_CTX * sslctx
Global, static SSL context.
Definition: XrdHttpProtocol.hh:273
static XrdOucGMap * servGMap
The instance of the DN mapper. Created only when a valid path is given.
Definition: XrdHttpProtocol.hh:330
static int xsecretkey(XrdOucStream &Config)
static int xsslkey(XrdOucStream &Config)
static XrdOucHash< StaticPreloadInfo > * staticpreload
Definition: XrdHttpProtocol.hh:396
int Stats(char *buff, int blen, int do_sync=0)
Get activity stats.
static BIO_METHOD * m_bio_method
C-style vptr table for our custom BIO objects.
Definition: XrdHttpProtocol.hh:408
XrdHttpProtocol(bool imhttps)
static XrdCryptoFactory * myCryptoFactory
Definition: XrdHttpProtocol.hh:294
bool ishttps
Tells if the client is https.
Definition: XrdHttpProtocol.hh:289
static int xlistredir(XrdOucStream &Config)
static char * staticredir
Definition: XrdHttpProtocol.hh:389
static int xsslcipherfilter(XrdOucStream &Config)
static char * gridmap
Gridmap file location. The same used by XrdSecGsi.
Definition: XrdHttpProtocol.hh:364
int getDataOneShot(int blen, bool wait=false)
static void PeriodicUpdate()
Handle periodic refresh of the CRLs.
static int hailWait
Timeout for reading the handshake.
Definition: XrdHttpProtocol.hh:346
XrdBuffer * myBuff
Circular Buffer used to read the request.
Definition: XrdHttpProtocol.hh:231
static char * sslcafile
Definition: XrdHttpProtocol.hh:361
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 int InitSecurity()
Initialization of the ssl security things.
static int xstaticpreload(XrdOucStream &Config)
int(XrdHttpProtocol::* Resume)()
The resume function.
Definition: XrdHttpProtocol.hh:139
static X509_STORE * verify_store
Current X509_STORE and associated locks.
Definition: XrdHttpProtocol.hh:276
XrdObject< XrdHttpProtocol > ProtLink
Definition: XrdHttpProtocol.hh:123
Definition: XrdProtocol.hh:117
char * GetClientIPStr()
Gets a string that represents the IP address of the client. Must be freed.
static int xsslverifydepth(XrdOucStream &Config)
Definition: XrdSecEntity.hh:52
XrdSecEntity SecEntity
Authentication area.
Definition: XrdHttpProtocol.hh:127
Definition: XrdBuffer.hh:42
~XrdHttpProtocol()
Definition: XrdHttpProtocol.hh:118
static int Window
Windowsize.
Definition: XrdHttpProtocol.hh:358
Definition: XrdXrootdProtocol.hh:94
Definition: XrdHttpExtHandler.hh:45
void BuffConsume(int blen)
Consume some bytes from the buffer.
static XrdBuffManager * BPool
Definition: XrdHttpProtocol.hh:318
SSL * ssl
Private SSL context.
Definition: XrdHttpProtocol.hh:280
Definition: XrdOucTrace.hh:36
static bool isRequiredGridmap
Definition: XrdHttpProtocol.hh:365
Definition: XrdOucTokenizer.hh:33
int StartChunkedResp(int code, const char *desc, const char *header_to_add, bool keepalive)
Starts a chunked response; body of request is sent over multiple parts using the SendChunkResp.
int BuffUsed()
How many bytes in the buffer.
Definition: XrdSysError.hh:90
BIO * sbio
Private SSL bio.
Definition: XrdHttpProtocol.hh:283
int BuffAvailable()
How many bytes still fit into the buffer in a contiguous way.
static char * secretkey
The key used to calculate the url hashes.
Definition: XrdHttpProtocol.hh:368
int BuffFree()
How many bytes free in the buffer.
Main request/response class, handling the logical status of the communication.
static int Port
Our port.
Definition: XrdHttpProtocol.hh:352
Definition: XrdOucString.hh:254
static int xexthandler(XrdOucStream &Config, const char *ConfigFN, XrdOucEnv *myEnv)
Definition: XrdCryptoFactory.hh:122
static bool isdesthttps
True if the redirections must be towards https targets.
Definition: XrdHttpProtocol.hh:374
static int xsslcadir(XrdOucStream &Config)
int HandleGridMap(XrdLink *lp)
static int xsecxtractor(XrdOucStream &Config)
static char * Port_str
Our port, as a string.
Definition: XrdHttpProtocol.hh:355
Definition: XrdHttpProtocol.hh:210
static int xheader2cgi(XrdOucStream &Config)