#include <HTTPConnection.h>
Classes | |
struct | BadResponse |
Encapsulates a raw HTTP response and response code. More... | |
Public Types | |
enum | ResponseCodes |
Public Member Functions | |
HTTPConnection (TCPInterface &tcp, const char *host, unsigned short port=80) | |
void | Post (const char *path, const char *data, const char *_contentType="application/x-www-form-urlencoded") |
RakNet::RakString | Read (void) |
void | Update (void) |
Call periodically to do time-based updates. | |
SystemAddress | GetServerAddress (void) const |
Returns the address of the server we are connected to. | |
bool | ProcessFinalTCPPacket (Packet *packet) |
bool | HasBadResponse (int *code, RakNet::RakString *data) |
Queued events of failed exchanges with the HTTP server. | |
bool | IsBusy (void) const |
Returns false if the connection is not doing anything else. |
Note that only one Post() can be handled at a time.
Results of HTTP requests. Standard response codes are < 999 ( define HTTP codes and our internal codes as needed )
HTTPConnection::HTTPConnection | ( | TCPInterface & | tcp, | |
const char * | host, | |||
unsigned short | port = 80 | |||
) |
Returns a HTTP object associated with this tcp connection
void HTTPConnection::Post | ( | const char * | path, | |
const char * | data, | |||
const char * | _contentType = "application/x-www-form-urlencoded" | |||
) |
Submit data to the HTTP server HTTP only allows one request at a time per connection
path | the path on the remote server you want to POST to. For example "mywebpage/index.html" | |
data | A NULL terminated string to submit to the server | |
contentType | "Content-Type:" passed to post. |
bool HTTPConnection::ProcessFinalTCPPacket | ( | Packet * | packet | ) |
Process an HTTP data packet returned from TCPInterface Returns true when we have gotten all the data from the HTTP server. If this returns true then it's safe to Post() another request Deallocate the packet as usual via TCPInterface
packet | NULL or a packet associated with our host and port |
RakString HTTPConnection::Read | ( | void | ) |
Get data returned by the HTTP server If IsFinished()==false then this may be empty or a partial response.