XRootD
XrdHttpExtReq Class Reference

#include <XrdHttpExtHandler.hh>

+ Collaboration diagram for XrdHttpExtReq:

Public Member Functions

 XrdHttpExtReq (XrdHttpReq *req, XrdHttpProtocol *pr)
 
int BuffgetData (int blen, char **data, bool wait)
 Get a pointer to data read from the client, valid for up to blen bytes from the buffer. Returns the validity. More...
 
int ChunkResp (const char *body, long long bodylen)
 Send a (potentially partial) body in a chunked response; invoking with NULL body. More...
 
void GetClientID (std::string &clid)
 
const XrdSecEntityGetSecEntity () const
 
int SendData (const char *body, int bodylen)
 
int SendSimpleResp (int code, const char *desc, const char *header_to_add, const char *body, long long bodylen)
 Sends a basic response. If the length is < 0 then it is calculated internally. More...
 
int StartChunkedResp (int code, const char *desc, const char *header_to_add)
 Starts a chunked response; body of request is sent over multiple parts using the SendChunkResp. More...
 
int StartSimpleResp (int code, const char *desc, const char *header_to_add, long long bodylen, bool keepalive)
 

Public Attributes

std::string clientdn
 
std::string clientgroups
 
std::string clienthost
 
std::map< std::string, std::string > & headers
 
long long length
 
std::map< std::string, std::string > mReprDigest
 Repr-Digest map where the key is the digest name and the value is the base64 encoded digest value. More...
 
int mSciTag
 
std::map< std::string, uint8_t > mWantReprDigest
 Want-Repr-Digest map where the key is the digest name and the value is the weighted preference. More...
 
XrdNetPMarkpmark
 
std::string resource
 
bool tpcForwardCreds = false
 
std::string verb
 

Detailed Description

Definition at line 48 of file XrdHttpExtHandler.hh.

Constructor & Destructor Documentation

◆ XrdHttpExtReq()

XrdHttpExtReq::XrdHttpExtReq ( XrdHttpReq req,
XrdHttpProtocol pr 
)

Definition at line 86 of file XrdHttpExtHandler.cc.

86  : prot(pr),
87 verb(req->requestverb), headers(req->allheaders) {
88  // Here we fill the request summary with all the fields we can
89  resource = req->resource.c_str();
90  int envlen = 0;
91 
92  const char *p = nullptr;
93  if (req->opaque)
94  p = req->opaque->Env(envlen);
95  headers["xrd-http-query"] = p ? p:"";
96  p = req->resourceplusopaque.c_str();
97  headers["xrd-http-fullresource"] = p ? p:"";
98  headers["xrd-http-prot"] = prot->isHTTPS()?"https":"http";
99 
100  // These fields usually identify the client that connected
101 
102 
103  if (prot->SecEntity.moninfo) {
104  clientdn = prot->SecEntity.moninfo;
105  trim(clientdn);
106  }
107  if (prot->SecEntity.host) {
108  clienthost = prot->SecEntity.host;
109  trim(clienthost);
110  }
111  if (prot->SecEntity.vorg) {
112  clientgroups = prot->SecEntity.vorg;
114  }
115 
116  // Get the packet marking handle and the client scitag from the XrdHttp layer
117  pmark = prot->pmarkHandle;
118  mSciTag = req->mScitag;
119  mReprDigest = req->m_repr_digest;
122 
123  length = req->length;
124 }
void trim(std::string &str)
Definition: XrdHttpReq.cc:78
std::string clientdn
std::string clienthost
std::map< std::string, std::string > & headers
std::string clientgroups
std::string resource
std::string verb
std::map< std::string, std::string > mReprDigest
Repr-Digest map where the key is the digest name and the value is the base64 encoded digest value.
XrdNetPMark * pmark
std::map< std::string, uint8_t > mWantReprDigest
Want-Repr-Digest map where the key is the digest name and the value is the weighted preference.
static XrdNetPMark * pmarkHandle
Packet marking handler pointer (assigned from the environment during the Config() call)
bool isHTTPS()
called via https
static bool tpcForwardCreds
If set to true, the HTTP TPC transfers will forward the credentials to redirected hosts.
XrdSecEntity SecEntity
Authentication area.
long long length
Definition: XrdHttpReq.hh:295
XrdOucString resource
The resource specified by the request, stripped of opaque data.
Definition: XrdHttpReq.hh:276
std::map< std::string, uint8_t > m_want_repr_digest
Definition: XrdHttpReq.hh:375
std::map< std::string, std::string > m_repr_digest
Repr-Digest map where the key is the digest name and the value is the base64 encoded digest value.
Definition: XrdHttpReq.hh:371
std::string requestverb
Definition: XrdHttpReq.hh:269
XrdOucEnv * opaque
The opaque data, after parsing.
Definition: XrdHttpReq.hh:278
XrdOucString resourceplusopaque
The resource specified by the request, including all the opaque data.
Definition: XrdHttpReq.hh:280
std::map< std::string, std::string > allheaders
Definition: XrdHttpReq.hh:273
char * Env(int &envlen)
Definition: XrdOucEnv.hh:48
const char * c_str() const
char * vorg
Entity's virtual organization(s)
Definition: XrdSecEntity.hh:71
char * moninfo
Information for monitoring.
Definition: XrdSecEntity.hh:76
char * host
Entity's host name dnr dependent.
Definition: XrdSecEntity.hh:70

References XrdOucString::c_str(), clientdn, clientgroups, clienthost, XrdOucEnv::Env(), headers, XrdSecEntity::host, XrdHttpProtocol::isHTTPS(), length, XrdHttpReq::length, XrdHttpReq::m_repr_digest, XrdHttpReq::m_want_repr_digest, XrdSecEntity::moninfo, mReprDigest, mSciTag, XrdHttpReq::mScitag, mWantReprDigest, XrdHttpReq::opaque, pmark, XrdHttpProtocol::pmarkHandle, resource, XrdHttpReq::resource, XrdHttpReq::resourceplusopaque, XrdHttpProtocol::SecEntity, tpcForwardCreds, XrdHttpProtocol::tpcForwardCreds, trim(), and XrdSecEntity::vorg.

+ Here is the call graph for this function:

Member Function Documentation

◆ BuffgetData()

int XrdHttpExtReq::BuffgetData ( int  blen,
char **  data,
bool  wait 
)

Get a pointer to data read from the client, valid for up to blen bytes from the buffer. Returns the validity.

Definition at line 65 of file XrdHttpExtHandler.cc.

65  {
66 
67  if (!prot) return -1;
68  int nb = prot->BuffgetData(blen, data, wait);
69 
70  return nb;
71 }

Referenced by Macaroons::Handler::ProcessReq().

+ Here is the caller graph for this function:

◆ ChunkResp()

int XrdHttpExtReq::ChunkResp ( const char *  body,
long long  bodylen 
)

Send a (potentially partial) body in a chunked response; invoking with NULL body.

Definition at line 58 of file XrdHttpExtHandler.cc.

59 {
60  if (!prot) return -1;
61 
62  return prot->ChunkResp(body, bodylen);
63 }

◆ GetClientID()

void XrdHttpExtReq::GetClientID ( std::string &  clid)

Definition at line 73 of file XrdHttpExtHandler.cc.

74 {
75  char buff[512];
76  prot->Link->Client(buff, sizeof(buff));
77  clid = buff;
78 }
XrdLink * Link
The link we are bound to.

References XrdLink::Client(), and XrdHttpProtocol::Link.

+ Here is the call graph for this function:

◆ GetSecEntity()

const XrdSecEntity & XrdHttpExtReq::GetSecEntity ( ) const

Definition at line 80 of file XrdHttpExtHandler.cc.

81 {
82  return prot->SecEntity;
83 }

References XrdHttpProtocol::SecEntity.

◆ SendData()

int XrdHttpExtReq::SendData ( const char *  body,
int  bodylen 
)

Definition at line 44 of file XrdHttpExtHandler.cc.

45 {
46  if (!prot) return -1;
47 
48  return prot->SendData(body, bodylen);
49 }

◆ SendSimpleResp()

int XrdHttpExtReq::SendSimpleResp ( int  code,
const char *  desc,
const char *  header_to_add,
const char *  body,
long long  bodylen 
)

Sends a basic response. If the length is < 0 then it is calculated internally.

Definition at line 30 of file XrdHttpExtHandler.cc.

31 {
32  if (!prot) return -1;
33 
34  return prot->SendSimpleResp(code, desc, header_to_add, body, bodylen, true);
35 }

Referenced by TPC::TPCHandler::ProcessReq(), and Macaroons::Handler::ProcessReq().

+ Here is the caller graph for this function:

◆ StartChunkedResp()

int XrdHttpExtReq::StartChunkedResp ( int  code,
const char *  desc,
const char *  header_to_add 
)

Starts a chunked response; body of request is sent over multiple parts using the SendChunkResp.

Definition at line 51 of file XrdHttpExtHandler.cc.

52 {
53  if (!prot) return -1;
54 
55  return prot->StartChunkedResp(code, desc, header_to_add, -1, true);
56 }

◆ StartSimpleResp()

int XrdHttpExtReq::StartSimpleResp ( int  code,
const char *  desc,
const char *  header_to_add,
long long  bodylen,
bool  keepalive 
)

Definition at line 37 of file XrdHttpExtHandler.cc.

38 {
39  if (!prot) return -1;
40 
41  return prot->StartSimpleResp(code, desc, header_to_add, bodylen, true);
42 }

Member Data Documentation

◆ clientdn

std::string XrdHttpExtReq::clientdn

Definition at line 58 of file XrdHttpExtHandler.hh.

Referenced by XrdHttpExtReq().

◆ clientgroups

std::string XrdHttpExtReq::clientgroups

Definition at line 58 of file XrdHttpExtHandler.hh.

Referenced by XrdHttpExtReq().

◆ clienthost

std::string XrdHttpExtReq::clienthost

Definition at line 58 of file XrdHttpExtHandler.hh.

Referenced by XrdHttpExtReq().

◆ headers

std::map<std::string, std::string>& XrdHttpExtReq::headers

◆ length

long long XrdHttpExtReq::length

Definition at line 59 of file XrdHttpExtHandler.hh.

Referenced by XrdHttpExtReq().

◆ mReprDigest

std::map<std::string,std::string> XrdHttpExtReq::mReprDigest

Repr-Digest map where the key is the digest name and the value is the base64 encoded digest value.

Definition at line 68 of file XrdHttpExtHandler.hh.

Referenced by XrdHttpExtReq(), TPC::State::SetupHeaders(), and TPC::State::SetupHeadersForHEAD().

◆ mSciTag

int XrdHttpExtReq::mSciTag

◆ mWantReprDigest

std::map<std::string, uint8_t> XrdHttpExtReq::mWantReprDigest

Want-Repr-Digest map where the key is the digest name and the value is the weighted preference.

Definition at line 70 of file XrdHttpExtHandler.hh.

Referenced by XrdHttpExtReq().

◆ pmark

XrdNetPMark* XrdHttpExtReq::pmark

Definition at line 61 of file XrdHttpExtHandler.hh.

Referenced by XrdHttpExtReq().

◆ resource

std::string XrdHttpExtReq::resource

◆ tpcForwardCreds

bool XrdHttpExtReq::tpcForwardCreds = false

Definition at line 63 of file XrdHttpExtHandler.hh.

Referenced by XrdHttpExtReq().

◆ verb

std::string XrdHttpExtReq::verb

Definition at line 55 of file XrdHttpExtHandler.hh.

Referenced by TPC::TPCHandler::ProcessReq().


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