XrdHttpReq Class Reference

#include <XrdHttpReq.hh>

Inheritance diagram for XrdHttpReq:
Inheritance graph
[legend]
Collaboration diagram for XrdHttpReq:
Collaboration graph
[legend]

List of all members.

Public Types

enum  ReqType {
  rtUnset = -1, rtUnknown = 0, rtMalformed, rtGET,
  rtHEAD, rtPUT, rtOPTIONS, rtPATCH,
  rtDELETE, rtPROPFIND, rtMKCOL, rtMOVE,
  rtPOST
}
 

These are the HTTP/DAV requests that we support.

More...

Public Member Functions

 XrdHttpReq (XrdHttpProtocol *protinstance)
virtual ~XrdHttpReq ()
virtual void reset ()
int parseLine (char *line, int len)
 Parse the header.
int parseFirstLine (char *line, int len)
 Parse the first line of the header.
int parseBody (char *body, long long len)
 Parse the body of a request, assuming that it's XML and that it's entirely in memory.
int ReqReadV ()
 Prepare the buffers for sending a readv request.
std::string buildPartialHdr (long long bytestart, long long byteend, long long filesize, char *token)
 Build a partial header for a multipart response.
std::string buildPartialHdrEnd (char *token)
 Build the closing part for a multipart response.
void appendOpaque (XrdOucString &s, XrdSecEntity *secent, char *hash, time_t tnow)
int ProcessHTTPReq ()
virtual bool Data (XrdXrootd::Bridge::Context &info, const struct iovec *iovP, int iovN, int iovL, bool final)
virtual bool Done (XrdXrootd::Bridge::Context &info)
 the result context
virtual bool Error (XrdXrootd::Bridge::Context &info, int ecode, const char *etext)
virtual int File (XrdXrootd::Bridge::Context &info, int dlen)
virtual bool Redir (XrdXrootd::Bridge::Context &info, int port, const char *hname)

Public Attributes

readahead_listralist
ReqType request
 The request we got.
std::string requestverb
std::map< std::string,
std::string > 
allheaders
XrdOucString resource
 The resource specified by the request, stripped of opaque data.
XrdOucEnvopaque
 The opaque data, after parsing.
XrdOucString resourceplusopaque
 The resource specified by the request, including all the opaque data.
bool headerok
 Tells if we have finished reading the header.
std::vector< ReadWriteOprwOps
 The original list of multiple reads to perform.
std::vector< ReadWriteOprwOps_split
bool keepalive
long long length
int depth
bool sendcontinue
std::string host
 The host field specified in the req.
std::string destination
 The destination field specified in the req.
std::string m_req_digest
 The requested digest type.
XrdOucString m_resource_with_digest
std::string m_digest_header
 The computed digest for the HTTP response header.
std::string hdr2cgistr
 Additional opaque info that may come from the hdr2cgi directive.
bool m_appended_hdr2cgistr
unsigned int rwOpDone
 To coordinate multipart responses across multiple calls.
unsigned int rwOpPartialDone
ClientRequest xrdreq
 The last issued xrd request, often pending.
XResponseType xrdresp
 The last response data we got.
XErrorCode xrderrcode
std::string etext
XrdOucString redirdest
struct iovec * iovP
 The latest data chunks got from the xrd layer. These are valid only inside the callbacks!
int iovN
 array count
int iovL
 byte count
bool final
 true -> final result
long long filesize
long fileflags
long filemodtime
char fhandle [4]
bool fopened
std::string stringresp
 If we want to give a string as a response, we compose it here.
int reqstate
 State machine to talk to the bridge.
long long writtenbytes
 In a long write, we track where we have arrived.

Private Member Functions

int parseContentRange (char *)
int parseHost (char *)
int parseRWOp (char *)
void clientMarshallReadAheadList (int nitems)
void clientUnMarshallReadAheadList (int nitems)
void getfhandle ()
int PostProcessChecksum (std::string &digest_header)
int PostProcessHTTPReq (bool final=false)
void parseResource (char *url)
void mapXrdErrorToHttpStatus ()

Private Attributes

int httpStatusCode
std::string httpStatusText
bool m_transfer_encoding_chunked
long long m_current_chunk_offset
long long m_current_chunk_size
XrdHttpProtocolprot

Member Enumeration Documentation

These are the HTTP/DAV requests that we support.

Enumerator:
rtUnset 
rtUnknown 
rtMalformed 
rtGET 
rtHEAD 
rtPUT 
rtOPTIONS 
rtPATCH 
rtDELETE 
rtPROPFIND 
rtMKCOL 
rtMOVE 
rtPOST 

Constructor & Destructor Documentation

XrdHttpReq::XrdHttpReq ( XrdHttpProtocol protinstance  )  [inline]
virtual XrdHttpReq::~XrdHttpReq (  )  [virtual]

Member Function Documentation

void XrdHttpReq::appendOpaque ( XrdOucString s,
XrdSecEntity secent,
char *  hash,
time_t  tnow 
)
std::string XrdHttpReq::buildPartialHdr ( long long  bytestart,
long long  byteend,
long long  filesize,
char *  token 
)

Build a partial header for a multipart response.

std::string XrdHttpReq::buildPartialHdrEnd ( char *  token  ) 

Build the closing part for a multipart response.

void XrdHttpReq::clientMarshallReadAheadList ( int  nitems  )  [private]
void XrdHttpReq::clientUnMarshallReadAheadList ( int  nitems  )  [private]
virtual bool XrdHttpReq::Data ( XrdXrootd::Bridge::Context info,
const struct iovec *  iovP,
int  iovN,
int  iovL,
bool  final 
) [virtual]

Effect a client data response.

The Data() method is called when Run() resulted in a successful data response. The method should rewrite the data and send it to the client using the associated XrdLink object. As an example, 1) Result::Data(info, iovP, iovN, iovL) is called. 2) Inspect iovP, rewrite the data. 3) Send the response: info->linkP->Send(new_iovP, new_iovN, new_iovL); 4) Handle send errors and cleanup(e.g. deallocate storage). 5) Return, the exchange is now complete.

Parameters:
info the context associated with the result.
iovP a pointer to the iovec structure containing the xrootd data response about to be sent to the client. The request header is not included in the iovec structure. The elements of this structure must not be modified by the method.
iovN the number of elements in the iovec structure array.
iovL total number of data bytes that would be sent to the client. This is simply the sum of all the lengths in the iovec.
final True is this is the final result. Otherwise, this is a partial result (i.e. kXR_oksofar) and more data will result causing additional callbacks.
Returns:
true continue normal processing. false terminate the bridge and close the link.
Parameters:
info the result context
iovP pointer to data array
iovN array count
iovL byte count
final true -> final result

Implements XrdXrootd::Bridge::Result.

virtual bool XrdHttpReq::Done ( XrdXrootd::Bridge::Context info  )  [virtual]

the result context

Effect a client acknowledgement.

The Done() method is called when Run() resulted in success and there is no associated data for the client (equivalent to a simple kXR_ok response).

Parameters:
info the context associated with the result.
Returns:
true continue normal processing. false terminate the bridge and close the link.

Implements XrdXrootd::Bridge::Result.

virtual bool XrdHttpReq::Error ( XrdXrootd::Bridge::Context info,
int  ecode,
const char *  etext 
) [virtual]

Effect a client error response.

The Error() method is called when an error was encountered while processing the Run() request. The error should be reflected to the client.

Parameters:
info the context associated with the result.
ecode the "kXR" error code describing the nature of the error. The code is in host byte format.
etext a null terminated string describing the error in human terms
Returns:
true continue normal processing. false terminate the bridge and close the link.
Parameters:
info the result context
ecode the "kXR" error code
etext associated error message

Implements XrdXrootd::Bridge::Result.

virtual int XrdHttpReq::File ( XrdXrootd::Bridge::Context info,
int  dlen 
) [virtual]

Notify callback that a sendfile() request is pending.

The File() method is called when Run() resulted in a sendfile response (i.e. sendfile() would have been used to send data to the client). This allows the callback to reframe the sendfile() data using the Send() method in the passed context object (see class Context above).

Parameters:
info the context associated with the result.
dlen total number of data bytes that would be sent to the client.
Returns:
true continue normal processing. false terminate the bridge and close the link.
Parameters:
info the result context
dlen byte count

Implements XrdXrootd::Bridge::Result.

void XrdHttpReq::getfhandle (  )  [private]
void XrdHttpReq::mapXrdErrorToHttpStatus (  )  [private]
int XrdHttpReq::parseBody ( char *  body,
long long  len 
)

Parse the body of a request, assuming that it's XML and that it's entirely in memory.

int XrdHttpReq::parseContentRange ( char *   )  [private]
int XrdHttpReq::parseFirstLine ( char *  line,
int  len 
)

Parse the first line of the header.

int XrdHttpReq::parseHost ( char *   )  [private]
int XrdHttpReq::parseLine ( char *  line,
int  len 
)

Parse the header.

void XrdHttpReq::parseResource ( char *  url  )  [private]
int XrdHttpReq::parseRWOp ( char *   )  [private]
int XrdHttpReq::PostProcessChecksum ( std::string &  digest_header  )  [private]
int XrdHttpReq::PostProcessHTTPReq ( bool  final = false  )  [private]

Cook and send the response after the bridge did something Return values: 0->everything OK, additionsl steps may be required 1->request processed completely -1->error

int XrdHttpReq::ProcessHTTPReq (  ) 

Crunch an http request. Return values: 0->call Process again 1->request processed -1->error

virtual bool XrdHttpReq::Redir ( XrdXrootd::Bridge::Context info,
int  port,
const char *  hname 
) [virtual]

Redirect the client to another host:port.

The Redir() method is called when the client must be redirected to another host.

Parameters:
info the context associated with the result.
port the port number in host byte format.
hname the DNS name of the host or IP address is IPV4 or IPV6 format (i.e. "n.n.n.n" or "[ipv6_addr]").
Returns:
true continue normal processing. false terminate the bridge and close the link.
Parameters:
info the result context
port the port number
hname the destination host

Implements XrdXrootd::Bridge::Result.

int XrdHttpReq::ReqReadV (  ) 

Prepare the buffers for sending a readv request.

virtual void XrdHttpReq::reset (  )  [virtual]

Member Data Documentation

std::map<std::string, std::string> XrdHttpReq::allheaders

Referenced by XrdHttpReq().

The destination field specified in the req.

std::string XrdHttpReq::etext

true -> final result

Referenced by XrdHttpReq().

Additional opaque info that may come from the hdr2cgi directive.

Tells if we have finished reading the header.

Referenced by XrdHttpReq().

std::string XrdHttpReq::host

The host field specified in the req.

std::string XrdHttpReq::httpStatusText [private]

byte count

array count

struct iovec* XrdHttpReq::iovP [read]

The latest data chunks got from the xrd layer. These are valid only inside the callbacks!

pointer to data array

long long XrdHttpReq::length

Referenced by XrdHttpReq().

long long XrdHttpReq::m_current_chunk_size [private]

The computed digest for the HTTP response header.

The requested digest type.

The checksum algorithm is specified as part of the opaque data in the URL. Hence, when a digest is generated to satisfy a request, we cache the tweaked URL in this data member.

The opaque data, after parsing.

Referenced by XrdHttpReq().

Referenced by XrdHttpReq().

Referenced by XrdHttpReq().

State machine to talk to the bridge.

The request we got.

The resource specified by the request, stripped of opaque data.

The resource specified by the request, including all the opaque data.

unsigned int XrdHttpReq::rwOpDone

To coordinate multipart responses across multiple calls.

The original list of multiple reads to perform.

The new list got from chunking the original req respecting the xrootd max sizes etc.

If we want to give a string as a response, we compose it here.

In a long write, we track where we have arrived.

Referenced by XrdHttpReq().

The last issued xrd request, often pending.

The last response data we got.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 11 Jun 2020 for xrootd by  doxygen 1.6.1