XRootD
XrdHttpProtocol.cc File Reference
#include "XrdVersion.hh"
#include "Xrd/XrdBuffer.hh"
#include "Xrd/XrdLink.hh"
#include "XProtocol/XProtocol.hh"
#include "XrdOuc/XrdOuca2x.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 "XrdHttpCors/XrdHttpCors.hh"
#include <charconv>
#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
 
bool XrdHttpProtoInfo::tlsClientAuth = true
 
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 990 of file XrdHttpProtocol.cc.

◆ TRACELINK [1/3]

#define TRACELINK   lp

Definition at line 932 of file XrdHttpProtocol.cc.

◆ TRACELINK [2/3]

#define TRACELINK   Link

Definition at line 932 of file XrdHttpProtocol.cc.

◆ TRACELINK [3/3]

#define TRACELINK   Link

Definition at line 932 of file XrdHttpProtocol.cc.

◆ TS_Xeq

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

Definition at line 986 of file XrdHttpProtocol.cc.

◆ TS_Xeq3

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

Definition at line 988 of file XrdHttpProtocol.cc.

◆ XRHTTP_TK_GRACETIME

#define XRHTTP_TK_GRACETIME   600

Definition at line 61 of file XrdHttpProtocol.cc.

Function Documentation

◆ BIO_get_data()

void* BIO_get_data ( BIO *  bio)

Definition at line 169 of file XrdHttpProtocol.cc.

169  {
170  return bio->ptr;
171 }

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 176 of file XrdHttpProtocol.cc.

176  {
177  return bio->flags;
178 }

◆ BIO_get_init()

int BIO_get_init ( BIO *  bio)

Definition at line 183 of file XrdHttpProtocol.cc.

183  {
184  return bio->init;
185 }

◆ BIO_get_shutdown()

int BIO_get_shutdown ( BIO *  bio)

Definition at line 192 of file XrdHttpProtocol.cc.

192  {
193  return bio->shutdown;
194 }

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 172 of file XrdHttpProtocol.cc.

172  {
173  bio->ptr = ptr;
174 }

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 180 of file XrdHttpProtocol.cc.

180  {
181  bio->flags = flags;
182 }

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 186 of file XrdHttpProtocol.cc.

186  {
187  bio->init = init;
188 }

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 189 of file XrdHttpProtocol.cc.

189  {
190  bio->shutdown = shut;
191 }

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 416 of file XrdHttpProtocol.cc.

417 {
418 
419 
420  BIO_set_init(bio, 0);
421  //BIO_set_next(bio, 0);
422  BIO_set_data(bio, NULL);
423  BIO_set_flags(bio, 0);
424 
425 #if OPENSSL_VERSION_NUMBER < 0x10100000L
426 
427  bio->num = 0;
428 
429 #endif
430 
431  return 1;
432 }
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 449 of file XrdHttpProtocol.cc.

450 {
451  long ret = 1;
452  switch (cmd) {
453  case BIO_CTRL_GET_CLOSE:
454  ret = BIO_get_shutdown(bio);
455  break;
456  case BIO_CTRL_SET_CLOSE:
457  BIO_set_shutdown(bio, (int)num);
458  break;
459  case BIO_CTRL_DUP:
460  case BIO_CTRL_FLUSH:
461  ret = 1;
462  break;
463  default:
464  ret = 0;
465  break;
466  }
467  return ret;
468 }
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 435 of file XrdHttpProtocol.cc.

436 {
437  if (bio == NULL) return 0;
438  if (BIO_get_shutdown(bio)) {
439  if (BIO_get_data(bio)) {
440  static_cast<XrdLink*>(BIO_get_data(bio))->Close();
441  }
442  BIO_set_init(bio, 0);
443  BIO_set_flags(bio, 0);
444  }
445  return 1;
446 }
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 375 of file XrdHttpProtocol.cc.

376 {
377  if (!data || !bio) {
378  *read = 0;
379  return 0;
380  }
381 
382  errno = 0;
383 
384  XrdLink *lp = static_cast<XrdLink *>(BIO_get_data(bio));
385  int ret = lp->Recv(data, datal);
386  BIO_clear_retry_flags(bio);
387  if (ret <= 0) {
388  *read = 0;
389  if ((errno == EINTR) || (errno == EINPROGRESS) || (errno == EAGAIN) || (errno == EWOULDBLOCK))
390  BIO_set_retry_read(bio);
391  return ret;
392  }
393  *read = ret;
394 }
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 332 of file XrdHttpProtocol.cc.

333 {
334  if (!data || !bio) {
335  *written = 0;
336  return 0;
337  }
338 
339  XrdLink *lp=static_cast<XrdLink *>(BIO_get_data(bio));
340 
341  errno = 0;
342  int ret = lp->Send(data, datal);
343  BIO_clear_retry_flags(bio);
344  if (ret <= 0) {
345  *written = 0;
346  if ((errno == EINTR) || (errno == EINPROGRESS) || (errno == EAGAIN) || (errno == EWOULDBLOCK))
347  BIO_set_retry_write(bio);
348  return ret;
349  }
350  *written = ret;
351  return 1;
352 }

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 69 of file XrdHttpProtocol.cc.

◆ XrdHttpTrace

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