Wed, 17 Oct 2012 10:04:19 +0200
Timeout support
|
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. |
|
33432
9c4acb75b2e6
Let's parse response headers
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33430
diff
changeset
|
87 | * @param response Response at point got so far (may change later). |
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
88 | * @param buffer Buffer to read data from (with offset ignored). |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
89 | * @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
|
90 | * previous call), can be safely ignored. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
91 | * @param length Length of data read. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
92 | * @param user_data The user data passed with callback function. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
93 | */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
94 | typedef void (*PurpleHttpContentWriter)(PurpleHttpConnection *http_conn, |
|
33432
9c4acb75b2e6
Let's parse response headers
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33430
diff
changeset
|
95 | PurpleHttpResponse *response, const gchar *buffer, size_t offset, |
|
9c4acb75b2e6
Let's parse response headers
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33430
diff
changeset
|
96 | size_t length, gpointer user_data); |
|
33425
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 | G_BEGIN_DECLS |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
99 | |
|
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 | /** @name Performing HTTP requests */ |
|
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 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
105 | /** |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
106 | * 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
|
107 | * function. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
108 | * |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
109 | * @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
|
110 | * @param url The URL. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
111 | * @param callback The callback function. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
112 | * @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
|
113 | * @return The HTTP connection struct. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
114 | */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
115 | PurpleHttpConnection * purple_http_get(PurpleConnection *gc, const gchar *url, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
116 | PurpleHttpCallback callback, gpointer user_data); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
117 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
118 | /** |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
119 | * 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
|
120 | * 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
|
121 | * be modified when any of these is running. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
122 | * |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
123 | * @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
|
124 | * @param request The request. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
125 | * @param callback The callback function. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
126 | * @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
|
127 | * @return The HTTP connection struct. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
128 | */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
129 | PurpleHttpConnection * purple_http_request(PurpleConnection *gc, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
130 | PurpleHttpRequest *request, PurpleHttpCallback callback, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
131 | gpointer user_data); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
132 | |
|
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 | /** @name HTTP connection API */ |
|
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 | |
|
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 | * Cancel a pending 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 | * @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
|
142 | */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
143 | void purple_http_conn_cancel(PurpleHttpConnection *http_conn); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
144 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
145 | /** |
|
33448
4d41b1f7b95f
Cancelling all HTTP connections on account disconnect or app shutdown
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33446
diff
changeset
|
146 | * Cancels all HTTP connections associated with the specified handle. |
|
4d41b1f7b95f
Cancelling all HTTP connections on account disconnect or app shutdown
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33446
diff
changeset
|
147 | * |
|
4d41b1f7b95f
Cancelling all HTTP connections on account disconnect or app shutdown
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33446
diff
changeset
|
148 | * @param gc The handle. |
|
4d41b1f7b95f
Cancelling all HTTP connections on account disconnect or app shutdown
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33446
diff
changeset
|
149 | */ |
|
4d41b1f7b95f
Cancelling all HTTP connections on account disconnect or app shutdown
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33446
diff
changeset
|
150 | void purple_http_conn_cancel_all(PurpleConnection *gc); |
|
4d41b1f7b95f
Cancelling all HTTP connections on account disconnect or app shutdown
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33446
diff
changeset
|
151 | |
|
4d41b1f7b95f
Cancelling all HTTP connections on account disconnect or app shutdown
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33446
diff
changeset
|
152 | /** |
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
153 | * Checks, if provided HTTP request is running. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
154 | * |
|
33448
4d41b1f7b95f
Cancelling all HTTP connections on account disconnect or app shutdown
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33446
diff
changeset
|
155 | * @param http_conn The HTTP connection (may be invalid pointer). |
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
156 | * @return TRUE, if provided connection is currently running. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
157 | */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
158 | gboolean purple_http_conn_is_running(PurpleHttpConnection *http_conn); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
159 | |
|
33449
39934ddba843
Put some TODOs
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33448
diff
changeset
|
160 | //TODO |
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
161 | PurpleHttpRequest * purple_http_conn_get_request( |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
162 | PurpleHttpConnection *http_conn); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
163 | |
|
33449
39934ddba843
Put some TODOs
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33448
diff
changeset
|
164 | //TODO |
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
165 | PurpleConnection * purple_http_conn_get_purple_connection( |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
166 | PurpleHttpConnection *http_conn); |
|
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 | |
|
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 | /**************************************************************************/ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
172 | /** @name Cookie jar API */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
173 | /**************************************************************************/ |
|
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 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
176 | PurpleHTTPCookieJar * purple_http_cookie_jar_new(void); |
|
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 | void purple_http_cookie_jar_ref(PurpleHTTPCookieJar *cookie_jar); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
179 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
180 | void purple_http_cookie_jar_unref(PurpleHTTPCookieJar *cookie_jar); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
181 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
182 | void purple_http_cookie_jar_set(PurpleHTTPCookieJar *cookie_jar, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
183 | const gchar *name, const gchar *value); |
|
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 | const gchar * purple_http_cookie_jar_get(PurpleHTTPCookieJar *cookie_jar, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
186 | const gchar *name); |
|
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 | void purple_http_cookie_jar_remove(PurpleHTTPCookieJar *cookie_jar, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
189 | const gchar *name); |
|
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 | /*@}*/ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
192 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
193 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
194 | /**************************************************************************/ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
195 | /** @name HTTP Request API */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
196 | /**************************************************************************/ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
197 | /*@{*/ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
198 | |
|
33427
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
199 | /** |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
200 | * 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
|
201 | * |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
202 | * @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
|
203 | * @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
|
204 | */ |
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
205 | PurpleHttpRequest * purple_http_request_new(const gchar *url); |
|
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 | * Increment 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 | * @param request The request. |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
211 | */ |
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
212 | void purple_http_request_ref(PurpleHttpRequest *request); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
213 | |
|
33427
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 | * Decrement the reference count. |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
216 | * |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
217 | * 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
|
218 | * |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
219 | * @param request The request. |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
220 | * @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
|
221 | */ |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
222 | PurpleHttpRequest * purple_http_request_unref(PurpleHttpRequest *request); |
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
223 | |
|
33449
39934ddba843
Put some TODOs
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33448
diff
changeset
|
224 | //TODO |
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
225 | 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
|
226 | |
|
33449
39934ddba843
Put some TODOs
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33448
diff
changeset
|
227 | //TODO |
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
228 | void purple_http_request_set_method(PurpleHttpRequest *request, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
229 | const gchar *method); // +get |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
230 | |
|
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 | * Sets contents of HTTP request (for example, POST data). |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
233 | * |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
234 | * @param request The request. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
235 | * @param contents The contents. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
236 | * @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
|
237 | */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
238 | void purple_http_request_set_contents(PurpleHttpRequest *request, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
239 | const gchar *contents, int length); // +get |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
240 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
241 | /** |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
242 | * 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
|
243 | * uploads. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
244 | * |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
245 | * @param request The request. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
246 | * @param reader The reader callback. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
247 | * @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
|
248 | */ |
|
33449
39934ddba843
Put some TODOs
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33448
diff
changeset
|
249 | //TODO |
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
250 | void purple_http_request_set_contents_reader(PurpleHttpRequest *request, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
251 | PurpleHttpContentReader reader, 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 | * Set contents writer for HTTP response. |
|
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 | * @param request The request. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
257 | * @param reader The writer callback. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
258 | * @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
|
259 | */ |
|
33449
39934ddba843
Put some TODOs
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33448
diff
changeset
|
260 | //TODO |
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
261 | void purple_http_request_set_response_writer(PurpleHttpRequest *request, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
262 | PurpleHttpContentWriter writer, gpointer user_data); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
263 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
264 | /** |
|
33450
4042907bcdf1
Timeout support
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33449
diff
changeset
|
265 | * Set maximum amount of time, that request is allowed to run. |
|
4042907bcdf1
Timeout support
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33449
diff
changeset
|
266 | * |
|
4042907bcdf1
Timeout support
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33449
diff
changeset
|
267 | * @param request The request. |
|
4042907bcdf1
Timeout support
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33449
diff
changeset
|
268 | * @param timeout Time (in seconds) after that timeout will be cancelled, |
|
4042907bcdf1
Timeout support
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33449
diff
changeset
|
269 | * -1 for infinite time. |
|
4042907bcdf1
Timeout support
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33449
diff
changeset
|
270 | */ |
|
4042907bcdf1
Timeout support
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33449
diff
changeset
|
271 | void purple_http_request_set_timeout(PurpleHttpRequest *request, int timeout); |
|
4042907bcdf1
Timeout support
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33449
diff
changeset
|
272 | |
|
4042907bcdf1
Timeout support
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33449
diff
changeset
|
273 | /** |
|
4042907bcdf1
Timeout support
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33449
diff
changeset
|
274 | * Get maximum amount of time, that request is allowed to run. |
|
4042907bcdf1
Timeout support
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33449
diff
changeset
|
275 | * |
|
4042907bcdf1
Timeout support
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33449
diff
changeset
|
276 | * @param request The request. |
|
4042907bcdf1
Timeout support
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33449
diff
changeset
|
277 | * @return Timeout currently set (-1 for infinite). |
|
4042907bcdf1
Timeout support
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33449
diff
changeset
|
278 | */ |
|
4042907bcdf1
Timeout support
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33449
diff
changeset
|
279 | int purple_http_request_get_timeout(PurpleHttpRequest *request); |
|
4042907bcdf1
Timeout support
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33449
diff
changeset
|
280 | |
|
4042907bcdf1
Timeout support
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33449
diff
changeset
|
281 | /** |
|
33444
b3afec292014
New features: http version switching and limits for redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33439
diff
changeset
|
282 | * Sets maximum amount of redirects. |
|
b3afec292014
New features: http version switching and limits for redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33439
diff
changeset
|
283 | * |
|
b3afec292014
New features: http version switching and limits for redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33439
diff
changeset
|
284 | * @param request The request. |
|
b3afec292014
New features: http version switching and limits for redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33439
diff
changeset
|
285 | * @param max_redirects Maximum amount of redirects, or -1 for unlimited. |
|
33425
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_set_max_redirects(PurpleHttpRequest *request, |
|
33444
b3afec292014
New features: http version switching and limits for redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33439
diff
changeset
|
288 | int max_redirects); |
|
b3afec292014
New features: http version switching and limits for redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33439
diff
changeset
|
289 | |
|
b3afec292014
New features: http version switching and limits for redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33439
diff
changeset
|
290 | /** |
|
b3afec292014
New features: http version switching and limits for redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33439
diff
changeset
|
291 | * Gets maximum amount of redirects. |
|
b3afec292014
New features: http version switching and limits for redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33439
diff
changeset
|
292 | * |
|
b3afec292014
New features: http version switching and limits for redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33439
diff
changeset
|
293 | * @param request The request. |
|
b3afec292014
New features: http version switching and limits for redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33439
diff
changeset
|
294 | * @return Current maximum amount of redirects (-1 for unlimited). |
|
b3afec292014
New features: http version switching and limits for redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33439
diff
changeset
|
295 | */ |
|
b3afec292014
New features: http version switching and limits for redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33439
diff
changeset
|
296 | int purple_http_request_get_max_redirects(PurpleHttpRequest *request); |
|
33425
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 | /** |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
299 | * NULL for disabling cookie support |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
300 | */ |
|
33449
39934ddba843
Put some TODOs
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33448
diff
changeset
|
301 | //TODO |
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
302 | void purple_http_request_set_cookie_jar(PurpleHttpRequest *request, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
303 | PurpleHTTPCookieJar *cookie_jar); // +get |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
304 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
305 | /** |
|
33444
b3afec292014
New features: http version switching and limits for redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33439
diff
changeset
|
306 | * Sets HTTP version to use. |
|
b3afec292014
New features: http version switching and limits for redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33439
diff
changeset
|
307 | * |
|
b3afec292014
New features: http version switching and limits for redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33439
diff
changeset
|
308 | * @param request The request. |
|
b3afec292014
New features: http version switching and limits for redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33439
diff
changeset
|
309 | * @param http11 TRUE for HTTP/1.1, FALSE for HTTP/1.0. |
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
310 | */ |
|
33444
b3afec292014
New features: http version switching and limits for redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33439
diff
changeset
|
311 | void purple_http_request_set_http11(PurpleHttpRequest *request, |
|
b3afec292014
New features: http version switching and limits for redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33439
diff
changeset
|
312 | gboolean http11); |
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
313 | |
|
33444
b3afec292014
New features: http version switching and limits for redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33439
diff
changeset
|
314 | /** |
|
b3afec292014
New features: http version switching and limits for redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33439
diff
changeset
|
315 | * Gets used HTTP version. |
|
b3afec292014
New features: http version switching and limits for redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33439
diff
changeset
|
316 | * |
|
b3afec292014
New features: http version switching and limits for redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33439
diff
changeset
|
317 | * @param request The request. |
|
b3afec292014
New features: http version switching and limits for redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33439
diff
changeset
|
318 | * @return TRUE, if we use HTTP/1.1, FALSE for HTTP/1.0. |
|
b3afec292014
New features: http version switching and limits for redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33439
diff
changeset
|
319 | */ |
|
b3afec292014
New features: http version switching and limits for redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33439
diff
changeset
|
320 | gboolean purple_http_request_is_http11(PurpleHttpRequest *request); |
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
321 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
322 | /** |
|
33446
95fda782966c
New feature: setting maximum length of response
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33444
diff
changeset
|
323 | * Sets maximum length of response content to read. |
|
95fda782966c
New feature: setting maximum length of response
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33444
diff
changeset
|
324 | * |
|
95fda782966c
New feature: setting maximum length of response
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33444
diff
changeset
|
325 | * Headers length doesn't count here. |
|
95fda782966c
New feature: setting maximum length of response
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33444
diff
changeset
|
326 | * |
|
95fda782966c
New feature: setting maximum length of response
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33444
diff
changeset
|
327 | * @param request The request. |
|
95fda782966c
New feature: setting maximum length of response
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33444
diff
changeset
|
328 | * @param max_len Maximum length of response to read (-1 for unlimited). |
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
329 | */ |
|
33446
95fda782966c
New feature: setting maximum length of response
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33444
diff
changeset
|
330 | void purple_http_request_set_max_len(PurpleHttpRequest *request, int max_len); |
|
95fda782966c
New feature: setting maximum length of response
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33444
diff
changeset
|
331 | |
|
95fda782966c
New feature: setting maximum length of response
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33444
diff
changeset
|
332 | /** |
|
95fda782966c
New feature: setting maximum length of response
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33444
diff
changeset
|
333 | * Gets maximum length of response content to read. |
|
95fda782966c
New feature: setting maximum length of response
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33444
diff
changeset
|
334 | * |
|
95fda782966c
New feature: setting maximum length of response
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33444
diff
changeset
|
335 | * @param request The request. |
|
95fda782966c
New feature: setting maximum length of response
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33444
diff
changeset
|
336 | * @return Maximum length of response to read, or -1 if unlimited. |
|
95fda782966c
New feature: setting maximum length of response
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33444
diff
changeset
|
337 | */ |
|
95fda782966c
New feature: setting maximum length of response
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33444
diff
changeset
|
338 | int purple_http_request_get_max_len(PurpleHttpRequest *request); |
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
339 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
340 | /** |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
341 | * 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
|
342 | * |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
343 | * @param key A header to be set. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
344 | * @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
|
345 | * |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
346 | * @see purple_http_request_header_add |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
347 | */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
348 | void purple_http_request_header_set(PurpleHttpRequest *request, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
349 | const gchar *key, const gchar *value); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
350 | |
|
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 | * Adds (without replacing, if exists) an HTTP request header. |
|
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 | * @param key A header to be set. |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
355 | * @param value A value to set. |
|
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 | * @see purple_http_request_header_set |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
358 | */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
359 | void purple_http_request_header_add(PurpleHttpRequest *request, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
360 | const gchar *key, const gchar *value); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
361 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
362 | /*@}*/ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
363 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
364 | /**************************************************************************/ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
365 | /** @name HTTP response API */ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
366 | /**************************************************************************/ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
367 | /*@{*/ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
368 | |
|
33427
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
369 | /** |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
370 | * 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
|
371 | * |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
372 | * @param response The response. |
|
33430
013c5aebb665
Let's connect
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33427
diff
changeset
|
373 | * @return TRUE, if request was performed successfully. |
|
33427
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
374 | */ |
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
375 | gboolean purple_http_response_is_successfull(PurpleHttpResponse *response); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
376 | |
|
33427
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
377 | /** |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
378 | * Gets HTTP response code. |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
379 | * |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
380 | * @param response The response. |
|
33430
013c5aebb665
Let's connect
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33427
diff
changeset
|
381 | * @return HTTP response code. |
|
33427
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
382 | */ |
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
383 | int purple_http_response_get_code(PurpleHttpResponse *response); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
384 | |
|
33430
013c5aebb665
Let's connect
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33427
diff
changeset
|
385 | /** |
|
013c5aebb665
Let's connect
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33427
diff
changeset
|
386 | * Gets error description. |
|
013c5aebb665
Let's connect
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33427
diff
changeset
|
387 | * |
|
013c5aebb665
Let's connect
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33427
diff
changeset
|
388 | * @param response The response. |
|
013c5aebb665
Let's connect
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33427
diff
changeset
|
389 | * @return Localized error description or NULL, if there was no error. |
|
013c5aebb665
Let's connect
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33427
diff
changeset
|
390 | */ |
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
391 | const gchar * purple_http_response_get_error(PurpleHttpResponse *response); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
392 | |
|
33427
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
393 | /** |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
394 | * Gets HTTP response data length. |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
395 | * |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
396 | * @param response The response. |
|
33430
013c5aebb665
Let's connect
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33427
diff
changeset
|
397 | * @return Data length; |
|
33427
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
398 | */ |
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
399 | gsize purple_http_response_get_data_len(PurpleHttpResponse *response); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
400 | |
|
33427
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
401 | /** |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
402 | * Gets HTTP response data. |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
403 | * |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
404 | * 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
|
405 | * |
|
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
406 | * @param response The response. |
|
33430
013c5aebb665
Let's connect
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33427
diff
changeset
|
407 | * @return The data. |
|
33427
dd0c0860e293
Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33425
diff
changeset
|
408 | */ |
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
409 | const gchar * purple_http_response_get_data(PurpleHttpResponse *response); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
410 | |
|
33449
39934ddba843
Put some TODOs
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33448
diff
changeset
|
411 | //TODO |
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
412 | const GList * purple_http_response_get_all_headers(PurpleHttpResponse *response); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
413 | |
|
33449
39934ddba843
Put some TODOs
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33448
diff
changeset
|
414 | //TODO |
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
415 | const GList * purple_http_response_get_headers_by_name( |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
416 | PurpleHttpResponse *response, const gchar *name); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
417 | |
|
33449
39934ddba843
Put some TODOs
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33448
diff
changeset
|
418 | //TODO |
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
419 | const gchar * purple_http_response_get_header(PurpleHttpResponse *response, |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
420 | const gchar *name); |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
421 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
422 | /*@}*/ |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
423 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
424 | |
|
33439
178eb69a3f11
Handle redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33432
diff
changeset
|
425 | /**************************************************************************/ |
|
178eb69a3f11
Handle redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33432
diff
changeset
|
426 | /** @name HTTP Subsystem */ |
|
178eb69a3f11
Handle redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33432
diff
changeset
|
427 | /**************************************************************************/ |
|
178eb69a3f11
Handle redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33432
diff
changeset
|
428 | /*@{*/ |
|
178eb69a3f11
Handle redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33432
diff
changeset
|
429 | |
|
178eb69a3f11
Handle redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33432
diff
changeset
|
430 | /** |
|
178eb69a3f11
Handle redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33432
diff
changeset
|
431 | * Initializes the http subsystem. |
|
178eb69a3f11
Handle redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33432
diff
changeset
|
432 | */ |
|
178eb69a3f11
Handle redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33432
diff
changeset
|
433 | void purple_http_init(void); |
|
178eb69a3f11
Handle redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33432
diff
changeset
|
434 | |
|
178eb69a3f11
Handle redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33432
diff
changeset
|
435 | /** |
|
178eb69a3f11
Handle redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33432
diff
changeset
|
436 | * Uninitializes the http subsystem. |
|
178eb69a3f11
Handle redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33432
diff
changeset
|
437 | */ |
|
178eb69a3f11
Handle redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33432
diff
changeset
|
438 | void purple_http_uninit(void); |
|
178eb69a3f11
Handle redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33432
diff
changeset
|
439 | |
|
178eb69a3f11
Handle redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33432
diff
changeset
|
440 | /*@}*/ |
|
178eb69a3f11
Handle redirects
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33432
diff
changeset
|
441 | |
|
33425
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
442 | G_END_DECLS |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
443 | |
|
379bf9ad6973
Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
444 | #endif /* _PURPLE_HTTP_H_ */ |