#include <Http.h>
|
| Http () |
|
virtual | ~Http () |
|
Type::Enum | getType () |
|
bool | headerIsFinished () |
|
bool | isFinished () |
|
std::string | getRedirectUrl () |
|
void | setRedirectUrl (std::string value) |
|
std::string | getRedirectQueryString () |
|
void | setRedirectQueryString (std::string value) |
|
int32_t | getRedirectStatus () |
|
void | setRedirectStatus (int32_t value) |
|
size_t | getMaxHeaderSize () |
|
void | setMaxHeaderSize (size_t value) |
|
size_t | getMaxContentSize () |
|
void | setMaxContentSize (size_t value) |
|
void | setFinished () |
| This method sets _finished and terminates _content with a null character. More...
|
|
const std::vector< char > & | getRawHeader () const |
|
const std::vector< char > & | getContent () const |
|
uint32_t | getContentSize () const |
|
Header & | getHeader () |
|
std::unordered_map< std::string, std::string > | getParsedQueryString () |
|
void | reset () |
|
int32_t | process (char *buffer, int32_t bufferLength, bool checkForChunkedXml=false, bool checkForChunkedJson=false) |
| Parses HTTP data from a buffer. More...
|
|
bool | headerProcessingStarted () |
|
bool | dataProcessingStarted () |
|
size_t | readStream (char *buffer, size_t requestLength) |
|
size_t | readContentStream (char *buffer, size_t requestLength) |
|
size_t | readFirstContentLine (char *buffer, size_t requestLength) |
|
std::string | getMimeType (std::string extension) |
|
std::string | getStatusText (int32_t code) |
|
std::set< std::shared_ptr< FormData > > | decodeMultipartFormdata () |
|
std::set< std::shared_ptr< FormData > > | decodeMultipartMixed (std::string &boundary, char *buffer, size_t bufferSize, char **pos) |
|
PVariable | serialize () |
|
void | unserialize (PVariable data) |
|
|
static std::string | encodeURL (const std::string &url) |
|
static std::string | decodeURL (const std::string &url) |
|
static void | constructHeader (uint32_t contentLength, std::string contentType, int32_t code, std::string codeDescription, const std::vector< std::string > &additionalHeaders, std::string &header) |
|
static std::string | stripHeader (const std::string &header, const std::unordered_set< std::string > &fieldsToStrip, const std::string &fieldsToAdd) |
| Strips a HTTP header of fields. More...
|
|
§ Http()
§ ~Http()
§ constructHeader()
void BaseLib::Http::constructHeader |
( |
uint32_t |
contentLength, |
|
|
std::string |
contentType, |
|
|
int32_t |
code, |
|
|
std::string |
codeDescription, |
|
|
const std::vector< std::string > & |
additionalHeaders, |
|
|
std::string & |
header |
|
) |
| |
|
static |
§ dataProcessingStarted()
bool BaseLib::Http::dataProcessingStarted |
( |
| ) |
|
|
inline |
§ decodeMultipartFormdata()
std::set< std::shared_ptr< Http::FormData > > BaseLib::Http::decodeMultipartFormdata |
( |
| ) |
|
§ decodeMultipartMixed()
std::set< std::shared_ptr< Http::FormData > > BaseLib::Http::decodeMultipartMixed |
( |
std::string & |
boundary, |
|
|
char * |
buffer, |
|
|
size_t |
bufferSize, |
|
|
char ** |
pos |
|
) |
| |
§ decodeURL()
std::string BaseLib::Http::decodeURL |
( |
const std::string & |
url | ) |
|
|
static |
§ encodeURL()
std::string BaseLib::Http::encodeURL |
( |
const std::string & |
url | ) |
|
|
static |
§ getContent()
const std::vector<char>& BaseLib::Http::getContent |
( |
| ) |
const |
|
inline |
§ getContentSize()
uint32_t BaseLib::Http::getContentSize |
( |
| ) |
const |
|
inline |
§ getHeader()
Header& BaseLib::Http::getHeader |
( |
| ) |
|
|
inline |
§ getMaxContentSize()
size_t BaseLib::Http::getMaxContentSize |
( |
| ) |
|
|
inline |
§ getMaxHeaderSize()
size_t BaseLib::Http::getMaxHeaderSize |
( |
| ) |
|
|
inline |
§ getMimeType()
std::string BaseLib::Http::getMimeType |
( |
std::string |
extension | ) |
|
§ getParsedQueryString()
std::unordered_map< std::string, std::string > BaseLib::Http::getParsedQueryString |
( |
| ) |
|
§ getRawHeader()
const std::vector<char>& BaseLib::Http::getRawHeader |
( |
| ) |
const |
|
inline |
§ getRedirectQueryString()
std::string BaseLib::Http::getRedirectQueryString |
( |
| ) |
|
|
inline |
§ getRedirectStatus()
int32_t BaseLib::Http::getRedirectStatus |
( |
| ) |
|
|
inline |
§ getRedirectUrl()
std::string BaseLib::Http::getRedirectUrl |
( |
| ) |
|
|
inline |
§ getStatusText()
std::string BaseLib::Http::getStatusText |
( |
int32_t |
code | ) |
|
§ getType()
§ headerIsFinished()
bool BaseLib::Http::headerIsFinished |
( |
| ) |
|
|
inline |
§ headerProcessingStarted()
bool BaseLib::Http::headerProcessingStarted |
( |
| ) |
|
|
inline |
§ isFinished()
bool BaseLib::Http::isFinished |
( |
| ) |
|
|
inline |
§ process()
int32_t BaseLib::Http::process |
( |
char * |
buffer, |
|
|
int32_t |
bufferLength, |
|
|
bool |
checkForChunkedXml = false , |
|
|
bool |
checkForChunkedJson = false |
|
) |
| |
Parses HTTP data from a buffer.
- Parameters
-
buffer | The buffer to parse |
bufferLength | The size of the buffer |
checkForChunkedXml | (Optional, default "false") Only works for XML-like content (content needs to start with '<'). Needed when TransferEncoding is not set to chunked. |
checkForChunkedJson | (Optional, default "false") Only works for JSON-like content (content needs to start with '{' or '['). Needed when TransferEncoding is not set to chunked. |
- Returns
- The number of processed bytes.
§ readContentStream()
size_t BaseLib::Http::readContentStream |
( |
char * |
buffer, |
|
|
size_t |
requestLength |
|
) |
| |
§ readFirstContentLine()
size_t BaseLib::Http::readFirstContentLine |
( |
char * |
buffer, |
|
|
size_t |
requestLength |
|
) |
| |
§ readStream()
size_t BaseLib::Http::readStream |
( |
char * |
buffer, |
|
|
size_t |
requestLength |
|
) |
| |
§ reset()
void BaseLib::Http::reset |
( |
| ) |
|
§ serialize()
§ setFinished()
void BaseLib::Http::setFinished |
( |
| ) |
|
This method sets _finished and terminates _content with a null character.
Use it, when the header does not contain "Content-Length".
- See also
- isFinished()
-
_finished
§ setMaxContentSize()
void BaseLib::Http::setMaxContentSize |
( |
size_t |
value | ) |
|
|
inline |
§ setMaxHeaderSize()
void BaseLib::Http::setMaxHeaderSize |
( |
size_t |
value | ) |
|
|
inline |
§ setRedirectQueryString()
void BaseLib::Http::setRedirectQueryString |
( |
std::string |
value | ) |
|
|
inline |
§ setRedirectStatus()
void BaseLib::Http::setRedirectStatus |
( |
int32_t |
value | ) |
|
|
inline |
§ setRedirectUrl()
void BaseLib::Http::setRedirectUrl |
( |
std::string |
value | ) |
|
|
inline |
§ stripHeader()
std::string BaseLib::Http::stripHeader |
( |
const std::string & |
header, |
|
|
const std::unordered_set< std::string > & |
fieldsToStrip, |
|
|
const std::string & |
fieldsToAdd |
|
) |
| |
|
static |
Strips a HTTP header of fields.
- Parameters
-
header | |
fieldsToStrip | The fields to remove. The entries need to be lower case. |
fieldsToAdd | Fields to append to the header after it has been stripped. Make sure the string ends with "\r\n". |
- Returns
- Returns the new header.
§ unserialize()
void BaseLib::Http::unserialize |
( |
PVariable |
data | ) |
|
The documentation for this class was generated from the following files: