XRootD
XrdHttpProtocol.cc File Reference
#include "XrdVersion.hh"
#include "Xrd/XrdBuffer.hh"
#include "Xrd/XrdLink.hh"
#include "XProtocol/XProtocol.hh"
#include "XrdOuc/XrdOucStream.hh"
#include "XrdOuc/XrdOucEnv.hh"
#include "XrdOuc/XrdOucGMap.hh"
#include "XrdSys/XrdSysE2T.hh"
#include "XrdSys/XrdSysTimer.hh"
#include "XrdOuc/XrdOucPinLoader.hh"
#include "XrdHttpTrace.hh"
#include "XrdHttpProtocol.hh"
#include <sys/stat.h>
#include "XrdHttpUtils.hh"
#include "XrdHttpSecXtractor.hh"
#include "XrdHttpExtHandler.hh"
#include "XrdTls/XrdTls.hh"
#include "XrdTls/XrdTlsContext.hh"
#include "XrdOuc/XrdOucUtils.hh"
#include "XrdOuc/XrdOucPrivateUtils.hh"
#include <openssl/err.h>
#include <openssl/ssl.h>
#include <vector>
#include <arpa/inet.h>
#include <sstream>
#include <cctype>
#include <fcntl.h>
#include <algorithm>
+ Include dependency graph for XrdHttpProtocol.cc:

Go to the source code of this file.

Namespaces

 XrdHttpProtoInfo
 

Macros

#define HTTPS_ALERT(x, y, z)
 
#define TRACELINK   lp
 
#define TRACELINK   Link
 
#define TRACELINK   Link
 
#define TS_Xeq(x, m)   (!strcmp(x,var)) GoNo = m(Config)
 
#define TS_Xeq3(x, m)   (!strcmp(x,var)) GoNo = m(Config, extHIVec)
 
#define XRHTTP_TK_GRACETIME   600
 

Functions

void * BIO_get_data (BIO *bio)
 
int BIO_get_flags (BIO *bio)
 
int BIO_get_init (BIO *bio)
 
int BIO_get_shutdown (BIO *bio)
 
void BIO_set_data (BIO *bio, void *ptr)
 
void BIO_set_flags (BIO *bio, int flags)
 
void BIO_set_init (BIO *bio, int init)
 
void BIO_set_shutdown (BIO *bio, int shut)
 
static int BIO_XrdLink_create (BIO *bio)
 
static long BIO_XrdLink_ctrl (BIO *bio, int cmd, long num, void *ptr)
 
static int BIO_XrdLink_destroy (BIO *bio)
 
static int BIO_XrdLink_read (BIO *bio, char *data, size_t datal, size_t *read)
 
int BIO_XrdLink_write (BIO *bio, const char *data, size_t datal, size_t *written)
 
static XrdVERSIONINFODEF (compiledVer, XrdHttpProtocolTest, XrdVNUMBER, XrdVERSION)
 

Variables

static const int XrdHttpProtoInfo::hsmAuto = -1
 
static const int XrdHttpProtoInfo::hsmMan = 1
 
static const int XrdHttpProtoInfo::hsmOff = 0
 
static const int XrdHttpProtoInfo::hsmOn = 1
 
int XrdHttpProtoInfo::httpsmode = hsmAuto
 
bool XrdHttpProtoInfo::httpsspec = false
 
int XrdHttpProtoInfo::tlsCache = XrdTlsContext::scOff
 
XrdTlsContextXrdHttpProtoInfo::xrdctx = 0
 
bool XrdHttpProtoInfo::xrdctxVer = false
 
const char * XrdHttpSecEntityTident = "http"
 
XrdSysTrace XrdHttpTrace ("http")
 

Macro Definition Documentation

◆ HTTPS_ALERT

#define HTTPS_ALERT (   x,
  y,
 
)
Value:
httpsspec = true;\
if (xrdctx && httpsmode == hsmAuto && (z || xrdctx->x509Verify())) \
eDest.Say("Config http." x " overrides the xrd." y " directive.")
static const int hsmAuto
XrdTlsContext * xrdctx

Definition at line 976 of file XrdHttpProtocol.cc.

◆ TRACELINK [1/3]

#define TRACELINK   lp

Definition at line 918 of file XrdHttpProtocol.cc.

◆ TRACELINK [2/3]

#define TRACELINK   Link

Definition at line 918 of file XrdHttpProtocol.cc.

◆ TRACELINK [3/3]

#define TRACELINK   Link

Definition at line 918 of file XrdHttpProtocol.cc.

◆ TS_Xeq

#define TS_Xeq (   x,
 
)    (!strcmp(x,var)) GoNo = m(Config)

Definition at line 972 of file XrdHttpProtocol.cc.

◆ TS_Xeq3

#define TS_Xeq3 (   x,
 
)    (!strcmp(x,var)) GoNo = m(Config, extHIVec)

Definition at line 974 of file XrdHttpProtocol.cc.

◆ XRHTTP_TK_GRACETIME

#define XRHTTP_TK_GRACETIME   600

Definition at line 58 of file XrdHttpProtocol.cc.

Function Documentation

◆ BIO_get_data()

void* BIO_get_data ( BIO *  bio)

Definition at line 157 of file XrdHttpProtocol.cc.

157  {
158  return bio->ptr;
159 }

Referenced by BIO_XrdLink_destroy(), BIO_XrdLink_read(), and BIO_XrdLink_write().

+ Here is the caller graph for this function:

◆ BIO_get_flags()

int BIO_get_flags ( BIO *  bio)

Definition at line 164 of file XrdHttpProtocol.cc.

164  {
165  return bio->flags;
166 }

◆ BIO_get_init()

int BIO_get_init ( BIO *  bio)

Definition at line 171 of file XrdHttpProtocol.cc.

171  {
172  return bio->init;
173 }

◆ BIO_get_shutdown()

int BIO_get_shutdown ( BIO *  bio)

Definition at line 180 of file XrdHttpProtocol.cc.

180  {
181  return bio->shutdown;
182 }

Referenced by BIO_XrdLink_ctrl(), and BIO_XrdLink_destroy().

+ Here is the caller graph for this function:

◆ BIO_set_data()

void BIO_set_data ( BIO *  bio,
void *  ptr 
)

Definition at line 160 of file XrdHttpProtocol.cc.

160  {
161  bio->ptr = ptr;
162 }

Referenced by BIO_XrdLink_create().

+ Here is the caller graph for this function:

◆ BIO_set_flags()

void BIO_set_flags ( BIO *  bio,
int  flags 
)

Definition at line 168 of file XrdHttpProtocol.cc.

168  {
169  bio->flags = flags;
170 }

Referenced by BIO_XrdLink_create(), BIO_XrdLink_destroy(), and Tobase64().

+ Here is the caller graph for this function:

◆ BIO_set_init()

void BIO_set_init ( BIO *  bio,
int  init 
)

Definition at line 174 of file XrdHttpProtocol.cc.

174  {
175  bio->init = init;
176 }

Referenced by BIO_XrdLink_create(), and BIO_XrdLink_destroy().

+ Here is the caller graph for this function:

◆ BIO_set_shutdown()

void BIO_set_shutdown ( BIO *  bio,
int  shut 
)

Definition at line 177 of file XrdHttpProtocol.cc.

177  {
178  bio->shutdown = shut;
179 }

Referenced by BIO_XrdLink_ctrl().

+ Here is the caller graph for this function:

◆ BIO_XrdLink_create()

static int BIO_XrdLink_create ( BIO *  bio)
static

Definition at line 404 of file XrdHttpProtocol.cc.

405 {
406 
407 
408  BIO_set_init(bio, 0);
409  //BIO_set_next(bio, 0);
410  BIO_set_data(bio, NULL);
411  BIO_set_flags(bio, 0);
412 
413 #if OPENSSL_VERSION_NUMBER < 0x10100000L
414 
415  bio->num = 0;
416 
417 #endif
418 
419  return 1;
420 }
void BIO_set_init(BIO *bio, int init)
void BIO_set_data(BIO *bio, void *ptr)
void BIO_set_flags(BIO *bio, int flags)

References BIO_set_data(), BIO_set_flags(), and BIO_set_init().

+ Here is the call graph for this function:

◆ BIO_XrdLink_ctrl()

static long BIO_XrdLink_ctrl ( BIO *  bio,
int  cmd,
long  num,
void *  ptr 
)
static

Definition at line 437 of file XrdHttpProtocol.cc.

438 {
439  long ret = 1;
440  switch (cmd) {
441  case BIO_CTRL_GET_CLOSE:
442  ret = BIO_get_shutdown(bio);
443  break;
444  case BIO_CTRL_SET_CLOSE:
445  BIO_set_shutdown(bio, (int)num);
446  break;
447  case BIO_CTRL_DUP:
448  case BIO_CTRL_FLUSH:
449  ret = 1;
450  break;
451  default:
452  ret = 0;
453  break;
454  }
455  return ret;
456 }
int BIO_get_shutdown(BIO *bio)
void BIO_set_shutdown(BIO *bio, int shut)

References BIO_get_shutdown(), and BIO_set_shutdown().

+ Here is the call graph for this function:

◆ BIO_XrdLink_destroy()

static int BIO_XrdLink_destroy ( BIO *  bio)
static

Definition at line 423 of file XrdHttpProtocol.cc.

424 {
425  if (bio == NULL) return 0;
426  if (BIO_get_shutdown(bio)) {
427  if (BIO_get_data(bio)) {
428  static_cast<XrdLink*>(BIO_get_data(bio))->Close();
429  }
430  BIO_set_init(bio, 0);
431  BIO_set_flags(bio, 0);
432  }
433  return 1;
434 }
void * BIO_get_data(BIO *bio)
CloseImpl< false > Close(Ctx< File > file, uint16_t timeout=0)
Factory for creating CloseImpl objects.

References BIO_get_data(), BIO_get_shutdown(), BIO_set_flags(), BIO_set_init(), and XrdCl::Close().

+ Here is the call graph for this function:

◆ BIO_XrdLink_read()

static int BIO_XrdLink_read ( BIO *  bio,
char *  data,
size_t  datal,
size_t *  read 
)
static

Definition at line 363 of file XrdHttpProtocol.cc.

364 {
365  if (!data || !bio) {
366  *read = 0;
367  return 0;
368  }
369 
370  errno = 0;
371 
372  XrdLink *lp = static_cast<XrdLink *>(BIO_get_data(bio));
373  int ret = lp->Recv(data, datal);
374  BIO_clear_retry_flags(bio);
375  if (ret <= 0) {
376  *read = 0;
377  if ((errno == EINTR) || (errno == EINPROGRESS) || (errno == EAGAIN) || (errno == EWOULDBLOCK))
378  BIO_set_retry_read(bio);
379  return ret;
380  }
381  *read = ret;
382 }
ssize_t read(int fildes, void *buf, size_t nbyte)

References BIO_get_data(), read(), and XrdLink::Recv().

+ Here is the call graph for this function:

◆ BIO_XrdLink_write()

int BIO_XrdLink_write ( BIO *  bio,
const char *  data,
size_t  datal,
size_t *  written 
)

Definition at line 320 of file XrdHttpProtocol.cc.

321 {
322  if (!data || !bio) {
323  *written = 0;
324  return 0;
325  }
326 
327  XrdLink *lp=static_cast<XrdLink *>(BIO_get_data(bio));
328 
329  errno = 0;
330  int ret = lp->Send(data, datal);
331  BIO_clear_retry_flags(bio);
332  if (ret <= 0) {
333  *written = 0;
334  if ((errno == EINTR) || (errno == EINPROGRESS) || (errno == EAGAIN) || (errno == EWOULDBLOCK))
335  BIO_set_retry_write(bio);
336  return ret;
337  }
338  *written = ret;
339  return 1;
340 }

References BIO_get_data(), and XrdLink::Send().

+ Here is the call graph for this function:

◆ XrdVERSIONINFODEF()

static XrdVERSIONINFODEF ( compiledVer  ,
XrdHttpProtocolTest  ,
XrdVNUMBER  ,
XrdVERSION   
)
static

Variable Documentation

◆ XrdHttpSecEntityTident

const char* XrdHttpSecEntityTident = "http"

Definition at line 66 of file XrdHttpProtocol.cc.

◆ XrdHttpTrace

XrdSysTrace XrdHttpTrace("http") ( "http"  )