Rebel Fork Framework
|
#include <Urho3D/Network/HttpRequest.h>
Public Member Functions | |
HttpRequest (const ea::string &url, const ea::string &verb=EMPTY_STRING, const ea::vector< ea::string > &headers=ea::vector< ea::string >(), const ea::string &postData=EMPTY_STRING) | |
Construct with parameters. | |
~HttpRequest () override | |
Destruct. Release the connection object. | |
void | ThreadFunction () override |
Process the connection in the worker thread until closed. | |
unsigned | Read (void *dest, unsigned size) override |
unsigned | Seek (unsigned position) override |
Set position from the beginning of the stream. Not supported. | |
bool | IsEof () const override |
Return whether all response data has been read. | |
ea::string | GetURL () const |
const ea::string & | GetVerb () const |
ea::string | GetError () const |
HttpRequestState | GetState () const |
unsigned | GetAvailableSize () const |
bool | IsOpen () const |
Public Member Functions inherited from Urho3D::RefCounted | |
RefCounted () | |
Construct. Allocate the reference count structure and set an initial self weak reference. | |
virtual | ~RefCounted () |
Destruct. Mark as expired and also delete the reference count structure if no outside weak references exist. | |
RefCounted (const RefCounted &rhs)=delete | |
Prevent copy construction. | |
RefCounted & | operator= (const RefCounted &rhs)=delete |
Prevent assignment. | |
int | AddRef () |
int | ReleaseRef () |
int | Refs () const |
int | WeakRefs () const |
RefCount * | RefCountPtr () const |
Return pointer to the reference count structure. | |
bool | HasScriptObject () const |
Return true if script runtime object wrapping this native object exists. | |
bool | IsScriptStrongRef () const |
Return true if script reference is strong. | |
Public Member Functions inherited from Urho3D::Deserializer | |
Deserializer () | |
Construct with zero size. | |
Deserializer (unsigned size) | |
Construct with defined size. | |
virtual | ~Deserializer () |
Destruct. | |
virtual const ea::string & | GetName () const |
virtual unsigned | GetChecksum () |
unsigned | SeekRelative (int delta) |
Set position relative to current position. Return actual new position. | |
unsigned | GetPosition () const |
unsigned | Tell () const |
Return current position. | |
unsigned | GetSize () const |
long long | ReadInt64 () |
Read a 64-bit integer. | |
int | ReadInt () |
Read a 32-bit integer. | |
short | ReadShort () |
Read a 16-bit integer. | |
signed char | ReadByte () |
Read an 8-bit integer. | |
unsigned long long | ReadUInt64 () |
Read a 64-bit unsigned integer. | |
unsigned | ReadUInt () |
Read a 32-bit unsigned integer. | |
unsigned short | ReadUShort () |
Read a 16-bit unsigned integer. | |
unsigned char | ReadUByte () |
Read an 8-bit unsigned integer. | |
bool | ReadBool () |
Read a bool. | |
float | ReadFloat () |
Read a float. | |
double | ReadDouble () |
Read a double. | |
IntRect | ReadIntRect () |
Read an IntRect. | |
IntVector2 | ReadIntVector2 () |
Read an IntVector2. | |
IntVector3 | ReadIntVector3 () |
Read an IntVector3. | |
Rect | ReadRect () |
Read a Rect. | |
Vector2 | ReadVector2 () |
Read a Vector2. | |
Vector3 | ReadVector3 () |
Read a Vector3. | |
Vector3 | ReadPackedVector3 (float maxAbsCoord) |
Read a Vector3 packed into 3 x 16 bits with the specified maximum absolute range. | |
Vector4 | ReadVector4 () |
Read a Vector4. | |
Quaternion | ReadQuaternion () |
Read a quaternion. | |
Quaternion | ReadPackedQuaternion () |
Read a quaternion with each component packed in 16 bits. | |
Matrix3 | ReadMatrix3 () |
Read a Matrix3. | |
Matrix3x4 | ReadMatrix3x4 () |
Read a Matrix3x4. | |
Matrix4 | ReadMatrix4 () |
Read a Matrix4. | |
Color | ReadColor () |
Read a color. | |
BoundingBox | ReadBoundingBox () |
Read a bounding box. | |
ea::string | ReadString () |
Read a null-terminated string. | |
ea::string | ReadFileID () |
Read a four-letter file ID. | |
StringHash | ReadStringHash () |
Read a 32-bit StringHash. | |
ByteVector | ReadBuffer () |
Read a buffer with size encoded as VLE. | |
void | ReadBuffer (ByteVector &byteVector) |
Read a buffer with size encoded as VLE (inplace). | |
ResourceRef | ReadResourceRef () |
Read a resource reference. | |
ResourceRefList | ReadResourceRefList () |
Read a resource reference list. | |
Variant | ReadVariant () |
Read a variant. | |
Variant | ReadVariant (VariantType type, Context *context=nullptr) |
Read a variant whose type is already known. Context is required for SharedPtr<Serializable>. | |
VariantVector | ReadVariantVector () |
Read a variant vector. | |
StringVector | ReadStringVector () |
Read a string vector. | |
VariantMap | ReadVariantMap () |
Read a variant map. | |
StringVariantMap | ReadStringVariantMap () |
Read a string variant map. | |
unsigned | ReadVLE () |
Read a variable-length encoded unsigned integer. | |
ea::string | ReadLine () |
Read a text line. | |
Public Member Functions inherited from Urho3D::Thread | |
Thread (const ea::string &name=EMPTY_STRING) | |
Construct. Does not start the thread yet. | |
virtual | ~Thread () |
Destruct. If running, stop and wait for thread to finish. | |
bool | Run () |
Start running the thread. Return true if successful, or false if already running or if can not create the thread. | |
void | Stop () |
Set the running flag to false and wait for the thread to finish. | |
void | SetPriority (int priority) |
Set thread priority. The thread must have been started first. | |
bool | IsStarted () const |
Return whether thread exists. | |
void | SetName (const ea::string &name) |
Set name of the platform thread on supported platforms. Must be called before Run(). | |
Private Attributes | |
URL | url_ |
URL. | |
ea::string | verb_ |
Verb. | |
ea::string | error_ |
Error string. Empty if no error. | |
ea::vector< ea::string > | headers_ |
Headers. | |
ea::string | postData_ |
POST data. | |
HttpRequestState | state_ = HTTP_INITIALIZING |
Connection state. | |
Mutex | mutex_ |
Mutex for synchronizing the worker and the main thread. | |
VectorBuffer | readBuffer_ |
Read buffer for the main thread. | |
unsigned | readPosition_ = 0 |
Read buffer read cursor. | |
Additional Inherited Members | |
Static Public Member Functions inherited from Urho3D::Thread | |
static void | SetMainThread () |
Set the current thread as the main thread. | |
static ThreadID | GetCurrentThreadID () |
static bool | IsMainThread () |
Return whether is executing in the main thread. | |
Static Protected Member Functions inherited from Urho3D::Thread | |
static void * | ThreadFunctionStatic (void *data) |
Helper that executes Thread::ThreadFunction(). | |
Protected Attributes inherited from Urho3D::Deserializer | |
unsigned | position_ |
Stream position. | |
unsigned | size_ |
Stream size. | |
Protected Attributes inherited from Urho3D::Thread | |
ea::string | name_ {} |
Name of the thread. It will be propagated to underlying OS thread if possible. | |
void * | handle_ |
Thread handle. | |
volatile bool | shouldRun_ |
Running flag. | |
Static Protected Attributes inherited from Urho3D::Thread | |
static ThreadID | mainThreadID |
Main thread's thread ID. | |
An HTTP connection with response data stream. Perform an HTTP request to the specified URL. Empty verb defaults to a GET request. Return a request object which can be used to read the response data.
unsigned Urho3D::HttpRequest::GetAvailableSize | ( | ) | const |
Return amount of bytes in the read buffer.
ea::string Urho3D::HttpRequest::GetError | ( | ) | const |
Return error. Only non-empty in the error state.
HttpRequestState Urho3D::HttpRequest::GetState | ( | ) | const |
Return connection state.
|
inline |
Return URL used in the request.
|
inline |
Return verb used in the request. Default GET if empty verb specified on construction.
|
inline |
Return whether connection is in the open state.
|
overridevirtual |
Read response data from the HTTP connection and return number of bytes actually read. Does not block, may return a partial response. Read data only when GetState() returns HTTP_CLOSED to receive a well-formed response.
Implements Urho3D::Deserializer.