Sat, 13 Oct 2012 01:17:01 +0200
Basic API and testing actions for it
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
1 | /** |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
2 | * @file http.h HTTP API |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
3 | * @ingroup core |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
4 | */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
5 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
6 | /* purple |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
7 | * |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
8 | * Purple is the legal property of its developers, whose names are too numerous |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
9 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
10 | * source distribution. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
11 | * |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
12 | * This program is free software; you can redistribute it and/or modify |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
13 | * it under the terms of the GNU General Public License as published by |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
14 | * the Free Software Foundation; either version 2 of the License, or |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
15 | * (at your option) any later version. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
16 | * |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
17 | * This program is distributed in the hope that it will be useful, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
20 | * GNU General Public License for more details. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
21 | * |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
22 | * You should have received a copy of the GNU General Public License |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
23 | * along with this program; if not, write to the Free Software |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
25 | */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
26 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
27 | #ifndef _PURPLE_HTTP_H_ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
28 | #define _PURPLE_HTTP_H_ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
29 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
30 | #include <glib.h> |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
31 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
32 | #include "connection.h" |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
33 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
34 | /** |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
35 | * A structure containing all data required to generate a single HTTP request. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
36 | */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
37 | typedef struct _PurpleHttpRequest PurpleHttpRequest; |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
38 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
39 | /** |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
40 | * A representation of actually running HTTP request. Can be used to cancel the |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
41 | * request. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
42 | */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
43 | typedef struct _PurpleHttpConnection PurpleHttpConnection; |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
44 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
45 | /** |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
46 | * All information got with response for HTTP request. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
47 | */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
48 | typedef struct _PurpleHttpResponse PurpleHttpResponse; |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
49 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
50 | /** |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
51 | * An collection of cookies, got from HTTP response or provided for HTTP |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
52 | * request. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
53 | */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
54 | typedef struct _PurpleHTTPCookieJar PurpleHTTPCookieJar; |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
55 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
56 | /** |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
57 | * An callback called after performing (successfully or not) HTTP request. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
58 | */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
59 | typedef void (*PurpleHttpCallback)(PurpleHttpConnection *http_conn, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
60 | PurpleHttpResponse *response, gpointer user_data); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
61 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
62 | /** |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
63 | * An callback called after storing data requested by PurpleHttpContentReader. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
64 | */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
65 | typedef void (*PurpleHttpContentReaderCb)(PurpleHttpConnection *http_conn, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
66 | gboolean success, size_t stored); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
67 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
68 | /** |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
69 | * An callback for getting large request contents (ie. from file stored on |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
70 | * disk). |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
71 | * |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
72 | * @param http_conn Connection, which requests data. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
73 | * @param buffer Buffer to store data to (with offset ignored). |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
74 | * @param offset Position, from where to read data. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
75 | * @param length Length of data to read. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
76 | * @param user_data The user data passed with callback function. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
77 | * @param cb The function to call after storing data to buffer. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
78 | */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
79 | typedef void (*PurpleHttpContentReader)(PurpleHttpConnection *http_conn, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
80 | gchar *buffer, size_t offset, size_t length, gpointer user_data, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
81 | PurpleHttpContentReaderCb cb); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
82 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
83 | /** |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
84 | * An callback for writting large response contents. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
85 | * |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
86 | * @param http_conn Connection, which requests data. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
87 | * @param buffer Buffer to read data from (with offset ignored). |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
88 | * @param offset Position of data got (its value is offset + length of |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
89 | * previous call), can be safely ignored. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
90 | * @param length Length of data read. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
91 | * @param user_data The user data passed with callback function. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
92 | */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
93 | typedef void (*PurpleHttpContentWriter)(PurpleHttpConnection *http_conn, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
94 | const gchar *buffer, size_t offset, size_t length, gpointer user_data); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
95 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
96 | G_BEGIN_DECLS |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
97 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
98 | /**************************************************************************/ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
99 | /** @name Performing HTTP requests */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
100 | /**************************************************************************/ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
101 | /*@{*/ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
102 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
103 | /** |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
104 | * Fetches the data from a URL with GET request, and passes it to a callback |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
105 | * function. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
106 | * |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
107 | * @param gc The connection for which the request is needed, or NULL. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
108 | * @param url The URL. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
109 | * @param callback The callback function. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
110 | * @param data The user data to pass to the callback function. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
111 | * @return The HTTP connection struct. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
112 | */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
113 | PurpleHttpConnection * purple_http_get(PurpleConnection *gc, const gchar *url, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
114 | PurpleHttpCallback callback, gpointer user_data); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
115 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
116 | /** |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
117 | * Fetches a HTTP request and passes the response to a callback function. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
118 | * Provided request struct can be shared by multiple http requests but can not |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
119 | * be modified when any of these is running. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
120 | * |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
121 | * @param gc The connection for which the request is needed, or NULL. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
122 | * @param request The request. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
123 | * @param callback The callback function. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
124 | * @param user_data The user data to pass to the callback function. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
125 | * @return The HTTP connection struct. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
126 | */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
127 | PurpleHttpConnection * purple_http_request(PurpleConnection *gc, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
128 | PurpleHttpRequest *request, PurpleHttpCallback callback, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
129 | gpointer user_data); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
130 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
131 | /**************************************************************************/ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
132 | /** @name HTTP connection API */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
133 | /**************************************************************************/ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
134 | /*@{*/ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
135 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
136 | /** |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
137 | * Cancel a pending HTTP request. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
138 | * |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
139 | * @param http_conn The data returned when you initiated the HTTP request. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
140 | */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
141 | void purple_http_conn_cancel(PurpleHttpConnection *http_conn); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
142 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
143 | /** |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
144 | * Checks, if provided HTTP request is running. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
145 | * |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
146 | * @param http_conn The HTTP connection. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
147 | * @return TRUE, if provided connection is currently running. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
148 | */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
149 | gboolean purple_http_conn_is_running(PurpleHttpConnection *http_conn); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
150 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
151 | PurpleHttpRequest * purple_http_conn_get_request( |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
152 | PurpleHttpConnection *http_conn); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
153 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
154 | PurpleConnection * purple_http_conn_get_purple_connection( |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
155 | PurpleHttpConnection *http_conn); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
156 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
157 | const GSList * purple_http_conn_get_all(PurpleConnection *gc); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
158 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
159 | void purple_http_conn_cancel_all(PurpleConnection *gc); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
160 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
161 | /*@}*/ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
162 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
163 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
164 | /**************************************************************************/ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
165 | /** @name Cookie jar API */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
166 | /**************************************************************************/ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
167 | /*@{*/ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
168 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
169 | PurpleHTTPCookieJar * purple_http_cookie_jar_new(void); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
170 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
171 | void purple_http_cookie_jar_ref(PurpleHTTPCookieJar *cookie_jar); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
172 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
173 | void purple_http_cookie_jar_unref(PurpleHTTPCookieJar *cookie_jar); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
174 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
175 | void purple_http_cookie_jar_set(PurpleHTTPCookieJar *cookie_jar, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
176 | const gchar *name, const gchar *value); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
177 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
178 | const gchar * purple_http_cookie_jar_get(PurpleHTTPCookieJar *cookie_jar, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
179 | const gchar *name); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
180 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
181 | void purple_http_cookie_jar_remove(PurpleHTTPCookieJar *cookie_jar, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
182 | const gchar *name); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
183 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
184 | /*@}*/ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
185 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
186 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
187 | /**************************************************************************/ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
188 | /** @name HTTP Request API */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
189 | /**************************************************************************/ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
190 | /*@{*/ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
191 | |
|
33427
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
192 | /** |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
193 | * Creates the new instance of HTTP request configuration. |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
194 | * |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
195 | * @param url The URL to request for. |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
196 | * @return The new instance of HTTP request struct. |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
197 | */ |
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
198 | PurpleHttpRequest * purple_http_request_new(const gchar *url); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
199 | |
|
33427
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
200 | /** |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
201 | * Increment the reference count. |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
202 | * |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
203 | * @param request The request. |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
204 | */ |
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
205 | void purple_http_request_ref(PurpleHttpRequest *request); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
206 | |
|
33427
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
207 | /** |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
208 | * Decrement the reference count. |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
209 | * |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
210 | * If the reference count reaches zero, the http request struct will be freed. |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
211 | * |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
212 | * @param request The request. |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
213 | * @return @a request or @c NULL if the reference count reached zero. |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
214 | */ |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
215 | PurpleHttpRequest * purple_http_request_unref(PurpleHttpRequest *request); |
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
216 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
217 | void purple_http_request_set_url(PurpleHttpRequest *request, const gchar *url); // +get |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
218 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
219 | void purple_http_request_set_method(PurpleHttpRequest *request, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
220 | const gchar *method); // +get |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
221 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
222 | /** |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
223 | * Sets contents of HTTP request (for example, POST data). |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
224 | * |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
225 | * @param request The request. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
226 | * @param contents The contents. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
227 | * @param length The length of contents (-1 if it's a NULL-terminated string) |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
228 | */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
229 | void purple_http_request_set_contents(PurpleHttpRequest *request, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
230 | const gchar *contents, int length); // +get |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
231 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
232 | /** |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
233 | * Sets contents reader for HTTP request, used mainly for possible large |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
234 | * uploads. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
235 | * |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
236 | * @param request The request. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
237 | * @param reader The reader callback. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
238 | * @param user_data The user data to pass to the callback function. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
239 | */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
240 | void purple_http_request_set_contents_reader(PurpleHttpRequest *request, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
241 | PurpleHttpContentReader reader, gpointer user_data); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
242 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
243 | /** |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
244 | * Set contents writer for HTTP response. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
245 | * |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
246 | * @param request The request. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
247 | * @param reader The writer callback. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
248 | * @param user_data The user data to pass to the callback function. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
249 | */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
250 | void purple_http_request_set_response_writer(PurpleHttpRequest *request, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
251 | PurpleHttpContentWriter writer, gpointer user_data); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
252 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
253 | /** |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
254 | * -1 for unlimited |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
255 | */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
256 | void purple_http_request_set_max_redirects(PurpleHttpRequest *request, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
257 | int max_redirects); // +get |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
258 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
259 | /** |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
260 | * NULL for disabling cookie support |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
261 | */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
262 | void purple_http_request_set_cookie_jar(PurpleHttpRequest *request, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
263 | PurpleHTTPCookieJar *cookie_jar); // +get |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
264 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
265 | /** |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
266 | * NULL for default |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
267 | */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
268 | void purple_http_request_set_user_agent(PurpleHttpRequest *request, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
269 | const gchar *user_agent); // +get |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
270 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
271 | void purple_http_request_set_http11(PurpleHttpRequest *request, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
272 | gboolean http11); // +is |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
273 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
274 | /** |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
275 | * -1 for unlimited |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
276 | */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
277 | void purple_http_request_set_max_len(PurpleHttpRequest *request, int max_len); // +get |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
278 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
279 | /** |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
280 | * Sets (replaces, if exists) specified HTTP request header with provided value. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
281 | * |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
282 | * @param key A header to be set. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
283 | * @param value A value to set, or NULL to remove specified header from request. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
284 | * |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
285 | * @see purple_http_request_header_add |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
286 | */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
287 | void purple_http_request_header_set(PurpleHttpRequest *request, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
288 | const gchar *key, const gchar *value); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
289 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
290 | /** |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
291 | * Adds (without replacing, if exists) an HTTP request header. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
292 | * |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
293 | * @param key A header to be set. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
294 | * @param value A value to set. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
295 | * |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
296 | * @see purple_http_request_header_set |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
297 | */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
298 | void purple_http_request_header_add(PurpleHttpRequest *request, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
299 | const gchar *key, const gchar *value); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
300 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
301 | /*@}*/ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
302 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
303 | /**************************************************************************/ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
304 | /** @name HTTP response API */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
305 | /**************************************************************************/ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
306 | /*@{*/ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
307 | |
|
33427
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
308 | /** |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
309 | * Checks, if HTTP request was performed successfully. |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
310 | * |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
311 | * @param response The response. |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
312 | * @return TRUE, if request was performed successfully. |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
313 | */ |
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
314 | gboolean purple_http_response_is_successfull(PurpleHttpResponse *response); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
315 | |
|
33427
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
316 | /** |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
317 | * Gets HTTP response code. |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
318 | * |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
319 | * @param response The response. |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
320 | * @return HTTP response code. |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
321 | */ |
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
322 | int purple_http_response_get_code(PurpleHttpResponse *response); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
323 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
324 | const gchar * purple_http_response_get_error(PurpleHttpResponse *response); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
325 | |
|
33427
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
326 | /** |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
327 | * Gets HTTP response data length. |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
328 | * |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
329 | * @param response The response. |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
330 | * @return Data length; |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
331 | */ |
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
332 | gsize purple_http_response_get_data_len(PurpleHttpResponse *response); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
333 | |
|
33427
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
334 | /** |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
335 | * Gets HTTP response data. |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
336 | * |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
337 | * Response data is not written, if writer callback was set for request. |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
338 | * |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
339 | * @param response The response. |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
340 | * @return The data. |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
341 | */ |
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
342 | const gchar * purple_http_response_get_data(PurpleHttpResponse *response); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
343 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
344 | const GList * purple_http_response_get_all_headers(PurpleHttpResponse *response); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
345 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
346 | const GList * purple_http_response_get_headers_by_name( |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
347 | PurpleHttpResponse *response, const gchar *name); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
348 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
349 | const gchar * purple_http_response_get_header(PurpleHttpResponse *response, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
350 | const gchar *name); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
351 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
352 | /*@}*/ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
353 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
354 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
355 | G_END_DECLS |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
356 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
357 | #endif /* _PURPLE_HTTP_H_ */ |