XRootD
Loading...
Searching...
No Matches
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.
int ChunkResp (const char *body, long long bodylen)
 Send a (potentially partial) body in a chunked response; invoking with NULL body.
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.
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.
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.
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.
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),
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;
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;
121 tpcForwardCreds = prot->tpcForwardCreds;
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::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.
long long length
XrdOucString resource
The resource specified by the request, stripped of opaque data.
std::map< std::string, uint8_t > m_want_repr_digest
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.
std::string requestverb
XrdOucEnv * opaque
The opaque data, after parsing.
XrdOucString resourceplusopaque
The resource specified by the request, including all the opaque data.
std::map< std::string, std::string > allheaders
char * Env(int &envlen)
Definition XrdOucEnv.hh:48
const char * c_str() const

References XrdOucString::c_str(), XrdOucEnv::Env(), headers, if(), length, XrdHttpReq::length, XrdHttpReq::m_repr_digest, XrdHttpReq::m_want_repr_digest, mReprDigest, mSciTag, XrdHttpReq::mScitag, mWantReprDigest, XrdHttpReq::opaque, pmark, resource, XrdHttpReq::resource, XrdHttpReq::resourceplusopaque, tpcForwardCreds, and verb.

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}

◆ GetSecEntity()

const XrdSecEntity & XrdHttpExtReq::GetSecEntity ( ) const

Definition at line 80 of file XrdHttpExtHandler.cc.

81{
82 return prot->SecEntity;
83}

◆ 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 Macaroons::Handler::ProcessReq(), and TPC::TPCHandler::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.

◆ clientgroups

std::string XrdHttpExtReq::clientgroups

Definition at line 58 of file XrdHttpExtHandler.hh.

◆ clienthost

std::string XrdHttpExtReq::clienthost

Definition at line 58 of file XrdHttpExtHandler.hh.

◆ 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

Definition at line 65 of file XrdHttpExtHandler.hh.

Referenced by XrdHttpExtReq().

◆ 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

Definition at line 55 of file XrdHttpExtHandler.hh.

Referenced by XrdHttpExtReq(), and Macaroons::Handler::ProcessReq().

◆ 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 XrdHttpExtReq(), and TPC::TPCHandler::ProcessReq().


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