comparison libpurple/util.h @ 23742:de8f2d3e538a

Add temporary purple_util_fetch_url_request_len and purple_util_fetch_url_len to enable restricting the length of HTTP downloads. Set a maximum size of 128kB to the UPnP-related downloads. Thanks to Andrew Hunt and Christian Grothoff for discovering the issue and providing a solution.
author Daniel Atallah <daniel.atallah@gmail.com>
date Fri, 08 Aug 2008 23:34:27 +0000
parents 399975ad001c
children 679a61dcf5c2 d777355b4a82
comparison
equal deleted inserted replaced
23741:80362fb76361 23742:de8f2d3e538a
1039 * @param url The URL. 1039 * @param url The URL.
1040 * @param full TRUE if this is the full URL, or FALSE if it's a 1040 * @param full TRUE if this is the full URL, or FALSE if it's a
1041 * partial URL. 1041 * partial URL.
1042 * @param user_agent The user agent field to use, or NULL. 1042 * @param user_agent The user agent field to use, or NULL.
1043 * @param http11 TRUE if HTTP/1.1 should be used to download the file. 1043 * @param http11 TRUE if HTTP/1.1 should be used to download the file.
1044 * @param max_len The maximum number of bytes to retrieve (-1 for unlimited)
1045 * @param cb The callback function.
1046 * @param data The user data to pass to the callback function.
1047 * @deprecated In 3.0.0, we'll rename this to "purple_util_fetch_url" and get rid of the old one
1048 */
1049 #define purple_util_fetch_url_len(url, full, user_agent, http11, max_len, cb, data) \
1050 purple_util_fetch_url_request_len(url, full, user_agent, http11, NULL, \
1051 FALSE, max_len, cb, data);
1052
1053 /**
1054 * Fetches the data from a URL, and passes it to a callback function.
1055 *
1056 * @param url The URL.
1057 * @param full TRUE if this is the full URL, or FALSE if it's a
1058 * partial URL.
1059 * @param user_agent The user agent field to use, or NULL.
1060 * @param http11 TRUE if HTTP/1.1 should be used to download the file.
1044 * @param request A HTTP request to send to the server instead of the 1061 * @param request A HTTP request to send to the server instead of the
1045 * standard GET 1062 * standard GET
1046 * @param include_headers 1063 * @param include_headers
1047 * If TRUE, include the HTTP headers in the response. 1064 * If TRUE, include the HTTP headers in the response.
1048 * @param callback The callback function. 1065 * @param callback The callback function.
1052 gboolean full, const gchar *user_agent, gboolean http11, 1069 gboolean full, const gchar *user_agent, gboolean http11,
1053 const gchar *request, gboolean include_headers, 1070 const gchar *request, gboolean include_headers,
1054 PurpleUtilFetchUrlCallback callback, gpointer data); 1071 PurpleUtilFetchUrlCallback callback, gpointer data);
1055 1072
1056 /** 1073 /**
1074 * Fetches the data from a URL, and passes it to a callback function.
1075 *
1076 * @param url The URL.
1077 * @param full TRUE if this is the full URL, or FALSE if it's a
1078 * partial URL.
1079 * @param user_agent The user agent field to use, or NULL.
1080 * @param http11 TRUE if HTTP/1.1 should be used to download the file.
1081 * @param request A HTTP request to send to the server instead of the
1082 * standard GET
1083 * @param include_headers
1084 * If TRUE, include the HTTP headers in the response.
1085 * @param max_len The maximum number of bytes to retrieve (-1 for unlimited)
1086 * @param callback The callback function.
1087 * @param data The user data to pass to the callback function.
1088 * @deprecated In 3.0.0, we'll rename this to "purple_util_fetch_url_request" and get rid of the old one
1089 */
1090 PurpleUtilFetchUrlData *purple_util_fetch_url_request_len(const gchar *url,
1091 gboolean full, const gchar *user_agent, gboolean http11,
1092 const gchar *request, gboolean include_headers, gssize max_len,
1093 PurpleUtilFetchUrlCallback callback, gpointer data);
1094
1095 /**
1057 * Cancel a pending URL request started with either 1096 * Cancel a pending URL request started with either
1058 * purple_util_fetch_url_request() or purple_util_fetch_url(). 1097 * purple_util_fetch_url_request() or purple_util_fetch_url().
1059 * 1098 *
1060 * @param url_data The data returned when you initiated the URL fetch. 1099 * @param url_data The data returned when you initiated the URL fetch.
1061 */ 1100 */