Fix some functions descriptions
[pidgin-git.git] / libpurple / http.h
blob2e0ae526da485872a18cd66aa01f3b25a409860f
1 /* purple
3 * Purple is the legal property of its developers, whose names are too numerous
4 * to list here. Please refer to the COPYRIGHT file distributed with this
5 * source distribution.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
22 #ifndef _PURPLE_HTTP_H_
23 #define _PURPLE_HTTP_H_
24 /**
25 * SECTION:http
26 * @section_id: libpurple-http
27 * @short_description: <filename>http.h</filename>
28 * @title: HTTP API
31 #include <glib.h>
33 #include "connection.h"
35 /**
36 * PurpleHttpRequest:
38 * A structure containing all data required to generate a single HTTP request.
40 typedef struct _PurpleHttpRequest PurpleHttpRequest;
42 /**
43 * PurpleHttpConnection:
45 * A representation of actually running HTTP request. Can be used to cancel the
46 * request.
48 typedef struct _PurpleHttpConnection PurpleHttpConnection;
50 /**
51 * PurpleHttpResponse:
53 * All information got with response for HTTP request.
55 typedef struct _PurpleHttpResponse PurpleHttpResponse;
57 /**
58 * PurpleHttpURL:
60 * Parsed representation for the URL.
62 typedef struct _PurpleHttpURL PurpleHttpURL;
64 /**
65 * PurpleHttpCookieJar:
67 * An collection of cookies, got from HTTP response or provided for HTTP
68 * request.
70 typedef struct _PurpleHttpCookieJar PurpleHttpCookieJar;
72 /**
73 * PurpleHttpKeepalivePool:
75 * A pool of TCP connections for HTTP Keep-Alive session.
77 typedef struct _PurpleHttpKeepalivePool PurpleHttpKeepalivePool;
79 /**
80 * PurpleHttpConnectionSet:
82 * A set of running HTTP requests. Can be used to cancel all of them at once.
84 typedef struct _PurpleHttpConnectionSet PurpleHttpConnectionSet;
86 /**
87 * PurpleHttpCallback:
89 * An callback called after performing (successfully or not) HTTP request.
91 typedef void (*PurpleHttpCallback)(PurpleHttpConnection *http_conn,
92 PurpleHttpResponse *response, gpointer user_data);
94 /**
95 * PurpleHttpContentReaderCb:
97 * An callback called after storing data requested by PurpleHttpContentReader.
99 typedef void (*PurpleHttpContentReaderCb)(PurpleHttpConnection *http_conn,
100 gboolean success, gboolean eof, size_t stored);
103 * PurpleHttpContentReader:
104 * @http_conn: Connection, which requests data.
105 * @buffer: Buffer to store data to (with offset ignored).
106 * @offset: Position, from where to read data.
107 * @length: Length of data to read.
108 * @user_data: The user data passed with callback function.
109 * @cb: The function to call after storing data to buffer.
111 * An callback for getting large request contents (ie. from file stored on
112 * disk).
114 typedef void (*PurpleHttpContentReader)(PurpleHttpConnection *http_conn,
115 gchar *buffer, size_t offset, size_t length, gpointer user_data,
116 PurpleHttpContentReaderCb cb);
119 * PurpleHttpContentWriter:
120 * @http_conn: Connection, which requests data.
121 * @response: Response at point got so far (may change later).
122 * @buffer: Buffer to read data from (with offset ignored).
123 * @offset: Position of data got (its value is offset + length of
124 * previous call), can be safely ignored.
125 * @length: Length of data read.
126 * @user_data: The user data passed with callback function.
128 * An callback for writting large response contents.
130 * Returns: TRUE, if succeeded, FALSE otherwise.
132 typedef gboolean (*PurpleHttpContentWriter)(PurpleHttpConnection *http_conn,
133 PurpleHttpResponse *response, const gchar *buffer, size_t offset,
134 size_t length, gpointer user_data);
137 * PurpleHttpProgressWatcher:
138 * @http_conn: The HTTP Connection.
139 * @reading_state: FALSE, is we are sending the request, TRUE, when reading
140 * the response.
141 * @processed: The amount of data already processed.
142 * @total: Total amount of data (in current state).
143 * @user_data: The user data passed with callback function.
145 * An callback for watching HTTP connection progress.
147 typedef void (*PurpleHttpProgressWatcher)(PurpleHttpConnection *http_conn,
148 gboolean reading_state, int processed, int total, gpointer user_data);
150 G_BEGIN_DECLS
152 /**************************************************************************/
153 /* Performing HTTP requests */
154 /**************************************************************************/
157 * purple_http_get:
158 * @gc: The connection for which the request is needed, or NULL.
159 * @callback: (scope call): The callback function.
160 * @user_data: The user data to pass to the callback function.
161 * @url: The URL.
163 * Fetches the data from a URL with GET request, and passes it to a callback
164 * function.
166 * Returns: The HTTP connection struct.
168 PurpleHttpConnection * purple_http_get(PurpleConnection *gc,
169 PurpleHttpCallback callback, gpointer user_data, const gchar *url);
172 * purple_http_get_printf:
173 * @gc: The connection for which the request is needed, or NULL.
174 * @callback: (scope call): The callback function.
175 * @user_data: The user data to pass to the callback function.
176 * @format: The format string.
178 * Constructs an URL and fetches the data from it with GET request, then passes
179 * it to a callback function.
181 * Returns: The HTTP connection struct.
183 PurpleHttpConnection * purple_http_get_printf(PurpleConnection *gc,
184 PurpleHttpCallback callback, gpointer user_data,
185 const gchar *format, ...) G_GNUC_PRINTF(4, 5);
188 * purple_http_request:
189 * @gc: The connection for which the request is needed, or NULL.
190 * @request: The request.
191 * @callback: (scope call): The callback function.
192 * @user_data: The user data to pass to the callback function.
194 * Fetches a HTTP request and passes the response to a callback function.
195 * Provided request struct can be shared by multiple http requests but can not
196 * be modified when any of these is running.
198 * Returns: The HTTP connection struct.
200 PurpleHttpConnection * purple_http_request(PurpleConnection *gc,
201 PurpleHttpRequest *request, PurpleHttpCallback callback,
202 gpointer user_data);
204 /**************************************************************************/
205 /* HTTP connection API */
206 /**************************************************************************/
209 * purple_http_conn_cancel:
210 * @http_conn: The data returned when you initiated the HTTP request.
212 * Cancel a pending HTTP request.
214 void purple_http_conn_cancel(PurpleHttpConnection *http_conn);
217 * purple_http_conn_cancel_all:
218 * @gc: The handle.
220 * Cancels all HTTP connections associated with the specified handle.
222 void purple_http_conn_cancel_all(PurpleConnection *gc);
225 * purple_http_conn_is_running:
226 * @http_conn: The HTTP connection (may be invalid pointer).
228 * Checks, if provided HTTP request is running.
230 * Returns: TRUE, if provided connection is currently running.
232 gboolean purple_http_conn_is_running(PurpleHttpConnection *http_conn);
235 * purple_http_conn_get_request:
236 * @http_conn: The HTTP connection.
238 * Gets PurpleHttpRequest used for specified HTTP connection.
240 * Returns: The PurpleHttpRequest object.
242 PurpleHttpRequest * purple_http_conn_get_request(
243 PurpleHttpConnection *http_conn);
246 * purple_http_conn_get_cookie_jar:
247 * @http_conn: The HTTP connection.
249 * Gets cookie jar used within connection.
251 * Returns: The cookie jar.
253 PurpleHttpCookieJar * purple_http_conn_get_cookie_jar(
254 PurpleHttpConnection *http_conn);
257 * purple_http_conn_get_purple_connection:
258 * @http_conn: The HTTP connection.
260 * Gets PurpleConnection tied with specified HTTP connection.
262 * Returns: The PurpleConnection object.
264 PurpleConnection * purple_http_conn_get_purple_connection(
265 PurpleHttpConnection *http_conn);
268 * purple_http_conn_set_progress_watcher:
269 * @http_conn: The HTTP connection.
270 * @watcher: (scope call): The watcher.
271 * @user_data: The user data to pass to the callback function.
272 * @interval_threshold: Minimum interval (in microseconds) of calls to
273 * watcher, or -1 for default.
275 * Sets the watcher, called after writing or reading data to/from HTTP stream.
276 * May be used for updating transfer progress gauge.
278 void purple_http_conn_set_progress_watcher(PurpleHttpConnection *http_conn,
279 PurpleHttpProgressWatcher watcher, gpointer user_data,
280 gint interval_threshold);
283 /**************************************************************************/
284 /* URL processing API */
285 /**************************************************************************/
288 * purple_http_url_parse:
289 * @url: The URL to parse.
291 * Parses a URL.
293 * The returned data must be freed with purple_http_url_free.
295 * Returns: The parsed url or NULL, if the URL is invalid.
297 PurpleHttpURL *
298 purple_http_url_parse(const char *url);
301 * purple_http_url_free:
302 * @parsed_url: The parsed URL struct, or NULL.
304 * Frees the parsed URL struct.
306 void
307 purple_http_url_free(PurpleHttpURL *parsed_url);
310 * purple_http_url_relative:
311 * @base_url: The base URL. The result is stored here.
312 * @relative_url: The relative URL.
314 * Converts the base URL to the absolute form of the provided relative URL.
316 * Example: "https://example.com/path/to/file.html" + "subdir/other-file.html" =
317 * "https://example.com/path/to/subdir/another-file.html"
319 void
320 purple_http_url_relative(PurpleHttpURL *base_url, PurpleHttpURL *relative_url);
323 * purple_http_url_print:
324 * @parsed_url: The URL struct.
326 * Converts the URL struct to the printable form. The result may not be a valid
327 * URL (in cases, when the struct doesn't have all fields filled properly).
329 * The result must be g_free'd.
331 * Returns: The printable form of the URL.
333 gchar *
334 purple_http_url_print(PurpleHttpURL *parsed_url);
337 * purple_http_url_get_protocol:
338 * @parsed_url: The URL struct.
340 * Gets the protocol part of URL.
342 * Returns: The protocol.
344 const gchar *
345 purple_http_url_get_protocol(const PurpleHttpURL *parsed_url);
348 * purple_http_url_get_username:
349 * @parsed_url: The URL struct.
351 * Gets the username part of URL.
353 * Returns: The username.
355 const gchar *
356 purple_http_url_get_username(const PurpleHttpURL *parsed_url);
359 * purple_http_url_get_password:
360 * @parsed_url: The URL struct.
362 * Gets the password part of URL.
364 * Returns: The password.
366 const gchar *
367 purple_http_url_get_password(const PurpleHttpURL *parsed_url);
370 * purple_http_url_get_host:
371 * @parsed_url: The URL struct.
373 * Gets the hostname part of URL.
375 * Returns: The hostname.
377 const gchar *
378 purple_http_url_get_host(const PurpleHttpURL *parsed_url);
381 * purple_http_url_get_port:
382 * @parsed_url: The URL struct.
384 * Gets the port part of URL.
386 * Returns: The port number.
389 purple_http_url_get_port(const PurpleHttpURL *parsed_url);
392 * purple_http_url_get_path:
393 * @parsed_url: The URL struct.
395 * Gets the path part of URL.
397 * Returns: The path.
399 const gchar *
400 purple_http_url_get_path(const PurpleHttpURL *parsed_url);
403 * purple_http_url_get_fragment:
404 * @parsed_url: The URL struct.
406 * Gets the fragment part of URL.
408 * Returns: The fragment.
410 const gchar *
411 purple_http_url_get_fragment(const PurpleHttpURL *parsed_url);
414 /**************************************************************************/
415 /* Cookie jar API */
416 /**************************************************************************/
419 * purple_http_cookie_jar_new:
421 * Creates new cookie jar,
423 * Returns: empty cookie jar.
425 PurpleHttpCookieJar * purple_http_cookie_jar_new(void);
428 * purple_http_cookie_jar_ref:
429 * @cookie_jar: The cookie jar.
431 * Increment the reference count.
433 void purple_http_cookie_jar_ref(PurpleHttpCookieJar *cookie_jar);
436 * purple_http_cookie_jar_unref:
437 * @cookie_jar: The cookie jar.
439 * Decrement the reference count.
441 * If the reference count reaches zero, the cookie jar will be freed.
443 * Returns: @cookie_jar or %NULL if the reference count reached zero.
445 PurpleHttpCookieJar * purple_http_cookie_jar_unref(
446 PurpleHttpCookieJar *cookie_jar);
449 * purple_http_cookie_jar_set:
450 * @cookie_jar: The cookie jar.
451 * @name: Cookie name.
452 * @value: Cookie contents.
454 * Sets the cookie.
456 void purple_http_cookie_jar_set(PurpleHttpCookieJar *cookie_jar,
457 const gchar *name, const gchar *value);
460 * purple_http_cookie_jar_get:
461 * @cookie_jar: The cookie jar.
462 * @name: Cookie name.
464 * Gets the cookie.
466 * The result must be g_free'd.
468 * Returns: Cookie contents, or NULL, if cookie doesn't exists.
470 gchar * purple_http_cookie_jar_get(PurpleHttpCookieJar *cookie_jar,
471 const gchar *name);
474 * purple_http_cookie_jar_is_empty:
475 * @cookie_jar: The cookie jar.
477 * Checks, if the cookie jar contains any cookies.
479 * Returns: TRUE, if cookie jar contains any cookie, FALSE otherwise.
481 gboolean purple_http_cookie_jar_is_empty(PurpleHttpCookieJar *cookie_jar);
484 /**************************************************************************/
485 /* HTTP Request API */
486 /**************************************************************************/
489 * purple_http_request_new:
490 * @url: The URL to request for, or NULL to leave empty (to be set with
491 * purple_http_request_set_url).
493 * Creates the new instance of HTTP request configuration.
495 * Returns: The new instance of HTTP request struct.
497 PurpleHttpRequest * purple_http_request_new(const gchar *url);
500 * purple_http_request_ref:
501 * @request: The request.
503 * Increment the reference count.
505 void purple_http_request_ref(PurpleHttpRequest *request);
508 * purple_http_request_unref:
509 * @request: The request.
511 * Decrement the reference count.
513 * If the reference count reaches zero, the http request struct will be freed.
515 * Returns: @request or %NULL if the reference count reached zero.
517 PurpleHttpRequest * purple_http_request_unref(PurpleHttpRequest *request);
520 * purple_http_request_set_url:
521 * @request: The request.
522 * @url: The url.
524 * Sets URL for HTTP request.
526 void purple_http_request_set_url(PurpleHttpRequest *request, const gchar *url);
529 * purple_http_request_set_url_printf:
530 * @request: The request.
531 * @format: The format string.
533 * Constructs and sets an URL for HTTP request.
535 void purple_http_request_set_url_printf(PurpleHttpRequest *request,
536 const gchar *format, ...) G_GNUC_PRINTF(2, 3);
539 * purple_http_request_get_url:
540 * @request: The request.
542 * Gets URL set for the HTTP request.
544 * Returns: URL set for this request.
546 const gchar * purple_http_request_get_url(PurpleHttpRequest *request);
549 * purple_http_request_set_method:
550 * @request: The request.
551 * @method: The method, or NULL for default.
553 * Sets custom HTTP method used for the request.
555 void purple_http_request_set_method(PurpleHttpRequest *request,
556 const gchar *method);
559 * purple_http_request_get_method:
560 * @request: The request.
562 * Gets HTTP method set for the request.
564 * Returns: The method.
566 const gchar * purple_http_request_get_method(PurpleHttpRequest *request);
569 * purple_http_request_set_keepalive_pool:
570 * @request: The request.
571 * @pool: The new KeepAlive pool, or NULL to reset.
573 * Sets HTTP KeepAlive connections pool for the request.
575 * It increases pool's reference count.
577 void
578 purple_http_request_set_keepalive_pool(PurpleHttpRequest *request,
579 PurpleHttpKeepalivePool *pool);
582 * purple_http_request_get_keepalive_pool:
583 * @request: The request.
585 * Gets HTTP KeepAlive connections pool associated with the request.
587 * It doesn't affect pool's reference count.
589 * Returns: The KeepAlive pool, used for the request.
591 PurpleHttpKeepalivePool *
592 purple_http_request_get_keepalive_pool(PurpleHttpRequest *request);
595 * purple_http_request_set_contents:
596 * @request: The request.
597 * @contents: The contents.
598 * @length: The length of contents (-1 if it's a NULL-terminated string)
600 * Sets contents of HTTP request (for example, POST data).
602 void purple_http_request_set_contents(PurpleHttpRequest *request,
603 const gchar *contents, int length);
606 * purple_http_request_set_contents_reader:
607 * @request: The request.
608 * @reader: (scope call): The reader callback.
609 * @contents_length: The size of all contents.
610 * @user_data: The user data to pass to the callback function.
612 * Sets contents reader for HTTP request, used mainly for possible large
613 * uploads.
615 void purple_http_request_set_contents_reader(PurpleHttpRequest *request,
616 PurpleHttpContentReader reader, int contents_length, gpointer user_data);
619 * purple_http_request_set_response_writer:
620 * @request: The request.
621 * @writer: (scope call): The writer callback, or %NULL to remove existing.
622 * @user_data: The user data to pass to the callback function.
624 * Set contents writer for HTTP response.
626 void purple_http_request_set_response_writer(PurpleHttpRequest *request,
627 PurpleHttpContentWriter writer, gpointer user_data);
630 * purple_http_request_set_timeout:
631 * @request: The request.
632 * @timeout: Time (in seconds) after that timeout will be cancelled,
633 * -1 for infinite time.
635 * Set maximum amount of time, that request is allowed to run.
637 void purple_http_request_set_timeout(PurpleHttpRequest *request, int timeout);
640 * purple_http_request_get_timeout:
641 * @request: The request.
643 * Get maximum amount of time, that request is allowed to run.
645 * Returns: Timeout currently set (-1 for infinite).
647 int purple_http_request_get_timeout(PurpleHttpRequest *request);
650 * purple_http_request_set_max_redirects:
651 * @request: The request.
652 * @max_redirects: Maximum amount of redirects, or -1 for unlimited.
654 * Sets maximum amount of redirects.
656 void purple_http_request_set_max_redirects(PurpleHttpRequest *request,
657 int max_redirects);
660 * purple_http_request_get_max_redirects:
661 * @request: The request.
663 * Gets maximum amount of redirects.
665 * Returns: Current maximum amount of redirects (-1 for unlimited).
667 int purple_http_request_get_max_redirects(PurpleHttpRequest *request);
670 * purple_http_request_set_cookie_jar:
671 * @request: The request.
672 * @cookie_jar: The cookie jar.
674 * Sets cookie jar used for the request.
676 void purple_http_request_set_cookie_jar(PurpleHttpRequest *request,
677 PurpleHttpCookieJar *cookie_jar);
680 * purple_http_request_get_cookie_jar:
681 * @request: The request.
683 * Gets cookie jar used for the request.
685 * Returns: The cookie jar.
687 PurpleHttpCookieJar * purple_http_request_get_cookie_jar(
688 PurpleHttpRequest *request);
691 * purple_http_request_set_http11:
692 * @request: The request.
693 * @http11: TRUE for HTTP/1.1, FALSE for HTTP/1.0.
695 * Sets HTTP version to use.
697 void purple_http_request_set_http11(PurpleHttpRequest *request,
698 gboolean http11);
701 * purple_http_request_is_http11:
702 * @request: The request.
704 * Gets used HTTP version.
706 * Returns: TRUE, if we use HTTP/1.1, FALSE for HTTP/1.0.
708 gboolean purple_http_request_is_http11(PurpleHttpRequest *request);
711 * purple_http_request_set_max_len:
712 * @request: The request.
713 * @max_len: Maximum length of response to read (-1 for the maximum
714 * supported amount).
716 * Sets maximum length of response content to read.
718 * Headers length doesn't count here.
721 void purple_http_request_set_max_len(PurpleHttpRequest *request, int max_len);
724 * purple_http_request_get_max_len:
725 * @request: The request.
727 * Gets maximum length of response content to read.
729 * Returns: Maximum length of response to read, or -1 if unlimited.
731 int purple_http_request_get_max_len(PurpleHttpRequest *request);
734 * purple_http_request_header_set:
735 * @request: The request.
736 * @key: A header to be set.
737 * @value: A value to set, or NULL to remove specified header.
739 * Sets (replaces, if exists) specified HTTP request header with provided value.
741 * See purple_http_request_header_add().
743 void purple_http_request_header_set(PurpleHttpRequest *request,
744 const gchar *key, const gchar *value);
747 * purple_http_request_header_set_printf:
748 * @request: The request.
749 * @key: A header to be set.
750 * @format: The format string.
752 * Constructs and sets (replaces, if exists) specified HTTP request header.
754 void purple_http_request_header_set_printf(PurpleHttpRequest *request,
755 const gchar *key, const gchar *format, ...) G_GNUC_PRINTF(3, 4);
758 * purple_http_request_header_add:
759 * @key: A header to be set.
760 * @value: A value to set.
762 * Adds (without replacing, if exists) an HTTP request header.
764 * See purple_http_request_header_set().
766 void purple_http_request_header_add(PurpleHttpRequest *request,
767 const gchar *key, const gchar *value);
770 /**************************************************************************/
771 /* HTTP Keep-Alive pool API */
772 /**************************************************************************/
775 * purple_http_keepalive_pool_new:
777 * Creates a new HTTP Keep-Alive pool.
779 PurpleHttpKeepalivePool *
780 purple_http_keepalive_pool_new(void);
783 * purple_http_keepalive_pool_ref:
784 * @pool: The HTTP Keep-Alive pool.
786 * Increment the reference count.
788 void
789 purple_http_keepalive_pool_ref(PurpleHttpKeepalivePool *pool);
792 * purple_http_keepalive_pool_unref:
793 * @pool: The HTTP Keep-Alive pool.
795 * Decrement the reference count.
797 * If the reference count reaches zero, the pool will be freed and all
798 * connections will be closed.
800 * Returns: @pool or %NULL if the reference count reached zero.
802 PurpleHttpKeepalivePool *
803 purple_http_keepalive_pool_unref(PurpleHttpKeepalivePool *pool);
806 * purple_http_keepalive_pool_set_limit_per_host:
807 * @pool: The HTTP Keep-Alive pool.
808 * @limit: The new limit, 0 for unlimited.
810 * Sets maximum allowed number of connections to specific host-triple (is_ssl +
811 * hostname + port).
813 void
814 purple_http_keepalive_pool_set_limit_per_host(PurpleHttpKeepalivePool *pool,
815 guint limit);
818 * purple_http_keepalive_pool_get_limit_per_host:
819 * @pool: The HTTP Keep-Alive pool.
821 * Gets maximum allowed number of connections to specific host-triple (is_ssl +
822 * hostname + port).
824 * Returns: The limit.
826 guint
827 purple_http_keepalive_pool_get_limit_per_host(PurpleHttpKeepalivePool *pool);
830 /**************************************************************************/
831 /* HTTP connection set API */
832 /**************************************************************************/
834 PurpleHttpConnectionSet *
835 purple_http_connection_set_new(void);
837 void
838 purple_http_connection_set_destroy(PurpleHttpConnectionSet *set);
840 void
841 purple_http_connection_set_add(PurpleHttpConnectionSet *set,
842 PurpleHttpConnection *http_conn);
845 /**************************************************************************/
846 /* HTTP response API */
847 /**************************************************************************/
850 * purple_http_response_is_successful:
851 * @response: The response.
853 * Checks, if HTTP request was performed successfully.
855 * Returns: TRUE, if request was performed successfully.
857 gboolean purple_http_response_is_successful(PurpleHttpResponse *response);
860 * purple_http_response_get_code:
861 * @response: The response.
863 * Gets HTTP response code.
865 * Returns: HTTP response code.
867 int purple_http_response_get_code(PurpleHttpResponse *response);
870 * purple_http_response_get_error:
871 * @response: The response.
873 * Gets error description.
875 * Returns: Localized error description or NULL, if there was no error.
877 const gchar * purple_http_response_get_error(PurpleHttpResponse *response);
880 * purple_http_response_get_data_len:
881 * @response: The response.
883 * Gets HTTP response data length.
885 * Returns: Data length;
887 gsize purple_http_response_get_data_len(PurpleHttpResponse *response);
890 * purple_http_response_get_data:
891 * @response: The response.
892 * @len: Return address for the size of the data. Can be NULL.
894 * Gets HTTP response data.
896 * Response data is not written, if writer callback was set for request.
898 * Returns: The data.
900 const gchar * purple_http_response_get_data(PurpleHttpResponse *response, size_t *len);
903 * purple_http_response_get_all_headers:
904 * @response: The response.
906 * Gets all headers got with response.
908 * Returns: GList of PurpleKeyValuePair, which keys are header field
909 * names (gchar*) and values are its contents (gchar*).
911 const GList * purple_http_response_get_all_headers(PurpleHttpResponse *response);
914 * purple_http_response_get_headers_by_name:
915 * @response: The response.
916 * @name: The name of header field.
918 * Gets all headers with specified name got with response.
920 * Returns: GList of header field records contents (gchar*).
922 const GList * purple_http_response_get_headers_by_name(
923 PurpleHttpResponse *response, const gchar *name);
926 * purple_http_response_get_header:
927 * @response: The response.
928 * @name: The name of header field.
930 * Gets one header contents with specified name got with response.
932 * To get all headers with the same name, use
933 * purple_http_response_get_headers_by_name instead.
935 * Returns: Header field contents or NULL, if there is no such one.
937 const gchar * purple_http_response_get_header(PurpleHttpResponse *response,
938 const gchar *name);
941 /**************************************************************************/
942 /* HTTP Subsystem */
943 /**************************************************************************/
946 * purple_http_init:
948 * Initializes the http subsystem.
950 void purple_http_init(void);
953 * purple_http_uninit:
955 * Uninitializes the http subsystem.
957 void purple_http_uninit(void);
959 G_END_DECLS
961 #endif /* _PURPLE_HTTP_H_ */