xrootd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Attributes | Static Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
XrdHttpProtocol Class Reference

#include <XrdHttpProtocol.hh>

Inheritance diagram for XrdHttpProtocol:
Inheritance graph
[legend]
Collaboration diagram for XrdHttpProtocol:
Collaboration graph
[legend]

Classes

struct  extHInfo
 
struct  StaticPreloadInfo
 
struct  XrdHttpExtHandlerInfo
 

Public Member Functions

void DoIt ()
 Override from the base class. More...
 
XrdProtocolMatch (XrdLink *lp)
 Tells if the oustanding bytes on the socket match this protocol implementation. More...
 
int Process (XrdLink *lp)
 Process data incoming from the socket. More...
 
void Recycle (XrdLink *lp, int consec, const char *reason)
 Recycle this instance. More...
 
int Stats (char *buff, int blen, int do_sync=0)
 Get activity stats. More...
 
int doStat (char *fname)
 Perform a Stat request. More...
 
int doChksum (const XrdOucString &fname)
 Perform a checksum request. More...
 
 XrdHttpProtocol (const XrdHttpProtocol &)=default
 Ctor, dtors and copy ctor. More...
 
XrdHttpProtocol operator= (const XrdHttpProtocol &rhs)
 
 XrdHttpProtocol (bool imhttps)
 
 ~XrdHttpProtocol ()
 
bool isHTTPS ()
 called via https More...
 
- Public Member Functions inherited from XrdProtocol
 XrdProtocol (const char *jname)
 
virtual ~XrdProtocol ()
 
- Public Member Functions inherited from XrdJob
 XrdJob (const char *desc="")
 
virtual ~XrdJob ()
 

Static Public Member Functions

static int Configure (char *parms, XrdProtocol_Config *pi)
 Read and apply the configuration. More...
 

Public Attributes

XrdObject< XrdHttpProtocolProtLink
 
XrdSecEntity SecEntity
 Authentication area. More...
 
- Public Attributes inherited from XrdJob
XrdJobNextJob
 
const char * Comment
 

Static Public Attributes

static XrdObjectQ
< XrdHttpProtocol
ProtStack
 

Protected Attributes

XrdLinkLink
 The link we are bound to. More...
 
char * Addr_str
 
XrdXrootd::BridgeBridge
 The Bridge that we use to exercise the xrootd internals. More...
 
XrdHttpReq CurrentReq
 

Static Protected Attributes

static XrdSchedulerSched
 
static XrdBuffManagerBPool
 
static XrdSysError eDest
 
static XrdSecServiceCIA
 
static XrdOucGMapservGMap
 The instance of the DN mapper. Created only when a valid path is given. More...
 
static int hailWait
 Timeout for reading the handshake. More...
 
static int readWait
 Timeout for reading data. More...
 
static int Port
 Our port. More...
 
static char * Port_str
 Our port, as a string. More...
 
static char * sslcert
 OpenSSL stuff. More...
 
static char * sslkey
 
static char * sslcadir
 
static char * sslcafile
 
static char * sslcipherfilter
 
static char * gridmap
 Gridmap file location. The same used by XrdSecGsi. More...
 
static bool isRequiredGridmap
 
static char * secretkey
 The key used to calculate the url hashes. More...
 
static int sslverifydepth
 Depth of verification of a certificate chain. More...
 
static bool isdesthttps
 True if the redirections must be towards https targets. More...
 
static char * listredir
 Url to redirect to in the case a listing is requested. More...
 
static bool listdeny
 If true, any form of listing is denied. More...
 
static bool selfhttps2http
 If client is HTTPS, self-redirect with HTTP+token. More...
 
static bool embeddedstatic
 If true, use the embedded css and icons. More...
 
static char * staticredir
 
static XrdOucHash
< StaticPreloadInfo > * 
staticpreload
 
static kXR_int32 myRole
 Our role. More...
 
static std::map< std::string,
std::string > 
hdr2cgimap
 Rules that turn HTTP headers to cgi tokens in the URL, for internal comsumption. More...
 
static int m_bio_type
 Type identifier for our custom BIO objects. More...
 
static BIO_METHOD * m_bio_method
 C-style vptr table for our custom BIO objects. More...
 

Private Member Functions

int StartSimpleResp (int code, const char *desc, const char *header_to_add, long long bodylen, bool keepalive)
 Start a response back to the client. More...
 
int SendData (const char *body, int bodylen)
 Send some generic data to the client. More...
 
void Cleanup ()
 Deallocate resources, in order to reutilize an object of this class. More...
 
void Reset ()
 Reset values, counters, in order to reutilize an object of this class. More...
 
int HandleAuthentication (XrdLink *lp)
 
int GetVOMSData (XrdLink *lp)
 
int HandleGridMap (XrdLink *lp)
 
int getDataOneShot (int blen, bool wait=false)
 
int BuffAvailable ()
 How many bytes still fit into the buffer in a contiguous way. More...
 
int BuffUsed ()
 How many bytes in the buffer. More...
 
int BuffFree ()
 How many bytes free in the buffer. More...
 
void BuffConsume (int blen)
 Consume some bytes from the buffer. More...
 
int BuffgetData (int blen, char **data, bool wait)
 Get a pointer, valid for up to blen bytes from the buffer. Returns the validity. More...
 
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. More...
 
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. More...
 
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. More...
 
int ChunkResp (const char *body, long long bodylen)
 Send a (potentially partial) body in a chunked response; invoking with NULL body. More...
 
char * GetClientIPStr ()
 Gets a string that represents the IP address of the client. Must be freed. More...
 

Static Private Member Functions

static bool InitTLS ()
 Initialization of the ssl security things. More...
 
static bool InitSecurity ()
 Initialization fo security addon. More...
 
static BIO * CreateBIO (XrdLink *lp)
 Create a new BIO object from an XrdLink. Returns NULL on failure. More...
 
static int Config (const char *fn, XrdOucEnv *myEnv)
 Functions related to the configuration. More...
 
static const char * Configed ()
 
static int xtrace (XrdOucStream &Config)
 
static int xsslcert (XrdOucStream &Config)
 
static int xsslkey (XrdOucStream &Config)
 
static int xsecxtractor (XrdOucStream &Config)
 
static int xexthandler (XrdOucStream &Config, std::vector< extHInfo > &hiVec)
 
static int xsslcadir (XrdOucStream &Config)
 
static int xsslcipherfilter (XrdOucStream &Config)
 
static int xdesthttps (XrdOucStream &Config)
 
static int xlistdeny (XrdOucStream &Config)
 
static int xlistredir (XrdOucStream &Config)
 
static int xselfhttps2http (XrdOucStream &Config)
 
static int xembeddedstatic (XrdOucStream &Config)
 
static int xstaticredir (XrdOucStream &Config)
 
static int xstaticpreload (XrdOucStream &Config)
 
static int xgmap (XrdOucStream &Config)
 
static int xsslcafile (XrdOucStream &Config)
 
static int xsslverifydepth (XrdOucStream &Config)
 
static int xsecretkey (XrdOucStream &Config)
 
static int xheader2cgi (XrdOucStream &Config)
 
static int xhttpsmode (XrdOucStream &Config)
 
static int xtlsreuse (XrdOucStream &Config)
 
static int LoadSecXtractor (XrdSysError *eDest, const char *libName, const char *libParms)
 
static int LoadExtHandler (std::vector< extHInfo > &hiVec, const char *cFN, XrdOucEnv &myEnv)
 
static int LoadExtHandler (XrdSysError *eDest, const char *libName, const char *configFN, const char *libParms, XrdOucEnv *myEnv, const char *instName)
 
static XrdHttpExtHandlerFindMatchingExtHandler (const XrdHttpReq &)
 
static bool ExtHandlerLoaded (const char *handlername)
 

Private Attributes

int(XrdHttpProtocol::* Resume )()
 The resume function. More...
 
XrdBuffermyBuff
 Circular Buffer used to read the request. More...
 
char * myBuffStart
 The circular pointers. More...
 
char * myBuffEnd
 
XrdOucString tmpline
 A nice var to hold the current header line. More...
 
bool DoingLogin
 Tells that we are just logging in. More...
 
long ResumeBytes
 Tells that we are just waiting to have N bytes in the buffer. More...
 
SSL * ssl
 Private SSL context. More...
 
BIO * sbio
 Private SSL bio. More...
 
bool ishttps
 Tells if the client is https. More...
 
bool ssldone
 

Static Private Attributes

static bool isRequiredXtractor
 
static XrdHttpSecXtractorsecxtractor
 
static struct
XrdHttpProtocol::XrdHttpExtHandlerInfo 
exthandler [MAX_XRDHTTPEXTHANDLERS]
 
static int exthandlercnt
 
static BIO * sslbio_err
 bio to print SSL errors More...
 
static XrdCryptoFactorymyCryptoFactory
 

Friends

class XrdHttpReq
 
class XrdHttpExtReq
 

Constructor & Destructor Documentation

XrdHttpProtocol::XrdHttpProtocol ( const XrdHttpProtocol )
default

Ctor, dtors and copy ctor.

XrdHttpProtocol::XrdHttpProtocol ( bool  imhttps)
XrdHttpProtocol::~XrdHttpProtocol ( )
inline

References Cleanup().

Member Function Documentation

int XrdHttpProtocol::BuffAvailable ( )
private

How many bytes still fit into the buffer in a contiguous way.

void XrdHttpProtocol::BuffConsume ( int  blen)
private

Consume some bytes from the buffer.

int XrdHttpProtocol::BuffFree ( )
private

How many bytes free in the buffer.

int XrdHttpProtocol::BuffgetData ( int  blen,
char **  data,
bool  wait 
)
private

Get a pointer, valid for up to blen bytes from the buffer. Returns the validity.

int XrdHttpProtocol::BuffgetLine ( XrdOucString dest)
private

Copy a full line of text from the buffer into dest. Zero if no line can be found in the buffer.

int XrdHttpProtocol::BuffUsed ( )
private

How many bytes in the buffer.

int XrdHttpProtocol::ChunkResp ( const char *  body,
long long  bodylen 
)
private

Send a (potentially partial) body in a chunked response; invoking with NULL body.

void XrdHttpProtocol::Cleanup ( )
private

Deallocate resources, in order to reutilize an object of this class.

Referenced by ~XrdHttpProtocol().

static int XrdHttpProtocol::Config ( const char *  fn,
XrdOucEnv myEnv 
)
staticprivate

Functions related to the configuration.

static const char* XrdHttpProtocol::Configed ( )
staticprivate
static int XrdHttpProtocol::Configure ( char *  parms,
XrdProtocol_Config pi 
)
static

Read and apply the configuration.

static BIO* XrdHttpProtocol::CreateBIO ( XrdLink lp)
staticprivate

Create a new BIO object from an XrdLink. Returns NULL on failure.

int XrdHttpProtocol::doChksum ( const XrdOucString fname)

Perform a checksum request.

void XrdHttpProtocol::DoIt ( )
inlinevirtual

Override from the base class.

Implements XrdJob.

References Resume.

int XrdHttpProtocol::doStat ( char *  fname)

Perform a Stat request.

static bool XrdHttpProtocol::ExtHandlerLoaded ( const char *  handlername)
staticprivate
static XrdHttpExtHandler* XrdHttpProtocol::FindMatchingExtHandler ( const XrdHttpReq )
staticprivate
char* XrdHttpProtocol::GetClientIPStr ( )
private

Gets a string that represents the IP address of the client. Must be freed.

int XrdHttpProtocol::getDataOneShot ( int  blen,
bool  wait = false 
)
private

Get up to blen bytes from the connection. Put them into mybuff. This primitive, for the way it is used, is not supposed to block

int XrdHttpProtocol::GetVOMSData ( XrdLink lp)
private

After the SSL handshake, retrieve the VOMS info and the various stuff that is needed for autorization

int XrdHttpProtocol::HandleAuthentication ( XrdLink lp)
private

Handle authentication of the client

Returns
0 if successful, otherwise error
int XrdHttpProtocol::HandleGridMap ( XrdLink lp)
private
static bool XrdHttpProtocol::InitSecurity ( )
staticprivate

Initialization fo security addon.

static bool XrdHttpProtocol::InitTLS ( )
staticprivate

Initialization of the ssl security things.

bool XrdHttpProtocol::isHTTPS ( )
inline

called via https

References ishttps.

static int XrdHttpProtocol::LoadExtHandler ( std::vector< extHInfo > &  hiVec,
const char *  cFN,
XrdOucEnv myEnv 
)
staticprivate
static int XrdHttpProtocol::LoadExtHandler ( XrdSysError eDest,
const char *  libName,
const char *  configFN,
const char *  libParms,
XrdOucEnv myEnv,
const char *  instName 
)
staticprivate
static int XrdHttpProtocol::LoadSecXtractor ( XrdSysError eDest,
const char *  libName,
const char *  libParms 
)
staticprivate
XrdProtocol* XrdHttpProtocol::Match ( XrdLink lp)
virtual

Tells if the oustanding bytes on the socket match this protocol implementation.

Implements XrdProtocol.

XrdHttpProtocol XrdHttpProtocol::operator= ( const XrdHttpProtocol rhs)
int XrdHttpProtocol::Process ( XrdLink lp)
virtual

Process data incoming from the socket.

Implements XrdProtocol.

void XrdHttpProtocol::Recycle ( XrdLink lp,
int  consec,
const char *  reason 
)
virtual

Recycle this instance.

Implements XrdProtocol.

void XrdHttpProtocol::Reset ( )
private

Reset values, counters, in order to reutilize an object of this class.

int XrdHttpProtocol::SendData ( const char *  body,
int  bodylen 
)
private

Send some generic data to the client.

int XrdHttpProtocol::SendSimpleResp ( int  code,
const char *  desc,
const char *  header_to_add,
const char *  body,
long long  bodylen,
bool  keepalive 
)
private

Sends a basic response. If the length is < 0 then it is calculated internally.

int XrdHttpProtocol::StartChunkedResp ( int  code,
const char *  desc,
const char *  header_to_add,
bool  keepalive 
)
private

Starts a chunked response; body of request is sent over multiple parts using the SendChunkResp.

int XrdHttpProtocol::StartSimpleResp ( int  code,
const char *  desc,
const char *  header_to_add,
long long  bodylen,
bool  keepalive 
)
private

Start a response back to the client.

int XrdHttpProtocol::Stats ( char *  buff,
int  blen,
int  do_sync = 0 
)
virtual

Get activity stats.

Implements XrdProtocol.

static int XrdHttpProtocol::xdesthttps ( XrdOucStream Config)
staticprivate
static int XrdHttpProtocol::xembeddedstatic ( XrdOucStream Config)
staticprivate
static int XrdHttpProtocol::xexthandler ( XrdOucStream Config,
std::vector< extHInfo > &  hiVec 
)
staticprivate
static int XrdHttpProtocol::xgmap ( XrdOucStream Config)
staticprivate
static int XrdHttpProtocol::xheader2cgi ( XrdOucStream Config)
staticprivate
static int XrdHttpProtocol::xhttpsmode ( XrdOucStream Config)
staticprivate
static int XrdHttpProtocol::xlistdeny ( XrdOucStream Config)
staticprivate
static int XrdHttpProtocol::xlistredir ( XrdOucStream Config)
staticprivate
static int XrdHttpProtocol::xsecretkey ( XrdOucStream Config)
staticprivate
static int XrdHttpProtocol::xsecxtractor ( XrdOucStream Config)
staticprivate
static int XrdHttpProtocol::xselfhttps2http ( XrdOucStream Config)
staticprivate
static int XrdHttpProtocol::xsslcadir ( XrdOucStream Config)
staticprivate
static int XrdHttpProtocol::xsslcafile ( XrdOucStream Config)
staticprivate
static int XrdHttpProtocol::xsslcert ( XrdOucStream Config)
staticprivate
static int XrdHttpProtocol::xsslcipherfilter ( XrdOucStream Config)
staticprivate
static int XrdHttpProtocol::xsslkey ( XrdOucStream Config)
staticprivate
static int XrdHttpProtocol::xsslverifydepth ( XrdOucStream Config)
staticprivate
static int XrdHttpProtocol::xstaticpreload ( XrdOucStream Config)
staticprivate
static int XrdHttpProtocol::xstaticredir ( XrdOucStream Config)
staticprivate
static int XrdHttpProtocol::xtlsreuse ( XrdOucStream Config)
staticprivate
static int XrdHttpProtocol::xtrace ( XrdOucStream Config)
staticprivate

Friends And Related Function Documentation

friend class XrdHttpExtReq
friend
friend class XrdHttpReq
friend

Member Data Documentation

char* XrdHttpProtocol::Addr_str
protected

Our IP address, as a string. Please remember that this may not be unique for a given machine, hence we need to keep it here and recompute ad every new connection.

XrdBuffManager* XrdHttpProtocol::BPool
staticprotected
XrdXrootd::Bridge* XrdHttpProtocol::Bridge
protected

The Bridge that we use to exercise the xrootd internals.

XrdSecService* XrdHttpProtocol::CIA
staticprotected
XrdHttpReq XrdHttpProtocol::CurrentReq
protected

Area for coordinating request and responses to/from the bridge This also can process HTTP/DAV stuff

bool XrdHttpProtocol::DoingLogin
private

Tells that we are just logging in.

XrdSysError XrdHttpProtocol::eDest
staticprotected
bool XrdHttpProtocol::embeddedstatic
staticprotected

If true, use the embedded css and icons.

struct XrdHttpProtocol::XrdHttpExtHandlerInfo XrdHttpProtocol::exthandler[MAX_XRDHTTPEXTHANDLERS]
staticprivate
int XrdHttpProtocol::exthandlercnt
staticprivate
char* XrdHttpProtocol::gridmap
staticprotected

Gridmap file location. The same used by XrdSecGsi.

int XrdHttpProtocol::hailWait
staticprotected

Timeout for reading the handshake.

std::map< std::string, std::string > XrdHttpProtocol::hdr2cgimap
staticprotected

Rules that turn HTTP headers to cgi tokens in the URL, for internal comsumption.

bool XrdHttpProtocol::isdesthttps
staticprotected

True if the redirections must be towards https targets.

bool XrdHttpProtocol::ishttps
private

Tells if the client is https.

Referenced by isHTTPS().

bool XrdHttpProtocol::isRequiredGridmap
staticprotected
bool XrdHttpProtocol::isRequiredXtractor
staticprivate
XrdLink* XrdHttpProtocol::Link
protected

The link we are bound to.

bool XrdHttpProtocol::listdeny
staticprotected

If true, any form of listing is denied.

char* XrdHttpProtocol::listredir
staticprotected

Url to redirect to in the case a listing is requested.

BIO_METHOD* XrdHttpProtocol::m_bio_method
staticprotected

C-style vptr table for our custom BIO objects.

int XrdHttpProtocol::m_bio_type
staticprotected

Type identifier for our custom BIO objects.

XrdBuffer* XrdHttpProtocol::myBuff
private

Circular Buffer used to read the request.

char * XrdHttpProtocol::myBuffEnd
private
char* XrdHttpProtocol::myBuffStart
private

The circular pointers.

XrdCryptoFactory* XrdHttpProtocol::myCryptoFactory
staticprivate
kXR_int32 XrdHttpProtocol::myRole
staticprotected

Our role.

int XrdHttpProtocol::Port
staticprotected

Our port.

char* XrdHttpProtocol::Port_str
staticprotected

Our port, as a string.

XrdObject<XrdHttpProtocol> XrdHttpProtocol::ProtLink
XrdObjectQ<XrdHttpProtocol> XrdHttpProtocol::ProtStack
static
int XrdHttpProtocol::readWait
staticprotected

Timeout for reading data.

int(XrdHttpProtocol::* XrdHttpProtocol::Resume)()
private

The resume function.

Referenced by DoIt().

long XrdHttpProtocol::ResumeBytes
private

Tells that we are just waiting to have N bytes in the buffer.

BIO* XrdHttpProtocol::sbio
private

Private SSL bio.

XrdScheduler* XrdHttpProtocol::Sched
staticprotected
XrdSecEntity XrdHttpProtocol::SecEntity

Authentication area.

char* XrdHttpProtocol::secretkey
staticprotected

The key used to calculate the url hashes.

XrdHttpSecXtractor* XrdHttpProtocol::secxtractor
staticprivate
bool XrdHttpProtocol::selfhttps2http
staticprotected

If client is HTTPS, self-redirect with HTTP+token.

XrdOucGMap* XrdHttpProtocol::servGMap
staticprotected

The instance of the DN mapper. Created only when a valid path is given.

SSL* XrdHttpProtocol::ssl
private

Private SSL context.

BIO* XrdHttpProtocol::sslbio_err
staticprivate

bio to print SSL errors

char * XrdHttpProtocol::sslcadir
staticprotected
char * XrdHttpProtocol::sslcafile
staticprotected
char* XrdHttpProtocol::sslcert
staticprotected

OpenSSL stuff.

char * XrdHttpProtocol::sslcipherfilter
staticprotected
bool XrdHttpProtocol::ssldone
private

Flag to tell if the https handshake has finished, in the case of an https connection being established

char * XrdHttpProtocol::sslkey
staticprotected
int XrdHttpProtocol::sslverifydepth
staticprotected

Depth of verification of a certificate chain.

XrdOucHash<StaticPreloadInfo>* XrdHttpProtocol::staticpreload
staticprotected
char* XrdHttpProtocol::staticredir
staticprotected
XrdOucString XrdHttpProtocol::tmpline
private

A nice var to hold the current header line.


The documentation for this class was generated from the following file: