#include <XrdHttpProtocol.hh>
Classes | |
struct | StaticPreloadInfo |
struct | XrdHttpExtHandlerInfo |
Public Member Functions | |
void | DoIt () |
Override from the base class. | |
XrdProtocol * | Match (XrdLink *lp) |
Tells if the oustanding bytes on the socket match this protocol implementation. | |
int | Process (XrdLink *lp) |
Process data incoming from the socket. | |
void | Recycle (XrdLink *lp, int consec, const char *reason) |
Recycle this instance. | |
int | Stats (char *buff, int blen, int do_sync=0) |
Get activity stats. | |
int | doStat (char *fname) |
Perform a Stat request. | |
int | doChksum (const XrdOucString &fname) |
Perform a checksum request. | |
XrdHttpProtocol (const XrdHttpProtocol &) | |
Ctor, dtors and copy ctor. | |
XrdHttpProtocol | operator= (const XrdHttpProtocol &rhs) |
XrdHttpProtocol (bool imhttps) | |
~XrdHttpProtocol () | |
bool | isHTTPS () |
called via https | |
Static Public Member Functions | |
static int | Configure (char *parms, XrdProtocol_Config *pi) |
Read and apply the configuration. | |
Public Attributes | |
XrdObject< XrdHttpProtocol > | ProtLink |
XrdSecEntity | SecEntity |
Authentication area. | |
Static Public Attributes | |
static XrdObjectQ < XrdHttpProtocol > | ProtStack |
Protected Attributes | |
XrdLink * | Link |
The link we are bound to. | |
char * | Addr_str |
XrdXrootd::Bridge * | Bridge |
The Bridge that we use to exercise the xrootd internals. | |
XrdHttpReq | CurrentReq |
Static Protected Attributes | |
static XrdScheduler * | Sched |
static XrdBuffManager * | BPool |
static XrdSysError | eDest |
static XrdSecService * | CIA |
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. | |
static int | readWait |
Timeout for reading data. | |
static int | Port |
Our port. | |
static char * | Port_str |
Our port, as a string. | |
static char * | sslcert |
OpenSSL stuff. | |
static char * | sslkey |
static char * | sslcadir |
static char * | sslcafile |
static char * | sslcipherfilter |
static char * | gridmap |
Gridmap file location. The same used by XrdSecGsi. | |
static char * | secretkey |
The key used to calculate the url hashes. | |
static int | sslverifydepth |
Depth of verification of a certificate chain. | |
static bool | isdesthttps |
True if the redirections must be towards https targets. | |
static char * | listredir |
Url to redirect to in the case a listing is requested. | |
static bool | listdeny |
If true, any form of listing is denied. | |
static bool | selfhttps2http |
If client is HTTPS, self-redirect with HTTP+token. | |
static bool | embeddedstatic |
If true, use the embedded css and icons. | |
static char * | staticredir |
static XrdOucHash < StaticPreloadInfo > * | staticpreload |
static kXR_int32 | myRole |
Our role. | |
static std::map< std::string, std::string > | hdr2cgimap |
Rules that turn HTTP headers to cgi tokens in the URL, for internal comsumption. | |
static int | m_bio_type |
Type identifier for our custom BIO objects. | |
static BIO_METHOD * | m_bio_method |
C-style vptr table for our custom BIO objects. | |
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. | |
int | SendData (const char *body, int bodylen) |
Send some generic data to the client. | |
void | Cleanup () |
Deallocate resources, in order to reutilize an object of this class. | |
void | Reset () |
Reset values, counters, in order to reutilize an object of this class. | |
int | GetVOMSData (XrdLink *lp) |
int | getDataOneShot (int blen, bool wait=false) |
int | BuffAvailable () |
How many bytes still fit into the buffer in a contiguous way. | |
int | BuffUsed () |
How many bytes in the buffer. | |
int | BuffFree () |
How many bytes free in the buffer. | |
void | BuffConsume (int blen) |
Consume some bytes from the buffer. | |
int | BuffgetData (int blen, char **data, bool wait) |
Get a pointer, valid for up to blen bytes from the buffer. Returns the validity. | |
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. | |
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. | |
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 | ChunkResp (const char *body, long long bodylen) |
Send a (potentially partial) body in a chunked response; invoking with NULL body. | |
char * | GetClientIPStr () |
Gets a string that represents the IP address of the client. Must be freed. | |
Static Private Member Functions | |
static bool | InitTLS () |
Initialization of the ssl security things. | |
static bool | InitSecurity () |
Initialization fo security addon. | |
static BIO * | CreateBIO (XrdLink *lp) |
Create a new BIO object from an XrdLink. Returns NULL on failure. | |
static int | Config (const char *fn, XrdOucEnv *myEnv) |
Functions related to the configuration. | |
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, const char *ConfigFN, XrdOucEnv *myEnv) |
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 | LoadSecXtractor (XrdSysError *eDest, const char *libName, const char *libParms) |
static int | LoadExtHandler (XrdSysError *eDest, const char *libName, const char *configFN, const char *libParms, XrdOucEnv *myEnv, const char *instName) |
static XrdHttpExtHandler * | FindMatchingExtHandler (const XrdHttpReq &) |
static bool | ExtHandlerLoaded (const char *handlername) |
Private Attributes | |
int(XrdHttpProtocol::* | Resume )() |
The resume function. | |
XrdBuffer * | myBuff |
Circular Buffer used to read the request. | |
char * | myBuffStart |
The circular pointers. | |
char * | myBuffEnd |
XrdOucString | tmpline |
A nice var to hold the current header line. | |
bool | DoingLogin |
Tells that we are just logging in. | |
long | ResumeBytes |
Tells that we are just waiting to have N bytes in the buffer. | |
SSL * | ssl |
Private SSL context. | |
BIO * | sbio |
Private SSL bio. | |
bool | ishttps |
Tells if the client is https. | |
bool | ssldone |
Static Private Attributes | |
static XrdHttpSecXtractor * | secxtractor |
static struct XrdHttpProtocol::XrdHttpExtHandlerInfo | exthandler [MAX_XRDHTTPEXTHANDLERS] |
static int | exthandlercnt |
static BIO * | sslbio_err |
bio to print SSL errors | |
Friends | |
class | XrdHttpReq |
class | XrdHttpExtReq |
XrdHttpProtocol::XrdHttpProtocol | ( | const XrdHttpProtocol & | ) |
Ctor, dtors and copy ctor.
XrdHttpProtocol::XrdHttpProtocol | ( | bool | imhttps | ) |
XrdHttpProtocol::~XrdHttpProtocol | ( | ) | [inline] |
References Cleanup().
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 | |||
) | [static, private] |
Functions related to the configuration.
static const char* XrdHttpProtocol::Configed | ( | ) | [static, private] |
static int XrdHttpProtocol::Configure | ( | char * | parms, | |
XrdProtocol_Config * | pi | |||
) | [static] |
Read and apply the configuration.
static BIO* XrdHttpProtocol::CreateBIO | ( | XrdLink * | lp | ) | [static, private] |
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 | ( | ) | [inline, virtual] |
int XrdHttpProtocol::doStat | ( | char * | fname | ) |
Perform a Stat request.
static bool XrdHttpProtocol::ExtHandlerLoaded | ( | const char * | handlername | ) | [static, private] |
static XrdHttpExtHandler* XrdHttpProtocol::FindMatchingExtHandler | ( | const XrdHttpReq & | ) | [static, private] |
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
static bool XrdHttpProtocol::InitSecurity | ( | ) | [static, private] |
Initialization fo security addon.
static bool XrdHttpProtocol::InitTLS | ( | ) | [static, private] |
Initialization of the ssl security things.
bool XrdHttpProtocol::isHTTPS | ( | ) | [inline] |
called via https
References ishttps.
static int XrdHttpProtocol::LoadExtHandler | ( | XrdSysError * | eDest, | |
const char * | libName, | |||
const char * | configFN, | |||
const char * | libParms, | |||
XrdOucEnv * | myEnv, | |||
const char * | instName | |||
) | [static, private] |
static int XrdHttpProtocol::LoadSecXtractor | ( | XrdSysError * | eDest, | |
const char * | libName, | |||
const char * | libParms | |||
) | [static, private] |
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 | ) | [static, private] |
static int XrdHttpProtocol::xembeddedstatic | ( | XrdOucStream & | Config | ) | [static, private] |
static int XrdHttpProtocol::xexthandler | ( | XrdOucStream & | Config, | |
const char * | ConfigFN, | |||
XrdOucEnv * | myEnv | |||
) | [static, private] |
static int XrdHttpProtocol::xgmap | ( | XrdOucStream & | Config | ) | [static, private] |
static int XrdHttpProtocol::xheader2cgi | ( | XrdOucStream & | Config | ) | [static, private] |
static int XrdHttpProtocol::xhttpsmode | ( | XrdOucStream & | Config | ) | [static, private] |
static int XrdHttpProtocol::xlistdeny | ( | XrdOucStream & | Config | ) | [static, private] |
static int XrdHttpProtocol::xlistredir | ( | XrdOucStream & | Config | ) | [static, private] |
static int XrdHttpProtocol::xsecretkey | ( | XrdOucStream & | Config | ) | [static, private] |
static int XrdHttpProtocol::xsecxtractor | ( | XrdOucStream & | Config | ) | [static, private] |
static int XrdHttpProtocol::xselfhttps2http | ( | XrdOucStream & | Config | ) | [static, private] |
static int XrdHttpProtocol::xsslcadir | ( | XrdOucStream & | Config | ) | [static, private] |
static int XrdHttpProtocol::xsslcafile | ( | XrdOucStream & | Config | ) | [static, private] |
static int XrdHttpProtocol::xsslcert | ( | XrdOucStream & | Config | ) | [static, private] |
static int XrdHttpProtocol::xsslcipherfilter | ( | XrdOucStream & | Config | ) | [static, private] |
static int XrdHttpProtocol::xsslkey | ( | XrdOucStream & | Config | ) | [static, private] |
static int XrdHttpProtocol::xsslverifydepth | ( | XrdOucStream & | Config | ) | [static, private] |
static int XrdHttpProtocol::xstaticpreload | ( | XrdOucStream & | Config | ) | [static, private] |
static int XrdHttpProtocol::xstaticredir | ( | XrdOucStream & | Config | ) | [static, private] |
static int XrdHttpProtocol::xtrace | ( | XrdOucStream & | Config | ) | [static, private] |
friend class XrdHttpExtReq [friend] |
friend class XrdHttpReq [friend] |
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 [static, protected] |
XrdXrootd::Bridge* XrdHttpProtocol::Bridge [protected] |
The Bridge that we use to exercise the xrootd internals.
XrdSecService* XrdHttpProtocol::CIA [static, protected] |
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 [static, protected] |
bool XrdHttpProtocol::embeddedstatic [static, protected] |
If true, use the embedded css and icons.
struct XrdHttpProtocol::XrdHttpExtHandlerInfo XrdHttpProtocol::exthandler[MAX_XRDHTTPEXTHANDLERS] [static, private] |
int XrdHttpProtocol::exthandlercnt [static, private] |
char* XrdHttpProtocol::gridmap [static, protected] |
Gridmap file location. The same used by XrdSecGsi.
int XrdHttpProtocol::hailWait [static, protected] |
Timeout for reading the handshake.
std::map< std::string, std::string > XrdHttpProtocol::hdr2cgimap [static, protected] |
Rules that turn HTTP headers to cgi tokens in the URL, for internal comsumption.
bool XrdHttpProtocol::isdesthttps [static, protected] |
True if the redirections must be towards https targets.
bool XrdHttpProtocol::ishttps [private] |
Tells if the client is https.
Referenced by isHTTPS().
XrdLink* XrdHttpProtocol::Link [protected] |
The link we are bound to.
bool XrdHttpProtocol::listdeny [static, protected] |
If true, any form of listing is denied.
char* XrdHttpProtocol::listredir [static, protected] |
Url to redirect to in the case a listing is requested.
BIO_METHOD* XrdHttpProtocol::m_bio_method [static, protected] |
C-style vptr table for our custom BIO objects.
int XrdHttpProtocol::m_bio_type [static, protected] |
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.
kXR_int32 XrdHttpProtocol::myRole [static, protected] |
Our role.
int XrdHttpProtocol::Port [static, protected] |
Our port.
char* XrdHttpProtocol::Port_str [static, protected] |
Our port, as a string.
int XrdHttpProtocol::readWait [static, protected] |
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 [static, protected] |
Authentication area.
char* XrdHttpProtocol::secretkey [static, protected] |
The key used to calculate the url hashes.
XrdHttpSecXtractor* XrdHttpProtocol::secxtractor [static, private] |
bool XrdHttpProtocol::selfhttps2http [static, protected] |
If client is HTTPS, self-redirect with HTTP+token.
XrdOucGMap* XrdHttpProtocol::servGMap [static, protected] |
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 [static, private] |
bio to print SSL errors
char * XrdHttpProtocol::sslcadir [static, protected] |
char * XrdHttpProtocol::sslcafile [static, protected] |
char* XrdHttpProtocol::sslcert [static, protected] |
OpenSSL stuff.
char * XrdHttpProtocol::sslcipherfilter [static, protected] |
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 [static, protected] |
int XrdHttpProtocol::sslverifydepth [static, protected] |
Depth of verification of a certificate chain.
XrdOucHash<StaticPreloadInfo>* XrdHttpProtocol::staticpreload [static, protected] |
char* XrdHttpProtocol::staticredir [static, protected] |
XrdOucString XrdHttpProtocol::tmpline [private] |
A nice var to hold the current header line.