#include <HTTPClient.hpp>
Please notice that this is full HTTP/1.1 client supporting multiple features like resuming, multipart, and so on...
Public Types | |
enum | DocumentType { Unknown = 0x00000000, XML = 0x00000001, HTML = 0x00000002, JPEGImage = 0x00000003, PNGImage = 0x00000004, GIFImage = 0x00000005, Stylesheet = 0x00000006, ScriptFile = 0x00000007 } |
The possible documents type. More... | |
typedef juce::MemoryBlock | MemoryBlock |
typedef juce::Socket | Socket |
enum | State { Constructed = 0, Connected = 1, Prepared = 2, RequestEmitted = 3, FetchingResult = 4, HeaderReceived = 5, ResultFetched = 6, ResultParsed = 7, ErrorDetected = 8 } |
The current client state. More... | |
typedef juce::String | String |
Public Member Functions | |
bool | connectToServer () |
Locate server IP. | |
bool | emitRequest () |
Emit the request. | |
bool | fetchResults (const int timeoutMs) |
Fetching the results. | |
const void * | getDataPtr () const |
Get the data. | |
const unsigned int | getDataSize () const |
Get the result data size. | |
String | getHeaders () const |
Get headers. | |
const DocumentType | getMimeType () const |
Try to deduce document type from answer mimetype. | |
const State | getState () const |
Get the current status. | |
HTTPClient (const Network::URL &_URL=Network::URL(), const int _portNumber=80, const String &_postData=String::empty) | |
A simple client. | |
void | Mutate (const Network::URL &_URL, const int portNumber, const String &postData=String::empty) |
Mutate the client to another server. | |
bool | parseResults () |
Parse the result data. | |
bool | prepareHTTPHeaders () |
Prepare document request headers. | |
~HTTPClient () |
typedef juce::MemoryBlock UZI::HTTPClient::MemoryBlock |
typedef juce::Socket UZI::HTTPClient::Socket |
typedef juce::String UZI::HTTPClient::String |
The possible documents type.
Unknown | The document type is unknown. |
XML | The document is an XML stream. |
HTML | The document is an HTML stream. |
JPEGImage | The document is an image compressed using JPEG codec. |
PNGImage | The document is an image compressed using PNG codec. |
GIFImage | The document is an image compressed using GIF codec. |
Stylesheet | The document is an external stylesheet stream. |
ScriptFile | The document is an external script stream. |
The current client state.
UZI::HTTPClient::HTTPClient | ( | const Network::URL & | _URL = Network::URL() , |
|
const int | _portNumber = 80 , |
|||
const String & | _postData = String::empty | |||
) | [inline] |
A simple client.
UZI::HTTPClient::~HTTPClient | ( | ) | [inline] |
bool UZI::HTTPClient::connectToServer | ( | ) |
Locate server IP.
bool UZI::HTTPClient::emitRequest | ( | ) |
Emit the request.
bool UZI::HTTPClient::fetchResults | ( | const int | timeoutMs | ) |
Fetching the results.
const void * UZI::HTTPClient::getDataPtr | ( | ) | const |
Get the data.
const unsigned int UZI::HTTPClient::getDataSize | ( | ) | const |
Get the result data size.
String UZI::HTTPClient::getHeaders | ( | ) | const [inline] |
Get headers.
const HTTPClient::DocumentType UZI::HTTPClient::getMimeType | ( | ) | const |
Try to deduce document type from answer mimetype.
const State UZI::HTTPClient::getState | ( | ) | const [inline] |
Get the current status.
void UZI::HTTPClient::Mutate | ( | const Network::URL & | _URL, | |
const int | portNumber, | |||
const String & | postData = String::empty | |||
) |
Mutate the client to another server.
bool UZI::HTTPClient::parseResults | ( | ) |
Parse the result data.
After this call, the communication buffer contains the HTTP headers, while the answer buffer contains the data
bool UZI::HTTPClient::prepareHTTPHeaders | ( | ) |
Prepare document request headers.