#include <SFML/Config.h>#include <SFML/Network/Types.h>Go to the source code of this file.
Enumerations | |
| enum | sfHttpMethod { sfHttpGet, sfHttpPost, sfHttpHead } |
| Enumerate the available HTTP methods for a request. More... | |
| enum | sfHttpStatus { sfHttpOk = 200, sfHttpCreated = 201, sfHttpAccepted = 202, sfHttpNoContent = 204, sfHttpMultipleChoices = 300, sfHttpMovedPermanently = 301, sfHttpMovedTemporarily = 302, sfHttpNotModified = 304, sfHttpBadRequest = 400, sfHttpUnauthorized = 401, sfHttpForbidden = 403, sfHttpNotFound = 404, sfHttpInternalServerError = 500, sfHttpNotImplemented = 501, sfHttpBadGateway = 502, sfHttpServiceNotAvailable = 503, sfHttpInvalidResponse = 1000, sfHttpConnectionFailed = 1001 } |
| Enumerate all the valid status codes returned in a HTTP response. More... | |
Functions | |
| CSFML_API sfHttpRequest * | sfHttpRequest_Create () |
| Construct a new Http request. | |
| CSFML_API void | sfHttpRequest_Destroy (sfHttpRequest *HttpRequest) |
| Destroy an existing Http request. | |
| CSFML_API void | sfHttpRequest_SetField (sfHttpRequest *HttpRequest, const char *Field, const char *Value) |
| Set the value of a field; the field is added if it doesn't exist. | |
| CSFML_API void | sfHttpRequest_SetMethod (sfHttpRequest *HttpRequest, sfHttpMethod Method) |
| Set the request method. | |
| CSFML_API void | sfHttpRequest_SetURI (sfHttpRequest *HttpRequest, const char *URI) |
| Set the target URI of the request. | |
| CSFML_API void | sfHttpRequest_SetHttpVersion (sfHttpRequest *HttpRequest, unsigned int Major, unsigned int Minor) |
| Set the HTTP version of the request. | |
| CSFML_API void | sfHttpRequest_SetBody (sfHttpRequest *HttpRequest, const char *Body) |
| Set the body of the request. | |
| CSFML_API void | sfHttpResponse_Destroy (sfHttpResponse *HttpResponse) |
| Destroy an existing Http response. | |
| CSFML_API const char * | sfHttpResponse_GetField (sfHttpResponse *HttpResponse, const char *Field) |
| Get the value of a field; returns NULL if the field doesn't exist. | |
| CSFML_API sfHttpStatus | sfHttpResponse_GetStatus (sfHttpResponse *HttpResponse) |
| Get the status of a response. | |
| CSFML_API unsigned int | sfHttpResponse_GetMajorVersion (sfHttpResponse *HttpResponse) |
| Get the major HTTP version of a response. | |
| CSFML_API unsigned int | sfHttpResponse_GetMinorVersion (sfHttpResponse *HttpResponse) |
| Get the minor HTTP version of a response. | |
| CSFML_API const char * | sfHttpResponse_GetBody (sfHttpResponse *HttpResponse) |
| Get the body of the response. | |
| CSFML_API sfHttp * | sfHttp_Create () |
| Construct a new Http object. | |
| CSFML_API void | sfHttp_Destroy (sfHttp *Http) |
| Destroy an existing Http object. | |
| CSFML_API void | sfHttp_SetHost (sfHttp *Http, const char *Host, unsigned short Port) |
| Set the target host of a Http server. | |
| CSFML_API sfHttpResponse * | sfHttp_SendRequest (sfHttp *Http, sfHttpRequest *Request, float Timeout) |
| Send a HTTP request and return the server's response. | |
| enum sfHttpMethod |
| enum sfHttpStatus |
Enumerate all the valid status codes returned in a HTTP response.
| CSFML_API sfHttp* sfHttp_Create | ( | ) |
Construct a new Http object.
| CSFML_API void sfHttp_Destroy | ( | sfHttp * | Http | ) |
Destroy an existing Http object.
| Http | : Http to destroy |
| CSFML_API sfHttpResponse* sfHttp_SendRequest | ( | sfHttp * | Http, | |
| sfHttpRequest * | Request, | |||
| float | Timeout | |||
| ) |
Send a HTTP request and return the server's response.
You must be connected to a host before sending requests. Any missing mandatory header field will be added with an appropriate value. Warning : this function waits for the server's response and may not return instantly; use a thread if you don't want to block your application.
| Http | : Http object | |
| Request | : Request to send | |
| Timeout | : Maximum time to wait (0 to use no timeout) |
| CSFML_API void sfHttp_SetHost | ( | sfHttp * | Http, | |
| const char * | Host, | |||
| unsigned short | Port | |||
| ) |
Set the target host of a Http server.
| Http | : Http object | |
| Host | : Web server to connect to | |
| Port | : Port to use for connection (0 to use the standard port of the protocol used) |
| CSFML_API sfHttpRequest* sfHttpRequest_Create | ( | ) |
Construct a new Http request.
| CSFML_API void sfHttpRequest_Destroy | ( | sfHttpRequest * | HttpRequest | ) |
Destroy an existing Http request.
| HttpRequest | : Http request to destroy |
| CSFML_API void sfHttpRequest_SetBody | ( | sfHttpRequest * | HttpRequest, | |
| const char * | Body | |||
| ) |
Set the body of the request.
This parameter is optional and makes sense only for POST requests. This parameter is empty by default
| HttpRequest | : Http request to modify | |
| Body | : Content of the request body |
| CSFML_API void sfHttpRequest_SetField | ( | sfHttpRequest * | HttpRequest, | |
| const char * | Field, | |||
| const char * | Value | |||
| ) |
Set the value of a field; the field is added if it doesn't exist.
| HttpRequest | : Http request to modify | |
| Field | : Name of the field to set (case-insensitive) | |
| Value | : Value of the field |
| CSFML_API void sfHttpRequest_SetHttpVersion | ( | sfHttpRequest * | HttpRequest, | |
| unsigned int | Major, | |||
| unsigned int | Minor | |||
| ) |
Set the HTTP version of the request.
This parameter is 1.0 by default
| HttpRequest | : Http request to modify | |
| Major | : Major version number | |
| Minor | : Minor version number |
| CSFML_API void sfHttpRequest_SetMethod | ( | sfHttpRequest * | HttpRequest, | |
| sfHttpMethod | Method | |||
| ) |
Set the request method.
This parameter is sfHttpGet by default
| HttpRequest | : Http request to modify | |
| RequestMethod | : Method to use for the request |
| CSFML_API void sfHttpRequest_SetURI | ( | sfHttpRequest * | HttpRequest, | |
| const char * | URI | |||
| ) |
Set the target URI of the request.
This parameter is "/" by default
| HttpRequest | : Http request to modify | |
| URI | : URI to request, local to the host |
| CSFML_API void sfHttpResponse_Destroy | ( | sfHttpResponse * | HttpResponse | ) |
Destroy an existing Http response.
| HttpResponse | : Http response to destroy |
| CSFML_API const char* sfHttpResponse_GetBody | ( | sfHttpResponse * | HttpResponse | ) |
Get the body of the response.
The body can contain :
| HttpResponse | : Http response |
| CSFML_API const char* sfHttpResponse_GetField | ( | sfHttpResponse * | HttpResponse, | |
| const char * | Field | |||
| ) |
Get the value of a field; returns NULL if the field doesn't exist.
| HttpResponse | : Http response | |
| Field | : Field to get |
| CSFML_API unsigned int sfHttpResponse_GetMajorVersion | ( | sfHttpResponse * | HttpResponse | ) |
Get the major HTTP version of a response.
| HttpResponse | : Http response |
| CSFML_API unsigned int sfHttpResponse_GetMinorVersion | ( | sfHttpResponse * | HttpResponse | ) |
Get the minor HTTP version of a response.
| HttpResponse | : Http response |
| CSFML_API sfHttpStatus sfHttpResponse_GetStatus | ( | sfHttpResponse * | HttpResponse | ) |
Get the status of a response.
| HttpResponse | : Http response |