XRootD
Loading...
Searching...
No Matches
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

namespace  XrdHttpProtoInfo

Macros

#define HTTPS_ALERT(x, y, z)
#define TRACELINK   Link
#define TRACELINK   Link
#define TRACELINK   lp
#define TS_Xeq(x, m)
#define TS_Xeq3(x, m)
#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,
z )
Value:
httpsspec = true;\
if (xrdctx && httpsmode == hsmAuto && (z || xrdctx->x509Verify())) \
eDest.Say("Config http." x " overrides the xrd." y " directive.")
static XrdSysError eDest(0,"crypto_")
static const int hsmAuto
XrdTlsContext * xrdctx

Definition at line 988 of file XrdHttpProtocol.cc.

988#define HTTPS_ALERT(x,y,z) httpsspec = true;\
989 if (xrdctx && httpsmode == hsmAuto && (z || xrdctx->x509Verify())) \
990 eDest.Say("Config http." x " overrides the xrd." y " directive.")

◆ TRACELINK [1/3]

#define TRACELINK   Link

Definition at line 227 of file XrdHttpProtocol.cc.

◆ TRACELINK [2/3]

#define TRACELINK   Link

Definition at line 227 of file XrdHttpProtocol.cc.

◆ TRACELINK [3/3]

#define TRACELINK   lp

Definition at line 227 of file XrdHttpProtocol.cc.

◆ TS_Xeq

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

Definition at line 984 of file XrdHttpProtocol.cc.

◆ TS_Xeq3

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

Definition at line 986 of file XrdHttpProtocol.cc.

◆ XRHTTP_TK_GRACETIME

#define XRHTTP_TK_GRACETIME   600

Definition at line 61 of file XrdHttpProtocol.cc.

Referenced by XrdHttpProtocol::Process().

Function Documentation

◆ BIO_get_data()

void * BIO_get_data ( BIO * bio)

Definition at line 168 of file XrdHttpProtocol.cc.

168 {
169 return bio->ptr;
170}

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

175 {
176 return bio->flags;
177}

◆ BIO_get_init()

int BIO_get_init ( BIO * bio)

Definition at line 182 of file XrdHttpProtocol.cc.

182 {
183 return bio->init;
184}

◆ BIO_get_shutdown()

int BIO_get_shutdown ( BIO * bio)

Definition at line 191 of file XrdHttpProtocol.cc.

191 {
192 return bio->shutdown;
193}

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

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

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

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

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

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

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

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

Referenced by BIO_XrdLink_ctrl().

Here is the caller graph for this function:

◆ BIO_XrdLink_create()

int BIO_XrdLink_create ( BIO * bio)
static

Definition at line 415 of file XrdHttpProtocol.cc.

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

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

Definition at line 448 of file XrdHttpProtocol.cc.

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

int BIO_XrdLink_destroy ( BIO * bio)
static

Definition at line 434 of file XrdHttpProtocol.cc.

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

Here is the call graph for this function:

◆ BIO_XrdLink_read()

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

Definition at line 374 of file XrdHttpProtocol.cc.

375{
376 if (!data || !bio) {
377 *read = 0;
378 return 0;
379 }
380
381 errno = 0;
382
383 XrdLink *lp = static_cast<XrdLink *>(BIO_get_data(bio));
384 int ret = lp->Recv(data, datal);
385 BIO_clear_retry_flags(bio);
386 if (ret <= 0) {
387 *read = 0;
388 if ((errno == EINTR) || (errno == EINPROGRESS) || (errno == EAGAIN) || (errno == EWOULDBLOCK))
389 BIO_set_retry_read(bio);
390 return ret;
391 }
392 *read = ret;
393}
#define read(a, b, c)
Definition XrdPosix.hh:82

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

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

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

Here is the call graph for this function:

◆ XrdVERSIONINFODEF()

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" )