|
UFO: Alien Invasion
|

Go to the source code of this file.
Functions | |
| bool | HTTP_ExtractComponents (const char *url, char *scheme, size_t schemeLength, char *host, size_t hostLength, char *path, size_t pathLength, int *port) |
| Extract the servername, the port and the path part of the given url. | |
| size_t | HTTP_Header (void *ptr, size_t size, size_t nmemb, void *stream) |
| libcurl callback to update header info. | |
| size_t | HTTP_Recv (void *ptr, size_t size, size_t nmemb, void *stream) |
| libcurl callback for HTTP_GetURL | |
| static void | HTTP_ResolvURL (const char *url, char *buf, size_t size) |
| Converts the hostname into an ip to work around a bug in libcurl (resp. the resolver) that uses alarm for timeouts (this is in conflict with our signal handlers and longjmp environment). | |
| static bool | HTTP_GetURLInternal (dlhandle_t &dl, const char *url, FILE *file, const char *postfields) |
| Gets a specific url. | |
| bool | HTTP_PutFile (const char *formName, const char *fileName, const char *url, const upparam_t *params) |
| bool | HTTP_GetToFile (const char *url, FILE *file, const char *postfields) |
Downloads the given url into the given file. | |
| bool | HTTP_Encode (const char *url, char *out, size_t outLength) |
| This function converts the given url to an URL encoded string. All input characters that are not a-z, A-Z, 0-9, '-', '.', '_' or '~' are converted to their "URL escaped" version (NN where NN is a two-digit hexadecimal number). | |
| bool | HTTP_GetURL (const char *url, http_callback_t callback, void *userdata, const char *postfields) |
Downloads the given url and return the data to the callback (optional). | |
| void | HTTP_Cleanup (void) |
| UFO is exiting or we're changing servers. Clean up. | |
UFO is exiting or we're changing servers. Clean up.
Definition at line 406 of file http.cpp.
Referenced by Qcommon_Shutdown().
| bool HTTP_Encode | ( | const char * | url, |
| char * | out, | ||
| size_t | outLength ) |
This function converts the given url to an URL encoded string. All input characters that are not a-z, A-Z, 0-9, '-', '.', '_' or '~' are converted to their "URL escaped" version (NN where NN is a two-digit hexadecimal number).
true if the conversion was successful, false if it failed or the target buffer was too small. Definition at line 362 of file http.cpp.
References Q_strncpyz().
Referenced by WEB_CGameGetURL(), WEB_GetToFile(), and WEB_GetURL().
| bool HTTP_ExtractComponents | ( | const char * | url, |
| char * | scheme, | ||
| size_t | schemeLength, | ||
| char * | host, | ||
| size_t | hostLength, | ||
| char * | path, | ||
| size_t | pathLength, | ||
| int * | port ) |
Extract the servername, the port and the path part of the given url.
| [in] | url | The url to extract the data from |
| [out] | scheme | The URL scheme string http or https |
| [in] | schemeLength | Length of the scheme buffer |
| [out] | host | The server target buffer |
| [in] | hostLength | The length of the buffer |
| [out] | path | The path target buffer |
| [in] | pathLength | The length of the buffer |
| [out] | port | The port |
true if the extracting went well, false if an error occurred Definition at line 38 of file http.cpp.
References Com_Printf(), i, port, Q_streq, Q_strncpyz(), Q_strneq, and Q_strnull().
Referenced by HTTP_ResolvURL(), and TEST_F().
| bool HTTP_GetToFile | ( | const char * | url, |
| FILE * | file, | ||
| const char * | postfields ) |
Downloads the given url into the given file.
| [in] | url | The url to fetch |
| [in] | file | The file to write the result into |
| [in] | postfields | Some potential POST data in the form |
Definition at line 346 of file http.cpp.
References FILE, HTTP_GetURLInternal(), and OBJZERO.
Referenced by WEB_CGameDownloadFromUser(), and WEB_GetToFile().
| bool HTTP_GetURL | ( | const char * | url, |
| http_callback_t | callback, | ||
| void * | userdata, | ||
| const char * | postfields ) |
Downloads the given url and return the data to the callback (optional).
| [in] | url | The url to fetch |
| [in] | callback | The callback to give the data to. Might also be NULL |
| [in] | userdata | The userdata that is given to the callback |
| [in] | postfields | Some potential POST data |
Definition at line 384 of file http.cpp.
References HTTP_GetURLInternal(), Mem_Free, OBJZERO, and dlhandle_t::tempBuffer.
Referenced by CL_QueryMasterServer(), Irc_Client_Invite_f(), Master_HeartbeatThread(), Master_Shutdown(), SV_SetMaster_f(), and WEB_GetURL().
|
static |
Gets a specific url.
Definition at line 206 of file http.cpp.
References Com_Printf(), dlhandle_t::curl, FILE, GAME_TITLE, HTTP_Header(), http_proxy, HTTP_Recv(), HTTP_ResolvURL(), http_timeout, Q_strncpyz(), Q_strnull(), UFO_VERSION, and dlhandle_t::URL.
Referenced by HTTP_GetToFile(), and HTTP_GetURL().
libcurl callback to update header info.
Definition at line 126 of file http.cpp.
References dlhandle_t::file, dlhandle_t::fileSize, len, Q_strncasecmp, and Q_strncpyz().
Referenced by CL_StartHTTPDownload(), and HTTP_GetURLInternal().
| bool HTTP_PutFile | ( | const char * | formName, |
| const char * | fileName, | ||
| const char * | url, | ||
| const upparam_t * | params ) |
Definition at line 265 of file http.cpp.
References Com_Printf(), GAME_TITLE, HTTP_ResolvURL(), http_timeout, upparam_t::name, upparam_t::next, Q_strnull(), UFO_VERSION, and upparam_t::value.
Referenced by WEB_PutFile().
libcurl callback for HTTP_GetURL
Definition at line 154 of file http.cpp.
References dlhandle_t::fileSize, Mem_AllocTypeN, Mem_Free, dlhandle_t::position, and dlhandle_t::tempBuffer.
Referenced by CL_StartHTTPDownload(), and HTTP_GetURLInternal().
|
static |
Converts the hostname into an ip to work around a bug in libcurl (resp. the resolver) that uses alarm for timeouts (this is in conflict with our signal handlers and longjmp environment).
| [in] | url | The url to convert |
| [out] | buf | The resolved url or empty if an error occurred |
| [in] | size | The size of the target buffer |
Definition at line 184 of file http.cpp.
References Com_Error(), Com_sprintf(), ERR_DROP, HTTP_ExtractComponents(), MAX_VAR, NET_ResolvNode(), and port.
Referenced by HTTP_GetURLInternal(), and HTTP_PutFile().