LLHTTPResponder Class Reference

This class. More...

Inheritance diagram for LLHTTPResponder:

Inheritance graph
[legend]
Collaboration diagram for LLHTTPResponder:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 LLHTTPResponder (const LLHTTPNode &tree, const LLSD &ctx)
 ~LLHTTPResponder ()

Protected Types

 STATE_NOTHING
 STATE_READING_HEADERS
 STATE_LOOKING_FOR_EOS
 STATE_DONE
 STATE_SHORT_CIRCUIT
enum  EState {
  STATE_NOTHING, STATE_READING_HEADERS, STATE_LOOKING_FOR_EOS, STATE_DONE,
  STATE_SHORT_CIRCUIT
}

Protected Member Functions

bool readLine (const LLChannelDescriptors &channels, buffer_ptr_t buffer, U8 *dest, S32 &len)
 Read data off of CHANNEL_IN keeping track of last read position.
void markBad (const LLChannelDescriptors &channels, buffer_ptr_t buffer)
 Mark the request as bad, and handle appropriately.
EStatus process_impl (const LLChannelDescriptors &channels, buffer_ptr_t &buffer, bool &eos, LLSD &context, LLPumpIO *pump)
 Process the data in buffer.

Protected Attributes

LLSD mBuildContext
EState mState
U8mLastRead
std::string mVerb
std::string mAbsPathAndQuery
std::string mPath
std::string mQuery
std::string mVersion
S32 mContentLength
LLSD mHeaders
const LLHTTPNodemRootNode

Detailed Description

This class.

See also:
LLIOPipe
NOTE: You should not need to create or use one of these, the details are handled by the HTTPResponseFactory.

Definition at line 424 of file lliohttpserver.cpp.


Member Enumeration Documentation

enum LLHTTPResponder::EState [protected]

Enumerator:
STATE_NOTHING 
STATE_READING_HEADERS 
STATE_LOOKING_FOR_EOS 
STATE_DONE 
STATE_SHORT_CIRCUIT 

Definition at line 479 of file lliohttpserver.cpp.


Constructor & Destructor Documentation

LLHTTPResponder::LLHTTPResponder ( const LLHTTPNode tree,
const LLSD ctx 
)

Definition at line 503 of file lliohttpserver.cpp.

References LLMemType::MTYPE_IO_HTTP_SERVER.

LLHTTPResponder::~LLHTTPResponder (  ) 

Definition at line 514 of file lliohttpserver.cpp.

References LLMemType::MTYPE_IO_HTTP_SERVER.


Member Function Documentation

void LLHTTPResponder::markBad ( const LLChannelDescriptors channels,
buffer_ptr_t  buffer 
) [protected]

Mark the request as bad, and handle appropriately.

Parameters:
channels The channels to use in the buffer.
buffer The heap array of processed data.

Definition at line 547 of file lliohttpserver.cpp.

References HTTP_VERSION_STR, mState, LLMemType::MTYPE_IO_HTTP_SERVER, and STATE_SHORT_CIRCUIT.

Referenced by process_impl(), and readLine().

LLIOPipe::EStatus LLHTTPResponder::process_impl ( const LLChannelDescriptors channels,
buffer_ptr_t buffer,
bool &  eos,
LLSD context,
LLPumpIO pump 
) [protected]

Process the data in buffer.

Definition at line 560 of file lliohttpserver.cpp.

References LLPumpIO::addChain(), LLChainIOFactory::build(), CONTEXT_REQUEST(), LLPumpIO::copyCurrentLinkInfo(), DEFAULT_CHAIN_EXPIRY_SECS, end, LLHTTPNode::getProtocolHandler(), HTTP_VERB_DELETE(), HTTP_VERB_GET(), HTTP_VERB_POST(), HTTP_VERB_PUT(), HTTP_VERSION_STR, LLChannelDescriptors::in(), lldebugs, llinfos, mAbsPathAndQuery, LLBufferArray::makeChannelConsumer(), markBad(), mBuildContext, LLPumpIO::LLLinkInfo::mChannels, mContentLength, mHeaders, mLastRead, mPath, LLPumpIO::LLLinkInfo::mPipe, mQuery, mRootNode, mState, LLMemType::MTYPE_IO_HTTP_SERVER, mVerb, mVersion, NULL, LLChannelDescriptors::out(), PUMP_DEBUG, readLine(), S32, STATE_DONE, STATE_LOOKING_FOR_EOS, STATE_NOTHING, STATE_READING_HEADERS, STATE_SHORT_CIRCUIT, LLIOPipe::STATUS_BREAK, LLIOPipe::STATUS_DONE, LLIOPipe::STATUS_OK, LLIOPipe::STATUS_STOP, LLStringBase< char >::toLower(), LLHTTPNode::traverse(), and LLStringBase< char >::trimTail().

bool LLHTTPResponder::readLine ( const LLChannelDescriptors channels,
buffer_ptr_t  buffer,
U8 dest,
S32 len 
) [protected]

Read data off of CHANNEL_IN keeping track of last read position.

This is a quick little hack to read headers. It is not IO optimal, but it makes it easier for me to implement the header parsing. Plus, there should never be more than a few headers. This method will tend to read more than necessary, find the newline, make the front part of dest look like a c string, and move the read head back to where the newline was found. Thus, the next read will pick up on the next line.

Parameters:
channel The channel to read in the buffer
buffer The heap array of processed data
dest Destination for the data to be read
[in,out] len in The size of the buffer. out how much was read. This value is not useful for determining where to seek orfor string assignment.
Returns:
Returns true if a line was found.

Definition at line 520 of file lliohttpserver.cpp.

References LLChannelDescriptors::in(), lldebugs, markBad(), mLastRead, LLMemType::MTYPE_IO_HTTP_SERVER, and S32.

Referenced by process_impl().


Member Data Documentation

std::string LLHTTPResponder::mAbsPathAndQuery [protected]

Definition at line 492 of file lliohttpserver.cpp.

Referenced by process_impl().

LLSD LLHTTPResponder::mBuildContext [protected]

Definition at line 488 of file lliohttpserver.cpp.

Referenced by process_impl().

S32 LLHTTPResponder::mContentLength [protected]

Definition at line 496 of file lliohttpserver.cpp.

Referenced by process_impl().

LLSD LLHTTPResponder::mHeaders [protected]

Definition at line 497 of file lliohttpserver.cpp.

Referenced by process_impl().

U8* LLHTTPResponder::mLastRead [protected]

Definition at line 490 of file lliohttpserver.cpp.

Referenced by process_impl(), and readLine().

std::string LLHTTPResponder::mPath [protected]

Definition at line 493 of file lliohttpserver.cpp.

Referenced by process_impl().

std::string LLHTTPResponder::mQuery [protected]

Definition at line 494 of file lliohttpserver.cpp.

Referenced by process_impl().

const LLHTTPNode& LLHTTPResponder::mRootNode [protected]

Definition at line 500 of file lliohttpserver.cpp.

Referenced by process_impl().

EState LLHTTPResponder::mState [protected]

Definition at line 489 of file lliohttpserver.cpp.

Referenced by markBad(), and process_impl().

std::string LLHTTPResponder::mVerb [protected]

Definition at line 491 of file lliohttpserver.cpp.

Referenced by process_impl().

std::string LLHTTPResponder::mVersion [protected]

Definition at line 495 of file lliohttpserver.cpp.

Referenced by process_impl().


The documentation for this class was generated from the following file:
Generated on Thu Jul 1 06:11:24 2010 for Second Life Viewer by  doxygen 1.4.7