libpurple/http.h

Sat, 13 Oct 2012 13:56:55 +0200

author
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
date
Sat, 13 Oct 2012 13:56:55 +0200
changeset 33432
9c4acb75b2e6
parent 33430
013c5aebb665
child 33439
178eb69a3f11
permissions
-rw-r--r--

Let's parse response headers

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 /**
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
146 * Checks, if provided HTTP request is running.
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
147 *
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
148 * @param http_conn The HTTP connection.
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
149 * @return TRUE, if provided connection is currently running.
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 gboolean purple_http_conn_is_running(PurpleHttpConnection *http_conn);
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
152
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
153 PurpleHttpRequest * purple_http_conn_get_request(
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
154 PurpleHttpConnection *http_conn);
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
155
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
156 PurpleConnection * purple_http_conn_get_purple_connection(
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
157 PurpleHttpConnection *http_conn);
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 const GSList * purple_http_conn_get_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 void purple_http_conn_cancel_all(PurpleConnection *gc);
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
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 /** @name Cookie jar API */
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 PurpleHTTPCookieJar * purple_http_cookie_jar_new(void);
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_ref(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_unref(PurpleHTTPCookieJar *cookie_jar);
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
176
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
177 void purple_http_cookie_jar_set(PurpleHTTPCookieJar *cookie_jar,
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
178 const gchar *name, const gchar *value);
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 const gchar * purple_http_cookie_jar_get(PurpleHTTPCookieJar *cookie_jar,
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
181 const gchar *name);
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
182
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
183 void purple_http_cookie_jar_remove(PurpleHTTPCookieJar *cookie_jar,
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
184 const gchar *name);
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
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 /** @name HTTP Request API */
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
33427
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 * 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
196 *
dd0c0860e293 Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33425
diff changeset
197 * @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
198 * @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
199 */
33425
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
200 PurpleHttpRequest * purple_http_request_new(const gchar *url);
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
201
33427
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 * Increment the reference count.
dd0c0860e293 Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33425
diff changeset
204 *
dd0c0860e293 Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33425
diff changeset
205 * @param request The request.
dd0c0860e293 Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33425
diff changeset
206 */
33425
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
207 void purple_http_request_ref(PurpleHttpRequest *request);
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
208
33427
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 * Decrement the reference count.
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 * 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
213 *
dd0c0860e293 Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33425
diff changeset
214 * @param request The request.
dd0c0860e293 Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33425
diff changeset
215 * @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
216 */
dd0c0860e293 Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33425
diff changeset
217 PurpleHttpRequest * purple_http_request_unref(PurpleHttpRequest *request);
33425
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_url(PurpleHttpRequest *request, const gchar *url); // +get
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
220
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
221 void purple_http_request_set_method(PurpleHttpRequest *request,
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
222 const gchar *method); // +get
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
223
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 * Sets contents of HTTP request (for example, POST data).
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
226 *
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
227 * @param request The request.
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
228 * @param contents The contents.
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
229 * @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
230 */
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
231 void purple_http_request_set_contents(PurpleHttpRequest *request,
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
232 const gchar *contents, int length); // +get
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 /**
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
235 * 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
236 * uploads.
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 * @param request The request.
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
239 * @param reader The reader callback.
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
240 * @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
241 */
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
242 void purple_http_request_set_contents_reader(PurpleHttpRequest *request,
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
243 PurpleHttpContentReader reader, gpointer user_data);
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 /**
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
246 * Set contents writer for HTTP response.
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
247 *
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
248 * @param request The request.
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
249 * @param reader The writer callback.
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
250 * @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
251 */
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
252 void purple_http_request_set_response_writer(PurpleHttpRequest *request,
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
253 PurpleHttpContentWriter writer, gpointer user_data);
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
254
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 * -1 for unlimited
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
257 */
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
258 void purple_http_request_set_max_redirects(PurpleHttpRequest *request,
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
259 int max_redirects); // +get
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
260
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 * NULL for disabling cookie support
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 void purple_http_request_set_cookie_jar(PurpleHttpRequest *request,
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
265 PurpleHTTPCookieJar *cookie_jar); // +get
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
266
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 * NULL for default
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
269 */
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
270 void purple_http_request_set_user_agent(PurpleHttpRequest *request,
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
271 const gchar *user_agent); // +get
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
272
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
273 void purple_http_request_set_http11(PurpleHttpRequest *request,
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
274 gboolean http11); // +is
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
275
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 * -1 for unlimited
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 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
280
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 * 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
283 *
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
284 * @param key A header to be set.
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
285 * @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
286 *
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
287 * @see purple_http_request_header_add
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
288 */
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
289 void purple_http_request_header_set(PurpleHttpRequest *request,
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
290 const gchar *key, const gchar *value);
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
291
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 * Adds (without replacing, if exists) an HTTP request header.
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
294 *
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
295 * @param key A header to be set.
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
296 * @param value A value to 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 * @see purple_http_request_header_set
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
299 */
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
300 void purple_http_request_header_add(PurpleHttpRequest *request,
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
301 const gchar *key, const gchar *value);
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
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 /** @name HTTP response API */
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
307 /**************************************************************************/
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
308 /*@{*/
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
309
33427
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 * 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
312 *
dd0c0860e293 Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33425
diff changeset
313 * @param response The response.
33430
013c5aebb665 Let's connect
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33427
diff changeset
314 * @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
315 */
33425
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
316 gboolean purple_http_response_is_successfull(PurpleHttpResponse *response);
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
317
33427
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 * Gets HTTP response code.
dd0c0860e293 Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33425
diff changeset
320 *
dd0c0860e293 Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33425
diff changeset
321 * @param response The response.
33430
013c5aebb665 Let's connect
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33427
diff changeset
322 * @return HTTP response code.
33427
dd0c0860e293 Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33425
diff changeset
323 */
33425
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
324 int purple_http_response_get_code(PurpleHttpResponse *response);
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
325
33430
013c5aebb665 Let's connect
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33427
diff changeset
326 /**
013c5aebb665 Let's connect
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33427
diff changeset
327 * Gets error description.
013c5aebb665 Let's connect
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33427
diff changeset
328 *
013c5aebb665 Let's connect
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33427
diff changeset
329 * @param response The response.
013c5aebb665 Let's connect
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33427
diff changeset
330 * @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
331 */
33425
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
332 const gchar * purple_http_response_get_error(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 length.
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 * @param response The response.
33430
013c5aebb665 Let's connect
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33427
diff changeset
338 * @return Data length;
33427
dd0c0860e293 Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33425
diff changeset
339 */
33425
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
340 gsize purple_http_response_get_data_len(PurpleHttpResponse *response);
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
341
33427
dd0c0860e293 Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33425
diff changeset
342 /**
dd0c0860e293 Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33425
diff changeset
343 * Gets HTTP response data.
dd0c0860e293 Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33425
diff changeset
344 *
dd0c0860e293 Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33425
diff changeset
345 * 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
346 *
dd0c0860e293 Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33425
diff changeset
347 * @param response The response.
33430
013c5aebb665 Let's connect
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33427
diff changeset
348 * @return The data.
33427
dd0c0860e293 Basic API and testing actions for it
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33425
diff changeset
349 */
33425
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
350 const gchar * purple_http_response_get_data(PurpleHttpResponse *response);
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 const GList * purple_http_response_get_all_headers(PurpleHttpResponse *response);
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 const GList * purple_http_response_get_headers_by_name(
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
355 PurpleHttpResponse *response, const gchar *name);
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 const gchar * purple_http_response_get_header(PurpleHttpResponse *response,
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
358 const gchar *name);
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
359
379bf9ad6973 Initial HTTP API definitions
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
360 /*@}*/
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 G_END_DECLS
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 #endif /* _PURPLE_HTTP_H_ */

mercurial