httpx
Browse all symbols documented inside this include file.
Functions
| Name | Description |
|---|---|
| HTTPX_IsFilesizeLarge | HTTPX_IsFilesizeLarge(DownloadID) If the filesize in bytes is beyond the limitations of integers the function will return true. |
| HTTPX_GetBytesReceived | HTTPX_GetBytesReceived(DownloadID) Returns total ammount of bytes received for DownloadID. |
| HTTPX_GetBytesReceivedLarge | HTTPX_GetBytesReceivedLarge(DownloadID, string[], len) Formats total ammount of bytes received for DownloadID in string form. |
| HTTPX_GetNewBytesReceived | HTTPX_GetNewBytesReceived() Returns the ammount of bytes that was received in this chunk. |
| HTTPX_GetFilesize | HTTPX_GetFilesize(DownloadID) Returns the filesize of DownloadID. If unknown it will return -1. |
| HTTPX_GetFilesizeLarge | HTTPX_GetFilesizeLarge(DownloadID, string[], len) Formats the large filesize of DownloadID in string form. |
| HTTPX_GetFilename | HTTPX_GetFilename(DownloadID) Returns the filename of DownloadID. |
| HTTPX_GetData | HTTPX_GetData(data[], len) Fills variable data[] with the last chunk downloaded. len decides maxlen for the data[] variable. Remember, this is raw data. No need to make room for null at the end unless you're passing it to any function that is trying to automatically find the end by searching for null (any string function). The function will return the ammount of bytes that was written to the data[] variable. By looping this function until it returns 0, you can get all the data. |
| HTTPX_IsPaused | Automatic updating Updates current plugin automatically (from AlliedModders webpage only to prevent spreading of malicious code). file_id[] has to be the same as it is on the forum webpage. (Check the link of the .amxx file ("Get Plugin" link)) If frequency is supplied you can set how often to update the file. If none is provided it will update as soon as possible. Please use this respectfully. Don't overload the AM forums. You can however provide your own method of determining whether the file needs to be updated or not before calling this function. That way you don't stress AM servers when not required. An example of this is in the HTTPX source which uses this method. Examples: 1d = 86400 1w = 604800 30d = 2592000 IMPORTANT! The reason for this not being a native is that it does not halt the plugin if HTTPX is not running. HTTPX and automatic updating is optional. Use this example instead. the File ID is the attachment in your post on the AM forums. Only use the ID, not the whole URL. For example: The plugin Name Replacer by anakin_cstrike, @http://forums.alliedmods.net/showthread.php?t=77401&highlight=replacer Scroll down and hover the "Get Plugin", there you see the file ID. Just replace the placeholder with that value. #define AUTOUPDATE_FILE_ID "76775" Add the time or create your own method of deciding when it's supposed to be updated and you're done. #define AUTOUPDATE_FILE_ID "REPLACE_THIS_WITH_YOUR_FILE_ID" #define AUTOUPDATE_HOW_OFTEN REPLACE_THIS_WITH_DESIRED_FREQUENCY // 1d = 86400, 1w = 604800, 30d = 2592000 UpdatePlugin() { if ( callfunc_begin("AutoupdatePlugin", "httpx.amxx") == 1 ) { // Don't touch. callfunc_push_int(get_plugin(-1)) // Plugin ID (to get the filename). Don't touch. callfunc_push_str(AUTOUPDATE_FILE_ID, false) // The file_id in string format. Touch above. callfunc_push_int(AUTOUPDATE_HOW_OFTEN) // Frequency of the automatic updates. Touch above. callfunc_end() // Don't touch. } } |
| HTTPX_Pause | HTTPX_Paused(DownloadID) Pauses the download. |
| HTTPX_Unpause | HTTPX_Unpause(DownloadID) Unpauses the download. |
| HTTPX_Abort | HTTPX_Abort(DownloadID, bool:DeleteFile = true) Aborts the transfer of selected download DownloadID. If DeleteFile is set to true the partially downloaded file will be deleted. |
| HTTPX_AddPostVar | HTTPX_AddPostVar(const variable[], const value[]) Adds a POST variable to the request. This function is used before HTTPX_Download() or HTTP_AddToQue(), similar to set/show hudmessage. It can be used multiple times before each download. |
| HTTPX_AddPostRaw | HTTPX_AddPostRaw(const data[]) Adds raw POST data to the request. This function is used before HTTPX_Download() or HTTP_AddToQue(), similar to set/show hudmessage. It can be used multiple times before each download. |
| HTTPX_Download | HTTPX_Download(const URL[], const Filename[] = "", const CompleteHandler[] = "", const ProgressHandler[] = "", Port = (80<<443), RequestType = REQUEST_GET, const Username[] = "", const Password[] = "", ...) Begins download of a URL. Read parameters for information. Parameters: const URL[] URL that you want to download. (Optional) const Filename[] Where should the information be stored? If no filename is entered it will download as a "stream". This means the data will be thrown away after it passes the buffer. You can read the data on progress forward and make use of it there. (Optional) const CompleteHandler[] = "" The function you want called when the download is complete. (Optional) const ProgressHandler[] = "" The function you want called when the download is in progress. This will be called every time data is downloaded. (Optional) Port = 0 The port that should be used. If this is left at default it will use 80 for http and 443 for https (when supported). (Optional) RequestType = REQUEST_GET What type of request should be used. If this is left at default it will use GET. Possible values so far are REQUEST_GET and REQUEST_POST. (Optional) const Username[] = "" (Optional) const Password[] = "" These are used to login to sites that require you to. It's only used for Basic authentication, not POST for example. Returns an DownloadID of the download that may be used to abort the download. |