XRootD
XrdHttpProtocol Class Reference

#include <XrdHttpProtocol.hh>

+ Inheritance diagram for XrdHttpProtocol:
+ Collaboration diagram for XrdHttpProtocol:

Classes

struct  StaticPreloadInfo
 

Public Member Functions

 XrdHttpProtocol (bool imhttps)
 
 XrdHttpProtocol (const XrdHttpProtocol &)=default
 Ctor, dtors and copy ctor. More...
 
 ~XrdHttpProtocol ()
 
int doChksum (const XrdOucString &fname)
 Perform a checksum request. More...
 
void DoIt ()
 Override from the base class. More...
 
int doStat (char *fname)
 Perform a Stat request. More...
 
bool isHTTPS ()
 called via https More...
 
XrdProtocolMatch (XrdLink *lp)
 Tells if the oustanding bytes on the socket match this protocol implementation. More...
 
XrdHttpProtocol operator= (const XrdHttpProtocol &rhs)
 
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...
 
- 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...
 
static int parseHeader2CGI (XrdOucStream &Config, XrdSysError &err, std::map< std::string, std::string > &header2cgi)
 Use this function to parse header2cgi configurations. More...
 

Public Attributes

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

Static Public Attributes

static XrdHttpChecksumHandler cksumHandler = XrdHttpChecksumHandler()
 
static XrdObjectQ< XrdHttpProtocolProtStack
 
static XrdHttpReadRangeHandler::Configuration ReadRangeConfig
 configuration for the read range handler More...
 

Protected Attributes

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

Static Protected Attributes

static XrdBuffManagerBPool = 0
 
static XrdSecServiceCIA = 0
 
static bool compatNameGeneration = false
 
static int crlRefIntervalSec = XrdTlsContext::DEFAULT_CRL_REF_INT_SEC
 CRL thread refresh interval. More...
 
static XrdSysError eDest = 0
 
static bool embeddedstatic = true
 If true, use the embedded css and icons. More...
 
static char * gridmap = 0
 Gridmap file location. The same used by XrdSecGsi. More...
 
static int hailWait = 60000
 Timeout for reading the handshake. 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 bool isdesthttps = false
 True if the redirections must be towards https targets. More...
 
static bool isRequiredGridmap = false
 
static bool listdeny = false
 If true, any form of listing is denied. More...
 
static char * listredir = 0
 Url to redirect to in the case a listing is requested. More...
 
static BIO_METHOD * m_bio_method = NULL
 C-style vptr table for our custom BIO objects. More...
 
static int m_bio_type = 0
 Type identifier for our custom BIO objects. More...
 
static kXR_int32 myRole = kXR_isManager
 Our role. More...
 
static XrdNetPMarkpmarkHandle = nullptr
 Packet marking handler pointer (assigned from the environment during the Config() call) More...
 
static int Port = 1094
 Our port. More...
 
static char * Port_str = 0
 Our port, as a string. More...
 
static int readWait = 300000
 Timeout for reading data. More...
 
static XrdSchedulerSched = 0
 
static char * secretkey = 0
 The key used to calculate the url hashes. More...
 
static bool selfhttps2http = false
 If client is HTTPS, self-redirect with HTTP+token. More...
 
static XrdOucGMapservGMap = 0
 The instance of the DN mapper. Created only when a valid path is given. More...
 
static char * sslcadir = 0
 
static char * sslcafile = 0
 
static char * sslcert = 0
 OpenSSL stuff. More...
 
static char * sslcipherfilter = 0
 
static char * sslkey = 0
 
static int sslverifydepth = 9
 Depth of verification of a certificate chain. More...
 
static XrdOucHash< StaticPreloadInfo > * staticpreload = 0
 
static char * staticredir = 0
 
static bool tpcForwardCreds = false
 If set to true, the HTTP TPC transfers will forward the credentials to redirected hosts. More...
 
static char * xrd_cslist = nullptr
 The list of checksums that were configured via the xrd.cksum parameter on the server config file. More...
 

Friends

class XrdHttpExtReq
 
class XrdHttpReq
 

Detailed Description

Definition at line 79 of file XrdHttpProtocol.hh.


Class Documentation

◆ XrdHttpProtocol::StaticPreloadInfo

struct XrdHttpProtocol::StaticPreloadInfo

Definition at line 441 of file XrdHttpProtocol.hh.

+ Collaboration diagram for XrdHttpProtocol::StaticPreloadInfo:
Class Members
char * data
int len

Constructor & Destructor Documentation

◆ XrdHttpProtocol() [1/2]

XrdHttpProtocol::XrdHttpProtocol ( const XrdHttpProtocol )
default

Ctor, dtors and copy ctor.

Referenced by Match().

+ Here is the caller graph for this function:

◆ XrdHttpProtocol() [2/2]

XrdHttpProtocol::XrdHttpProtocol ( bool  imhttps)

Definition at line 194 of file XrdHttpProtocol.cc.

195 : XrdProtocol("HTTP protocol handler"), ProtLink(this),
197  myBuff = 0;
198  Addr_str = 0;
199  Reset();
200  ishttps = imhttps;
201 
202 }
XrdObject< XrdHttpProtocol > ProtLink
XrdHttpReq CurrentReq
static XrdHttpReadRangeHandler::Configuration ReadRangeConfig
configuration for the read range handler
XrdSecEntity SecEntity
Authentication area.
XrdProtocol(const char *jname)
Definition: XrdProtocol.hh:156

References Addr_str.

◆ ~XrdHttpProtocol()

XrdHttpProtocol::~XrdHttpProtocol ( )
inline

Definition at line 123 of file XrdHttpProtocol.hh.

123  {
124  Cleanup();
125  }

Member Function Documentation

◆ Configure()

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

Read and apply the configuration.

Definition at line 1779 of file XrdHttpProtocol.cc.

1779  {
1780  /*
1781  Function: Establish configuration at load time.
1782 
1783  Input: None.
1784 
1785  Output: 0 upon success or !0 otherwise.
1786  */
1787 
1788  char *rdf;
1789 
1790  // Copy out the special info we want to use at top level
1791  //
1792  eDest.logger(pi->eDest->logger());
1794  // SI = new XrdXrootdStats(pi->Stats);
1795  Sched = pi->Sched;
1796  BPool = pi->BPool;
1797  xrd_cslist = getenv("XRD_CSLIST");
1798 
1799  Port = pi->Port;
1800 
1801  // Copy out the current TLS context
1802  //
1803  xrdctx = pi->tlsCtx;
1804 
1805  {
1806  char buf[16];
1807  sprintf(buf, "%d", Port);
1808  Port_str = strdup(buf);
1809  }
1810 
1811  // Now process and configuration parameters
1812  //
1813  rdf = (parms && *parms ? parms : pi->ConfigFN);
1814  if (rdf && Config(rdf, pi->theEnv)) return 0;
1815  if (pi->DebugON) XrdHttpTrace.What = TRACE_ALL;
1816 
1817  // Set the redirect flag if we are a pure redirector
1818  myRole = kXR_isServer;
1819  if ((rdf = getenv("XRDROLE"))) {
1820  eDest.Emsg("Config", "XRDROLE: ", rdf);
1821 
1822  if (!strcasecmp(rdf, "manager") || !strcasecmp(rdf, "supervisor")) {
1824  eDest.Emsg("Config", "Configured as HTTP(s) redirector.");
1825  } else {
1826 
1827  eDest.Emsg("Config", "Configured as HTTP(s) data server.");
1828  }
1829 
1830  } else {
1831  eDest.Emsg("Config", "No XRDROLE specified.");
1832  }
1833 
1834  // Schedule protocol object cleanup
1835  //
1837  (XrdHttpTrace.What & TRACE_MEM ? TRACE_MEM : 0));
1838  ProtStack.Set((pi->ConnMax / 3 ? pi->ConnMax / 3 : 30), 60 * 60);
1839 
1840  // Return success
1841  //
1842 
1843  return 1;
1844 }
#define kXR_isManager
Definition: XProtocol.hh:1156
#define kXR_isServer
Definition: XProtocol.hh:1157
XrdSysTrace XrdHttpTrace("http")
#define TRACE_MEM
Definition: XrdTrace.hh:38
#define TRACE_ALL
Definition: XrdTrace.hh:35
static XrdScheduler * Sched
static kXR_int32 myRole
Our role.
static char * Port_str
Our port, as a string.
static XrdSysError eDest
static char * xrd_cslist
The list of checksums that were configured via the xrd.cksum parameter on the server config file.
static XrdObjectQ< XrdHttpProtocol > ProtStack
static int Port
Our port.
static XrdBuffManager * BPool
void Set(int inQMax, time_t agemax=1800)
Definition: XrdObject.icc:90
XrdBuffManager * BPool
Definition: XrdProtocol.hh:63
XrdScheduler * Sched
Definition: XrdProtocol.hh:64
XrdTlsContext * tlsCtx
Definition: XrdProtocol.hh:99
XrdSysError * eDest
Definition: XrdProtocol.hh:61
XrdOucEnv * theEnv
Definition: XrdProtocol.hh:66
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
Definition: XrdSysError.cc:95
XrdSysLogger * logger(XrdSysLogger *lp=0)
Definition: XrdSysError.hh:141
void SetLogger(XrdSysLogger *logp)
Definition: XrdSysTrace.cc:65
XrdTlsContext * xrdctx

References XrdProtocol_Config::BPool, BPool, XrdCms::Config, XrdProtocol_Config::ConfigFN, XrdProtocol_Config::ConnMax, XrdProtocol_Config::DebugON, XrdProtocol_Config::eDest, eDest, XrdSysError::Emsg(), kXR_isManager, kXR_isServer, XrdSysError::logger(), myRole, XrdProtocol_Config::Port, Port, Port_str, ProtStack, XrdProtocol_Config::Sched, Sched, XrdObjectQ< T >::Set(), XrdSysTrace::SetLogger(), XrdProtocol_Config::theEnv, XrdProtocol_Config::tlsCtx, TRACE_ALL, TRACE_MEM, XrdSysTrace::What, xrd_cslist, XrdHttpProtoInfo::xrdctx, and XrdHttpTrace.

Referenced by XrdgetProtocol().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doChksum()

int XrdHttpProtocol::doChksum ( const XrdOucString fname)

Perform a checksum request.

Definition at line 3078 of file XrdHttpProtocol.cc.

3078  {
3079  size_t length;
3080  memset(&CurrentReq.xrdreq, 0, sizeof (ClientRequest));
3084  memset(CurrentReq.xrdreq.query.fhandle, '\0', sizeof(CurrentReq.xrdreq.query.fhandle));
3086  length = fname.length() + 1;
3087  CurrentReq.xrdreq.query.dlen = htonl(length);
3088 
3089  if (!Bridge) return -1;
3090 
3091  return Bridge->Run(reinterpret_cast<char *>(&CurrentReq.xrdreq), const_cast<char *>(fname.c_str()), length) ? 0 : -1;
3092 }
kXR_unt16 requestid
Definition: XProtocol.hh:630
kXR_char reserved1[2]
Definition: XProtocol.hh:632
kXR_unt16 infotype
Definition: XProtocol.hh:631
kXR_char reserved2[8]
Definition: XProtocol.hh:634
kXR_char fhandle[4]
Definition: XProtocol.hh:633
@ kXR_query
Definition: XProtocol.hh:113
struct ClientQueryRequest query
Definition: XProtocol.hh:866
@ kXR_Qcksum
Definition: XProtocol.hh:617
XrdXrootd::Bridge * Bridge
The Bridge that we use to exercise the xrootd internals.
ClientRequest xrdreq
The last issued xrd request, often pending.
Definition: XrdHttpReq.hh:294
const char * c_str() const
int length() const
virtual bool Run(const char *xreqP, char *xdataP=0, int xdataL=0)=0

References Bridge, XrdOucString::c_str(), CurrentReq, ClientQueryRequest::dlen, ClientQueryRequest::fhandle, ClientQueryRequest::infotype, kXR_Qcksum, kXR_query, XrdOucString::length(), ClientRequest::query, ClientQueryRequest::requestid, ClientQueryRequest::reserved1, ClientQueryRequest::reserved2, XrdXrootd::Bridge::Run(), and XrdHttpReq::xrdreq.

Referenced by XrdHttpReq::ProcessHTTPReq().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoIt()

void XrdHttpProtocol::DoIt ( )
inlinevirtual

Override from the base class.

Implements XrdJob.

Definition at line 90 of file XrdHttpProtocol.hh.

90  {
91  if (Resume) (*this.*Resume)();
92  }

◆ doStat()

int XrdHttpProtocol::doStat ( char *  fname)

Perform a Stat request.

Definition at line 3050 of file XrdHttpProtocol.cc.

3050  {
3051  int l;
3052  bool b;
3053  CurrentReq.filesize = 0;
3054  CurrentReq.fileflags = 0;
3055  CurrentReq.filemodtime = 0;
3056 
3057  memset(&CurrentReq.xrdreq, 0, sizeof (ClientRequest));
3059  memset(CurrentReq.xrdreq.stat.reserved, 0,
3060  sizeof (CurrentReq.xrdreq.stat.reserved));
3061  l = strlen(fname) + 1;
3062  CurrentReq.xrdreq.stat.dlen = htonl(l);
3063 
3064  if (!Bridge) return -1;
3065  b = Bridge->Run((char *) &CurrentReq.xrdreq, fname, l);
3066  if (!b) {
3067  return -1;
3068  }
3069 
3070 
3071  return 0;
3072 }
kXR_char reserved[11]
Definition: XProtocol.hh:770
@ kXR_stat
Definition: XProtocol.hh:129
kXR_unt16 requestid
Definition: XProtocol.hh:768
struct ClientStatRequest stat
Definition: XProtocol.hh:873
kXR_int32 dlen
Definition: XProtocol.hh:772
long fileflags
Definition: XrdHttpReq.hh:310
long filemodtime
Definition: XrdHttpReq.hh:311
long long filesize
Definition: XrdHttpReq.hh:309

References Bridge, CurrentReq, ClientStatRequest::dlen, XrdHttpReq::fileflags, XrdHttpReq::filemodtime, XrdHttpReq::filesize, kXR_stat, ClientStatRequest::requestid, ClientStatRequest::reserved, XrdXrootd::Bridge::Run(), ClientRequest::stat, and XrdHttpReq::xrdreq.

Referenced by XrdHttpReq::ProcessHTTPReq().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isHTTPS()

bool XrdHttpProtocol::isHTTPS ( )
inline

called via https

Definition at line 141 of file XrdHttpProtocol.hh.

141 { return ishttps; }

Referenced by XrdHttpExtReq::XrdHttpExtReq().

+ Here is the caller graph for this function:

◆ Match()

XrdProtocol * XrdHttpProtocol::Match ( XrdLink lp)
virtual

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

Implements XrdProtocol.

Definition at line 220 of file XrdHttpProtocol.cc.

220  {
221  char mybuf[16], mybuf2[1024];
222  XrdHttpProtocol *hp;
223  int dlen;
224  bool myishttps = false;
225 
226  // Peek at the first 20 bytes of data
227  //
228  if ((dlen = lp->Peek(mybuf, (int) sizeof (mybuf), hailWait)) < (int) sizeof (mybuf)) {
229  if (dlen <= 0) lp->setEtext("handshake not received");
230  return (XrdProtocol *) 0;
231  }
232  mybuf[dlen - 1] = '\0';
233 
234  // Trace the data
235  //
236 
237  TRACEI(DEBUG, "received dlen: " << dlen);
238  //TRACEI(REQ, "received buf: " << mybuf);
239  mybuf2[0] = '\0';
240  for (int i = 0; i < dlen; i++) {
241  char mybuf3[16];
242  sprintf(mybuf3, "%.02d ", mybuf[i]);
243  strcat(mybuf2, mybuf3);
244 
245  }
246  TRACEI(DEBUG, "received dump: " << mybuf2);
247 
248  // Decide if it looks http or not. For now we are happy if all the received characters are alphanumeric
249  bool ismine = true;
250  for (int i = 0; i < dlen - 1; i++)
251  if (!isprint(mybuf[i]) && (mybuf[i] != '\r') && (mybuf[i] != '\n')) {
252  ismine = false;
253  TRACEI(DEBUG, "This does not look like http at pos " << i);
254  break;
255  }
256 
257  // If it does not look http then look if it looks like https
258  if ((!ismine) && (dlen >= 4)) {
259  char check[4] = {00, 00, 00, 00};
260  if (memcmp(mybuf, check, 4)) {
261 
262  if (httpsmode) {
263  ismine = true;
264  myishttps = true;
265  TRACEI(DEBUG, "This may look like https");
266  } else {
267  TRACEI(ALL, "This may look like https, but https is not configured");
268  }
269 
270  }
271  }
272 
273  if (!ismine) {
274  TRACEI(DEBUG, "This does not look like https. Protocol not matched.");
275  return (XrdProtocol *) 0;
276  }
277 
278  // It does look http or https...
279  // Get a protocol object off the stack (if none, allocate a new one)
280  //
281 
282  TRACEI(REQ, "Protocol matched. https: " << myishttps);
283  if (!(hp = ProtStack.Pop())) hp = new XrdHttpProtocol(myishttps);
284  else
285  hp->ishttps = myishttps;
286 
287  // We now have to do some work arounds to tell the underlying framework
288  // that is is https without invoking TLS on the actual link. Eventually,
289  // we should just use the link's TLS native implementation.
290  //
291  hp->SecEntity.addrInfo = lp->AddrInfo();
292  XrdNetAddr *netP = const_cast<XrdNetAddr*>(lp->NetAddr());
293  netP->SetDialect("https");
294  netP->SetTLS(true);
295 
296  // Allocate 1MB buffer from pool
297  if (!hp->myBuff) {
298  hp->myBuff = BPool->Obtain(1024 * 1024);
299  }
300  hp->myBuffStart = hp->myBuffEnd = hp->myBuff->buff;
301 
302  // Bind the protocol to the link and return the protocol
303  //
304  hp->Link = lp;
305  return (XrdProtocol *) hp;
306 }
#define DEBUG(x)
Definition: XrdBwmTrace.hh:54
#define TRACEI(act, x)
Definition: XrdTrace.hh:66
XrdBuffer * Obtain(int bsz)
Definition: XrdBuffer.cc:140
char * buff
Definition: XrdBuffer.hh:45
static int hailWait
Timeout for reading the handshake.
XrdLink * Link
The link we are bound to.
XrdHttpProtocol(const XrdHttpProtocol &)=default
Ctor, dtors and copy ctor.
void SetDialect(const char *dP)
Definition: XrdNetAddr.hh:205
void SetTLS(bool val)
Definition: XrdNetAddr.cc:590
T * Pop()
Definition: XrdObject.hh:93
XrdNetAddrInfo * addrInfo
Entity's connection details.
Definition: XrdSecEntity.hh:80

References XrdHttpProtocol(), XrdLink::AddrInfo(), XrdSecEntity::addrInfo, BPool, XrdBuffer::buff, DEBUG, hailWait, XrdHttpProtoInfo::httpsmode, Link, XrdLink::NetAddr(), XrdBuffManager::Obtain(), XrdLink::Peek(), XrdObjectQ< T >::Pop(), ProtStack, SecEntity, XrdNetAddr::SetDialect(), XrdLink::setEtext(), XrdNetAddr::SetTLS(), and TRACEI.

+ Here is the call graph for this function:

◆ operator=()

XrdHttpProtocol XrdHttpProtocol::operator= ( const XrdHttpProtocol rhs)

Definition at line 209 of file XrdHttpProtocol.cc.

209  {
210 
211  return *this;
212 }

◆ parseHeader2CGI()

int XrdHttpProtocol::parseHeader2CGI ( XrdOucStream Config,
XrdSysError err,
std::map< std::string, std::string > &  header2cgi 
)
static

Use this function to parse header2cgi configurations.

Definition at line 1849 of file XrdHttpProtocol.cc.

1849  {
1850  char *val, keybuf[1024], parmbuf[1024];
1851  char *parm;
1852 
1853  // Get the header key
1854  val = Config.GetWord();
1855  if (!val || !val[0]) {
1856  err.Emsg("Config", "No headerkey specified.");
1857  return 1;
1858  } else {
1859 
1860  // Trim the beginning, in place
1861  while ( *val && !isalnum(*val) ) val++;
1862  strcpy(keybuf, val);
1863 
1864  // Trim the end, in place
1865  char *pp;
1866  pp = keybuf + strlen(keybuf) - 1;
1867  while ( (pp >= keybuf) && (!isalnum(*pp)) ) {
1868  *pp = '\0';
1869  pp--;
1870  }
1871 
1872  parm = Config.GetWord();
1873 
1874  // Avoids segfault in case a key is given without value
1875  if(!parm || !parm[0]) {
1876  err.Emsg("Config", "No header2cgi value specified. key: '", keybuf, "'");
1877  return 1;
1878  }
1879 
1880  // Trim the beginning, in place
1881  while ( *parm && !isalnum(*parm) ) parm++;
1882  strcpy(parmbuf, parm);
1883 
1884  // Trim the end, in place
1885  pp = parmbuf + strlen(parmbuf) - 1;
1886  while ( (pp >= parmbuf) && (!isalnum(*pp)) ) {
1887  *pp = '\0';
1888  pp--;
1889  }
1890 
1891  // Add this mapping to the map that will be used
1892  try {
1893  header2cgi[keybuf] = parmbuf;
1894  } catch ( ... ) {
1895  err.Emsg("Config", "Can't insert new header2cgi rule. key: '", keybuf, "'");
1896  return 1;
1897  }
1898 
1899  }
1900  return 0;
1901 }
XrdCmsConfig Config

References XrdCms::Config, and XrdSysError::Emsg().

+ Here is the call graph for this function:

◆ Process()

int XrdHttpProtocol::Process ( XrdLink lp)
virtual

Process data incoming from the socket.

Implements XrdProtocol.

Definition at line 499 of file XrdHttpProtocol.cc.

500 {
501  int rc = 0;
502 
503  TRACEI(DEBUG, " Process. lp:"<<(void *)lp<<" reqstate: "<<CurrentReq.reqstate);
504 
505  if (!myBuff || !myBuff->buff || !myBuff->bsize) {
506  TRACE(ALL, " Process. No buffer available. Internal error.");
507  return -1;
508  }
509 
510 
511  if (!SecEntity.host) {
512  char *nfo = GetClientIPStr();
513  if (nfo) {
514  TRACEI(REQ, " Setting host: " << nfo);
515  SecEntity.host = nfo;
516  strcpy(SecEntity.prot, "http");
517  }
518  }
519 
520 
521 
522  // If https then check independently for the ssl handshake
523  if (ishttps && !ssldone) {
524 
525  if (!ssl) {
526  sbio = CreateBIO(Link);
527  BIO_set_nbio(sbio, 1);
529  ssl = (SSL*)xrdctx->Session();
530  postheaderauth = false;
531  postheaderwait = false;
532  postheaderauthdone = false;
533  }
534 
535  if (!ssl) {
536  TRACEI(DEBUG, " SSL_new returned NULL");
537  ERR_print_errors(sslbio_err);
538  return -1;
539  }
540 
541  // If a secxtractor has been loaded
542  // maybe it wants to add its own initialization bits
543  if (secxtractor)
544  secxtractor->InitSSL(ssl, sslcadir);
545 
546  SSL_set_bio(ssl, sbio, sbio);
547  //SSL_set_connect_state(ssl);
548 
549  //SSL_set_fd(ssl, Link->FDnum());
550  struct timeval tv;
551  tv.tv_sec = 10;
552  tv.tv_usec = 0;
553  setsockopt(Link->FDnum(), SOL_SOCKET, SO_RCVTIMEO, (struct timeval *)&tv, sizeof(struct timeval));
554  setsockopt(Link->FDnum(), SOL_SOCKET, SO_SNDTIMEO, (struct timeval *)&tv, sizeof(struct timeval));
555 
556  TRACEI(DEBUG, " Entering SSL_accept...");
557  int res = SSL_accept(ssl);
558  TRACEI(DEBUG, " SSL_accept returned :" << res);
559  if ((res == -1) && (SSL_get_error(ssl, res) == SSL_ERROR_WANT_READ)) {
560  TRACEI(DEBUG, " SSL_accept wants to read more bytes... err:" << SSL_get_error(ssl, res));
561  return 1;
562  }
563 
564  if(res <= 0) {
565  ERR_print_errors(sslbio_err);
566  if (res < 0) {
567 
568  SSL_free(ssl);
569  ssl = 0;
570  return -1;
571  }
572  }
573 
574  BIO_set_nbio(sbio, 0);
575 
576  strcpy(SecEntity.prot, "https");
577 
578  // Get the voms string and auth information
579  if (tlsClientAuth == XrdTlsContext::ClientAuthSetting::kOn && HandleAuthentication(Link)) {
580  SSL_free(ssl);
581  ssl = 0;
582  return -1;
583  }
584 
585  ssldone = true;
586  if (TRACING(TRACE_AUTH)) {
588  }
589  }
590 
591 
592 
593  if (!DoingLogin) {
594  // Re-invocations triggered by the bridge have lp==0
595  // In this case we keep track of a different request state
596  if (lp) {
597 
598  // This is an invocation that was triggered by a socket event
599  // Read all the data that is available, throw it into the buffer
600  if ((rc = getDataOneShot(BuffAvailable())) < 0) {
601  // Error -> exit
602  return -1;
603  }
604 
605  // If we need more bytes, let's wait for another invokation
606  if (BuffUsed() < ResumeBytes) return 1;
607 
608 
609  } else
611  } else if (!DoneSetInfo && !postheaderwait && !postheaderauth && !CurrentReq.userAgent().empty()) { // DoingLogin is true, meaning the login finished.
612  std::string mon_info = "monitor info " + CurrentReq.userAgent();
613  DoneSetInfo = true;
614  if (mon_info.size() >= 1024) {
615  TRACEI(ALL, "User agent string too long");
616  } else if (!Bridge) {
617  TRACEI(ALL, "Internal logic error: Bridge is null after login");
618  } else {
619  TRACEI(DEBUG, "Setting " << mon_info);
620  memset(&CurrentReq.xrdreq, 0, sizeof (ClientRequest));
622  CurrentReq.xrdreq.set.modifier = '\0';
623  memset(CurrentReq.xrdreq.set.reserved, '\0', sizeof(CurrentReq.xrdreq.set.reserved));
624  CurrentReq.xrdreq.set.dlen = htonl(mon_info.size());
625  if (!Bridge->Run((char *) &CurrentReq.xrdreq, (char *) mon_info.c_str(), mon_info.size())) {
626  SendSimpleResp(500, nullptr, nullptr, "Could not set user agent.", 0, false);
627  return -1;
628  }
629  return 0;
630  }
631  } else if (!postheaderwait) {
632  DoingLogin = false;
633  }
634 
635  // Read the next request header, that is, read until a double CRLF is found
636 
637 
638  if (!CurrentReq.headerok) {
639 
640  // Read as many lines as possible into the buffer. An empty line breaks
641  while ((rc = BuffgetLine(tmpline)) > 0) {
642  std::string traceLine = tmpline.c_str();
643  if (TRACING(TRACE_DEBUG)) {
644  traceLine = obfuscateAuth(traceLine);
645  }
646  TRACE(DEBUG, " rc:" << rc << " got hdr line: " << traceLine);
647  if ((rc == 2) && (tmpline.length() > 1) && (tmpline[rc - 1] == '\n')) {
648  CurrentReq.headerok = true;
649  TRACE(DEBUG, " rc:" << rc << " detected header end.");
650  break;
651  }
652 
653 
655  TRACE(DEBUG, " Parsing first line: " << traceLine.c_str());
656  int result = CurrentReq.parseFirstLine((char *)tmpline.c_str(), rc);
657  if (result < 0) {
658  TRACE(DEBUG, " Parsing of first line failed with " << result);
659  return -1;
660  }
661 
662 #if OPENSSL_VERSION_NUMBER >= 0x10100010L
663  // We permit TLS client auth to be deferred until after the request path is sent.
664  // If this is a path requiring client auth, then do that now.
665  if (!postheaderauthdone && tlsClientAuth == XrdTlsContext::ClientAuthSetting::kDefer)
666  {for (const auto &prefix : tlsAuthRequestPrefixes) {
667  {if (!strncmp(prefix.c_str(), CurrentReq.resource.c_str(), prefix.length()))
668  {postheaderwait = true;
669  DoingLogin = true;
670  break;
671  }
672  }
673  }
674  }
675 #endif
676  } else {
677  int result = CurrentReq.parseLine((char *) tmpline.c_str(), rc);
678  if(result < 0) {
679  TRACE(DEBUG, " Parsing of header line failed with " << result)
680  SendSimpleResp(400,NULL,NULL,"Malformed header line. Hint: ensure the line finishes with \"\\r\\n\"", 0, false);
681  return -1;
682  }
683  }
684 
685 
686  }
687 
688  // Here we have CurrentReq loaded with the header, or its relevant fields
689 
690  if (!CurrentReq.headerok) {
691  TRACEI(REQ, " rc:" << rc << "Header not yet complete.");
692 
693  // Here a subtle error condition. IF we failed reading a line AND the buffer
694  // has a reasonable amount of data available THEN we consider the header
695  // as corrupted and shutdown the client
696  if ((rc <= 0) && (BuffUsed() >= 16384)) {
697  TRACEI(ALL, "Corrupted header detected, or line too long. Disconnecting client.");
698  return -1;
699  }
700 
701 
702  if (CurrentReq.reqstate > 0)
704  // Waiting for more data
705  return 1;
706  }
707 
708  }
709 
710 
711 #if OPENSSL_VERSION_NUMBER >= 0x10100010L
712  if (postheaderwait) {
713  postheaderwait = false;
714  if (SSL_verify_client_post_handshake(ssl) != 1) {
715  // This is hit if the remote client doesn't support the post-handshake authentication
716  // (curl, Mac OSX) or TLS v1.3 (RHEL7).
717  TRACEI(ALL, "Unable to request client X.509 authentication");
718  ERR_print_errors(sslbio_err);
719  } else {
720  // We must invoke an empty write to trigger the authentication request in the TLS layer.
721  size_t write_size;
722  auto res = SSL_write_ex(ssl, nullptr, 0, &write_size);
723  if (res <= 0) {
724  TRACEI(DEBUG, " SSL post-handshake auth failed; err:" << SSL_get_error(ssl, res));
725  ERR_print_errors(sslbio_err);
726  SendSimpleResp(500, nullptr, nullptr, "Failed post-handshake authentication", 0, false);
727  return -1;
728  } else {
729  TRACEI(DEBUG, " SSL post-handshake auth finished successfully");
730  postheaderauth = true;
731  return 1;
732  }
733  }
734  }
735  if (postheaderauth) {
736  postheaderauth = false;
737  postheaderauthdone = true;
738  size_t readbytes;
739  TRACEI(REQ, "Reading out response to post-handshake authentication");
740  BIO_set_nbio(sbio, 1);
741  auto res = SSL_peek_ex(ssl, nullptr, 0, &readbytes);
742  if ((res <= 0) && SSL_get_error(ssl, res) != SSL_ERROR_WANT_READ) {
743  SendSimpleResp(500, nullptr, nullptr, "Failed to process authentication frames", 0, false);
744  return -1;
745  }
746  BIO_set_nbio(sbio, 0);
747  if (HandleAuthentication(Link)) {
748  SendSimpleResp(500, nullptr, nullptr, "Failed to extract authentication information from handshake", 0, false);
749  return -1;
750  }
751  }
752 #endif
753 
754  // If we are in self-redirect mode, then let's do it
755  // Do selfredirect only with 'simple' requests, otherwise poor clients may misbehave
756  if (ishttps && ssldone && selfhttps2http &&
759  char hash[512];
760  time_t timenow = time(0);
761 
762 
764  &SecEntity,
765  timenow,
766  secretkey);
767 
768 
769 
770  if (hash[0]) {
771 
772  // Workaround... delete the previous opaque information
773  if (CurrentReq.opaque) {
774  delete CurrentReq.opaque;
775  CurrentReq.opaque = 0;
776  }
777 
778  TRACEI(REQ, " rc:" << rc << " self-redirecting to http with security token.");
779 
780  XrdOucString dest = "Location: http://";
781  // Here I should put the IP addr of the server
782 
783  // We have to recompute it here because we don't know to which
784  // interface the client had connected to
785  struct sockaddr_storage sa;
786  socklen_t sl = sizeof(sa);
787  getsockname(this->Link->AddrInfo()->SockFD(), (struct sockaddr*)&sa, &sl);
788 
789  // now get it back and print it
790  char buf[256];
791  bool ok = false;
792 
793  switch (sa.ss_family) {
794  case AF_INET:
795  if (inet_ntop(AF_INET, &(((sockaddr_in*)&sa)->sin_addr), buf, INET_ADDRSTRLEN)) {
796  if (Addr_str) free(Addr_str);
797  Addr_str = strdup(buf);
798  ok = true;
799  }
800  break;
801  case AF_INET6:
802  if (inet_ntop(AF_INET6, &(((sockaddr_in6*)&sa)->sin6_addr), buf, INET6_ADDRSTRLEN)) {
803  if (Addr_str) free(Addr_str);
804  Addr_str = (char *)malloc(strlen(buf)+3);
805  strcpy(Addr_str, "[");
806  strcat(Addr_str, buf);
807  strcat(Addr_str, "]");
808  ok = true;
809  }
810  break;
811  default:
812  TRACEI(REQ, " Can't recognize the address family of the local host.");
813  }
814 
815  if (ok) {
816  dest += Addr_str;
817  dest += ":";
818  dest += Port_str;
819  dest += CurrentReq.resource.c_str();
820  TRACEI(REQ," rc:"<<rc<<" self-redirecting to http with security token: '"
821  << dest.c_str() << "'");
822 
823 
824  CurrentReq.appendOpaque(dest, &SecEntity, hash, timenow);
825  SendSimpleResp(302, NULL, (char *) dest.c_str(), 0, 0, true);
826  CurrentReq.reset();
827  return -1;
828  }
829 
830  TRACEI(REQ, " rc:" << rc << " Can't perform self-redirection.");
831 
832  }
833  else {
834  TRACEI(ALL, " Could not calculate self-redirection hash");
835  }
836  }
837 
838  // If this is not https, then extract the signed information from the url
839  // and fill the SecEntity structure as if we were using https
840  if (!ishttps && !ssldone) {
841 
842 
843  if (CurrentReq.opaque) {
844  char * tk = CurrentReq.opaque->Get("xrdhttptk");
845  // If there is a hash then we use it as authn info
846  if (tk) {
847 
848  time_t tim = 0;
849  char * t = CurrentReq.opaque->Get("xrdhttptime");
850  if (t) tim = atoi(t);
851  if (!t) {
852  TRACEI(REQ, " xrdhttptime not specified. Authentication failed.");
853  return -1;
854  }
855  if (abs(time(0) - tim) > XRHTTP_TK_GRACETIME) {
856  TRACEI(REQ, " Token expired. Authentication failed.");
857  return -1;
858  }
859 
860  // Fill the Secentity from the fields in the URL:name, vo, host
861  char *nfo;
862 
863  nfo = CurrentReq.opaque->Get("xrdhttpvorg");
864  if (nfo) {
865  TRACEI(DEBUG, " Setting vorg: " << nfo);
866  SecEntity.vorg = strdup(nfo);
867  TRACEI(REQ, " Setting vorg: " << SecEntity.vorg);
868  }
869 
870  nfo = CurrentReq.opaque->Get("xrdhttpname");
871  if (nfo) {
872  TRACEI(DEBUG, " Setting name: " << nfo);
873  SecEntity.name = unquote(nfo);
874  TRACEI(REQ, " Setting name: " << SecEntity.name);
875  }
876 
877  nfo = CurrentReq.opaque->Get("xrdhttphost");
878  if (nfo) {
879  TRACEI(DEBUG, " Setting host: " << nfo);
880  if (SecEntity.host) free(SecEntity.host);
881  SecEntity.host = unquote(nfo);
882  TRACEI(REQ, " Setting host: " << SecEntity.host);
883  }
884 
885  nfo = CurrentReq.opaque->Get("xrdhttpdn");
886  if (nfo) {
887  TRACEI(DEBUG, " Setting dn: " << nfo);
888  SecEntity.moninfo = unquote(nfo);
889  TRACEI(REQ, " Setting dn: " << SecEntity.moninfo);
890  }
891 
892  nfo = CurrentReq.opaque->Get("xrdhttprole");
893  if (nfo) {
894  TRACEI(DEBUG, " Setting role: " << nfo);
895  SecEntity.role = unquote(nfo);
896  TRACEI(REQ, " Setting role: " << SecEntity.role);
897  }
898 
899  nfo = CurrentReq.opaque->Get("xrdhttpgrps");
900  if (nfo) {
901  TRACEI(DEBUG, " Setting grps: " << nfo);
902  SecEntity.grps = unquote(nfo);
903  TRACEI(REQ, " Setting grps: " << SecEntity.grps);
904  }
905 
906  nfo = CurrentReq.opaque->Get("xrdhttpendorsements");
907  if (nfo) {
908  TRACEI(DEBUG, " Setting endorsements: " << nfo);
910  TRACEI(REQ, " Setting endorsements: " << SecEntity.endorsements);
911  }
912 
913  nfo = CurrentReq.opaque->Get("xrdhttpcredslen");
914  if (nfo) {
915  TRACEI(DEBUG, " Setting credslen: " << nfo);
916  char *s1 = unquote(nfo);
917  if (s1 && s1[0]) {
918  SecEntity.credslen = atoi(s1);
919  TRACEI(REQ, " Setting credslen: " << SecEntity.credslen);
920  }
921  if (s1) free(s1);
922  }
923 
924  if (SecEntity.credslen) {
925  nfo = CurrentReq.opaque->Get("xrdhttpcreds");
926  if (nfo) {
927  TRACEI(DEBUG, " Setting creds: " << nfo);
928  SecEntity.creds = unquote(nfo);
929  TRACEI(REQ, " Setting creds: " << SecEntity.creds);
930  }
931  }
932 
933  char hash[512];
934 
936  &SecEntity,
937  tim,
938  secretkey);
939 
940  if (compareHash(hash, tk)) {
941  TRACEI(REQ, " Invalid tk '" << tk << "' != '" << hash << "'(calculated). Authentication failed.");
942  return -1;
943  }
944 
945  } else {
946  // Client is plain http. If we have a secret key then we reject it
947  if (secretkey) {
948  TRACEI(ALL, " Rejecting plain http with no valid token as we have a secretkey.");
949  return -1;
950  }
951  }
952 
953  } else {
954  // Client is plain http. If we have a secret key then we reject it
955  if (secretkey) {
956  TRACEI(ALL, " Rejecting plain http with no valid token as we have a secretkey.");
957  return -1;
958  }
959  }
960 
961  ssldone = true;
962  }
963 
964 
965 
966  // Now we have everything that is needed to try the login
967  // Remember that if there is an exthandler then it has the responsibility
968  // for authorization in the paths that it manages
969  if (!Bridge && !FindMatchingExtHandler(CurrentReq)) {
970  if (SecEntity.name)
971  Bridge = XrdXrootd::Bridge::Login(&CurrentReq, Link, &SecEntity, SecEntity.name, ishttps ? "https" : "http");
972  else
973  Bridge = XrdXrootd::Bridge::Login(&CurrentReq, Link, &SecEntity, "unknown", ishttps ? "https" : "http");
974 
975  if (!Bridge) {
976  TRACEI(REQ, " Authorization failed.");
977  return -1;
978  }
979 
980  // Let the bridge process the login, and then reinvoke us
981  DoingLogin = true;
982  return 0;
983  }
984 
985  // Compute and send the response. This may involve further reading from the socket
986  rc = CurrentReq.ProcessHTTPReq();
987  if (rc < 0)
988  CurrentReq.reset();
989 
990 
991 
992  TRACEI(REQ, "Process is exiting rc:" << rc);
993  return rc;
994 }
struct ClientSetRequest set
Definition: XProtocol.hh:871
@ kXR_set
Definition: XProtocol.hh:130
kXR_unt16 requestid
Definition: XProtocol.hh:719
kXR_int32 dlen
Definition: XProtocol.hh:722
kXR_char modifier
Definition: XProtocol.hh:721
kXR_char reserved[15]
Definition: XProtocol.hh:720
short kXR_int16
Definition: XPtypes.hh:66
#define XRHTTP_TK_GRACETIME
#define TRACE_AUTH
Definition: XrdHttpTrace.hh:48
int compareHash(const char *h1, const char *h2)
char * unquote(char *str)
void calcHashes(char *hash, const char *fn, kXR_int16 request, XrdSecEntity *secent, time_t tim, const char *key)
std::string obfuscateAuth(const std::string &input)
#define TRACE_DEBUG
Definition: XrdTrace.hh:36
#define TRACE(act, x)
Definition: XrdTrace.hh:63
#define TRACING(x)
Definition: XrdTrace.hh:70
int bsize
Definition: XrdBuffer.hh:46
static char * secretkey
The key used to calculate the url hashes.
static bool selfhttps2http
If client is HTTPS, self-redirect with HTTP+token.
static char * sslcadir
int reqstate
State machine to talk to the bridge.
Definition: XrdHttpReq.hh:320
XrdOucString resource
The resource specified by the request, stripped of opaque data.
Definition: XrdHttpReq.hh:244
bool headerok
Tells if we have finished reading the header.
Definition: XrdHttpReq.hh:252
ReqType request
The request we got.
Definition: XrdHttpReq.hh:236
int ProcessHTTPReq()
Definition: XrdHttpReq.cc:928
XrdOucEnv * opaque
The opaque data, after parsing.
Definition: XrdHttpReq.hh:246
int parseFirstLine(char *line, int len)
Parse the first line of the header.
Definition: XrdHttpReq.cc:256
int parseLine(char *line, int len)
Parse the header.
Definition: XrdHttpReq.cc:116
void appendOpaque(XrdOucString &s, XrdSecEntity *secent, char *hash, time_t tnow)
Definition: XrdHttpReq.cc:629
const std::string & userAgent() const
Definition: XrdHttpReq.hh:210
virtual void reset()
Definition: XrdHttpReq.cc:2735
virtual int InitSSL(SSL *, char *)
char * Get(const char *varname)
Definition: XrdOucEnv.hh:69
char * vorg
Entity's virtual organization(s)
Definition: XrdSecEntity.hh:71
int credslen
Length of the 'creds' data.
Definition: XrdSecEntity.hh:78
char prot[XrdSecPROTOIDSIZE]
Auth protocol used (e.g. krb5)
Definition: XrdSecEntity.hh:67
char * creds
Raw entity credentials or cert.
Definition: XrdSecEntity.hh:77
char * grps
Entity's group name(s)
Definition: XrdSecEntity.hh:73
char * name
Entity's name.
Definition: XrdSecEntity.hh:69
char * role
Entity's role(s)
Definition: XrdSecEntity.hh:72
char * endorsements
Protocol specific endorsements.
Definition: XrdSecEntity.hh:75
void Display(XrdSysError &mDest)
Definition: XrdSecEntity.cc:58
char * moninfo
Information for monitoring.
Definition: XrdSecEntity.hh:76
char * host
Entity's host name dnr dependent.
Definition: XrdSecEntity.hh:70
void SetTlsClientAuth(ClientAuthSetting setting)
void * Session()
static Bridge * Login(Result *rsltP, XrdLink *linkP, XrdSecEntity *seceP, const char *nameP, const char *protP)
std::vector< std::string > tlsAuthRequestPrefixes
XrdTlsContext::ClientAuthSetting tlsClientAuth

References Addr_str, XrdLink::AddrInfo(), XrdHttpReq::appendOpaque(), Bridge, XrdBuffer::bsize, XrdBuffer::buff, XrdOucString::c_str(), calcHashes(), compareHash(), XrdSecEntity::creds, XrdSecEntity::credslen, CurrentReq, DEBUG, XrdSecEntity::Display(), ClientSetRequest::dlen, eDest, XrdSecEntity::endorsements, XrdLink::FDnum(), XrdOucEnv::Get(), XrdSecEntity::grps, XrdHttpReq::headerok, XrdSecEntity::host, XrdHttpSecXtractor::InitSSL(), kXR_set, XrdOucString::length(), Link, XrdXrootd::Bridge::Login(), ClientSetRequest::modifier, XrdSecEntity::moninfo, XrdSecEntity::name, obfuscateAuth(), XrdHttpReq::opaque, XrdHttpReq::parseFirstLine(), XrdHttpReq::parseLine(), Port_str, XrdHttpReq::ProcessHTTPReq(), XrdSecEntity::prot, XrdHttpReq::reqstate, XrdHttpReq::request, ClientSetRequest::requestid, ClientSetRequest::reserved, XrdHttpReq::reset(), XrdHttpReq::resource, XrdSecEntity::role, XrdHttpReq::rtGET, XrdHttpReq::rtPROPFIND, XrdHttpReq::rtPUT, XrdHttpReq::rtUnset, XrdXrootd::Bridge::Run(), SecEntity, secretkey, selfhttps2http, XrdTlsContext::Session(), ClientRequest::set, XrdTlsContext::SetTlsClientAuth(), XrdNetAddrInfo::SockFD(), sslcadir, XrdHttpProtoInfo::tlsAuthRequestPrefixes, XrdHttpProtoInfo::tlsClientAuth, TRACE, TRACE_AUTH, TRACE_DEBUG, TRACEI, TRACING, unquote(), XrdHttpReq::userAgent(), XrdSecEntity::vorg, XrdHttpProtoInfo::xrdctx, XrdHttpReq::xrdreq, and XRHTTP_TK_GRACETIME.

+ Here is the call graph for this function:

◆ Recycle()

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

Recycle this instance.

Implements XrdProtocol.

Definition at line 1002 of file XrdHttpProtocol.cc.

1002  {
1003 
1004  // Release all appendages
1005  //
1006 
1007  Cleanup();
1008 
1009 
1010  // Set fields to starting point (debugging mostly)
1011  //
1012  Reset();
1013 
1014  // Push ourselves on the stack
1015  //
1017 }
void Push(XrdObject< T > *Node)
Definition: XrdObject.hh:101

References ProtLink, ProtStack, and XrdObjectQ< T >::Push().

+ Here is the call graph for this function:

◆ Stats()

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

Get activity stats.

Implements XrdProtocol.

Definition at line 1019 of file XrdHttpProtocol.cc.

1019  {
1020  // Synchronize statistics if need be
1021  //
1022  // if (do_sync) {
1023  //
1024  // SI->statsMutex.Lock();
1025  // SI->readCnt += numReads;
1026  // cumReads += numReads;
1027  // numReads = 0;
1028  // SI->prerCnt += numReadP;
1029  // cumReadP += numReadP;
1030  // numReadP = 0;
1031  // SI->rvecCnt += numReadV;
1032  // cumReadV += numReadV;
1033  // numReadV = 0;
1034  // SI->rsegCnt += numSegsV;
1035  // cumSegsV += numSegsV;
1036  // numSegsV = 0;
1037  // SI->writeCnt += numWrites;
1038  // cumWrites += numWrites;
1039  // numWrites = 0;
1040  // SI->statsMutex.UnLock();
1041  // }
1042  //
1043  // // Now return the statistics
1044  // //
1045  // return SI->Stats(buff, blen, do_sync);
1046 
1047  return 0;
1048 }

Friends And Related Function Documentation

◆ XrdHttpExtReq

friend class XrdHttpExtReq
friend

Definition at line 82 of file XrdHttpProtocol.hh.

◆ XrdHttpReq

friend class XrdHttpReq
friend

Definition at line 81 of file XrdHttpProtocol.hh.

Member Data Documentation

◆ Addr_str

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.

Definition at line 375 of file XrdHttpProtocol.hh.

Referenced by XrdHttpProtocol(), and Process().

◆ BPool

XrdBuffManager * XrdHttpProtocol::BPool = 0
staticprotected

Definition at line 366 of file XrdHttpProtocol.hh.

Referenced by Configure(), and Match().

◆ Bridge

XrdXrootd::Bridge* XrdHttpProtocol::Bridge
protected

The Bridge that we use to exercise the xrootd internals.

Definition at line 381 of file XrdHttpProtocol.hh.

Referenced by doChksum(), doStat(), Process(), and XrdHttpReq::ProcessHTTPReq().

◆ CIA

XrdSecService * XrdHttpProtocol::CIA = 0
staticprotected

Definition at line 368 of file XrdHttpProtocol.hh.

◆ cksumHandler

XrdHttpChecksumHandler XrdHttpProtocol::cksumHandler = XrdHttpChecksumHandler()
static

Definition at line 135 of file XrdHttpProtocol.hh.

Referenced by XrdHttpReq::ProcessHTTPReq().

◆ compatNameGeneration

bool XrdHttpProtocol::compatNameGeneration = false
staticprotected

Definition at line 414 of file XrdHttpProtocol.hh.

◆ crlRefIntervalSec

int XrdHttpProtocol::crlRefIntervalSec = XrdTlsContext::DEFAULT_CRL_REF_INT_SEC
staticprotected

CRL thread refresh interval.

Definition at line 409 of file XrdHttpProtocol.hh.

◆ CurrentReq

XrdHttpReq XrdHttpProtocol::CurrentReq
protected

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

Definition at line 386 of file XrdHttpProtocol.hh.

Referenced by doChksum(), doStat(), and Process().

◆ eDest

XrdSysError XrdHttpProtocol::eDest = 0
staticprotected

Definition at line 367 of file XrdHttpProtocol.hh.

Referenced by Configure(), and Process().

◆ embeddedstatic

bool XrdHttpProtocol::embeddedstatic = true
staticprotected

If true, use the embedded css and icons.

Definition at line 435 of file XrdHttpProtocol.hh.

Referenced by XrdHttpReq::ProcessHTTPReq().

◆ gridmap

char * XrdHttpProtocol::gridmap = 0
staticprotected

Gridmap file location. The same used by XrdSecGsi.

Definition at line 412 of file XrdHttpProtocol.hh.

◆ hailWait

int XrdHttpProtocol::hailWait = 60000
staticprotected

Timeout for reading the handshake.

Definition at line 394 of file XrdHttpProtocol.hh.

Referenced by Match().

◆ hdr2cgimap

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

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

Definition at line 451 of file XrdHttpProtocol.hh.

Referenced by XrdHttpReq::parseLine().

◆ isdesthttps

bool XrdHttpProtocol::isdesthttps = false
staticprotected

True if the redirections must be towards https targets.

Definition at line 423 of file XrdHttpProtocol.hh.

Referenced by XrdHttpReq::Redir().

◆ isRequiredGridmap

bool XrdHttpProtocol::isRequiredGridmap = false
staticprotected

Definition at line 413 of file XrdHttpProtocol.hh.

◆ Link

XrdLink* XrdHttpProtocol::Link
protected

The link we are bound to.

Definition at line 371 of file XrdHttpProtocol.hh.

Referenced by XrdHttpExtReq::GetClientID(), Match(), and Process().

◆ listdeny

bool XrdHttpProtocol::listdeny = false
staticprotected

If true, any form of listing is denied.

Definition at line 429 of file XrdHttpProtocol.hh.

Referenced by XrdHttpReq::ProcessHTTPReq().

◆ listredir

char * XrdHttpProtocol::listredir = 0
staticprotected

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

Definition at line 426 of file XrdHttpProtocol.hh.

Referenced by XrdHttpReq::ProcessHTTPReq().

◆ m_bio_method

BIO_METHOD * XrdHttpProtocol::m_bio_method = NULL
staticprotected

C-style vptr table for our custom BIO objects.

Definition at line 457 of file XrdHttpProtocol.hh.

◆ m_bio_type

int XrdHttpProtocol::m_bio_type = 0
staticprotected

Type identifier for our custom BIO objects.

Definition at line 454 of file XrdHttpProtocol.hh.

◆ myRole

kXR_int32 XrdHttpProtocol::myRole = kXR_isManager
staticprotected

Our role.

Definition at line 448 of file XrdHttpProtocol.hh.

Referenced by Configure(), and XrdHttpReq::ProcessHTTPReq().

◆ pmarkHandle

XrdNetPMark * XrdHttpProtocol::pmarkHandle = nullptr
staticprotected

Packet marking handler pointer (assigned from the environment during the Config() call)

Definition at line 463 of file XrdHttpProtocol.hh.

Referenced by XrdHttpExtReq::XrdHttpExtReq(), and XrdHttpReq::parseLine().

◆ Port

int XrdHttpProtocol::Port = 1094
staticprotected

Our port.

Definition at line 400 of file XrdHttpProtocol.hh.

Referenced by Configure().

◆ Port_str

char * XrdHttpProtocol::Port_str = 0
staticprotected

Our port, as a string.

Definition at line 403 of file XrdHttpProtocol.hh.

Referenced by Configure(), and Process().

◆ ProtLink

XrdObject<XrdHttpProtocol> XrdHttpProtocol::ProtLink

Definition at line 128 of file XrdHttpProtocol.hh.

Referenced by Recycle().

◆ ProtStack

XrdObjectQ< XrdHttpProtocol > XrdHttpProtocol::ProtStack
static

Definition at line 127 of file XrdHttpProtocol.hh.

Referenced by Configure(), Match(), and Recycle().

◆ ReadRangeConfig

XrdHttpReadRangeHandler::Configuration XrdHttpProtocol::ReadRangeConfig
static

configuration for the read range handler

Definition at line 138 of file XrdHttpProtocol.hh.

◆ readWait

int XrdHttpProtocol::readWait = 300000
staticprotected

Timeout for reading data.

Definition at line 397 of file XrdHttpProtocol.hh.

◆ Sched

XrdScheduler * XrdHttpProtocol::Sched = 0
staticprotected

Definition at line 365 of file XrdHttpProtocol.hh.

Referenced by Configure().

◆ SecEntity

XrdSecEntity XrdHttpProtocol::SecEntity

Authentication area.

Definition at line 132 of file XrdHttpProtocol.hh.

Referenced by XrdHttpExtReq::XrdHttpExtReq(), XrdHttpExtReq::GetSecEntity(), Match(), Process(), and XrdHttpReq::Redir().

◆ secretkey

char * XrdHttpProtocol::secretkey = 0
staticprotected

The key used to calculate the url hashes.

Definition at line 417 of file XrdHttpProtocol.hh.

Referenced by Process(), and XrdHttpReq::Redir().

◆ selfhttps2http

bool XrdHttpProtocol::selfhttps2http = false
staticprotected

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

Definition at line 432 of file XrdHttpProtocol.hh.

Referenced by Process().

◆ servGMap

XrdOucGMap * XrdHttpProtocol::servGMap = 0
staticprotected

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

Definition at line 378 of file XrdHttpProtocol.hh.

◆ sslcadir

char * XrdHttpProtocol::sslcadir = 0
staticprotected

Definition at line 406 of file XrdHttpProtocol.hh.

Referenced by Process().

◆ sslcafile

char * XrdHttpProtocol::sslcafile = 0
staticprotected

Definition at line 406 of file XrdHttpProtocol.hh.

◆ sslcert

char * XrdHttpProtocol::sslcert = 0
staticprotected

OpenSSL stuff.

Definition at line 406 of file XrdHttpProtocol.hh.

◆ sslcipherfilter

char * XrdHttpProtocol::sslcipherfilter = 0
staticprotected

Definition at line 406 of file XrdHttpProtocol.hh.

◆ sslkey

char * XrdHttpProtocol::sslkey = 0
staticprotected

Definition at line 406 of file XrdHttpProtocol.hh.

◆ sslverifydepth

int XrdHttpProtocol::sslverifydepth = 9
staticprotected

Depth of verification of a certificate chain.

Definition at line 420 of file XrdHttpProtocol.hh.

◆ staticpreload

XrdOucHash< XrdHttpProtocol::StaticPreloadInfo > * XrdHttpProtocol::staticpreload = 0
staticprotected

Definition at line 445 of file XrdHttpProtocol.hh.

Referenced by XrdHttpReq::ProcessHTTPReq().

◆ staticredir

char * XrdHttpProtocol::staticredir = 0
staticprotected

Definition at line 438 of file XrdHttpProtocol.hh.

Referenced by XrdHttpReq::ProcessHTTPReq().

◆ tpcForwardCreds

bool XrdHttpProtocol::tpcForwardCreds = false
staticprotected

If set to true, the HTTP TPC transfers will forward the credentials to redirected hosts.

Definition at line 466 of file XrdHttpProtocol.hh.

Referenced by XrdHttpExtReq::XrdHttpExtReq().

◆ xrd_cslist

char * XrdHttpProtocol::xrd_cslist = nullptr
staticprotected

The list of checksums that were configured via the xrd.cksum parameter on the server config file.

Definition at line 460 of file XrdHttpProtocol.hh.

Referenced by Configure().


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