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
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
26 * @section_id: libpurple-http
27 * @short_description: <filename>http.h</filename>
33 #include "connection.h"
38 * A structure containing all data required to generate a single HTTP request.
40 typedef struct _PurpleHttpRequest PurpleHttpRequest
;
43 * PurpleHttpConnection:
45 * A representation of actually running HTTP request. Can be used to cancel the
48 typedef struct _PurpleHttpConnection PurpleHttpConnection
;
53 * All information got with response for HTTP request.
55 typedef struct _PurpleHttpResponse PurpleHttpResponse
;
60 * Parsed representation for the URL.
62 typedef struct _PurpleHttpURL PurpleHttpURL
;
65 * PurpleHttpCookieJar:
67 * An collection of cookies, got from HTTP response or provided for HTTP
70 typedef struct _PurpleHttpCookieJar PurpleHttpCookieJar
;
73 * PurpleHttpKeepalivePool:
75 * A pool of TCP connections for HTTP Keep-Alive session.
77 typedef struct _PurpleHttpKeepalivePool PurpleHttpKeepalivePool
;
80 * PurpleHttpConnectionSet:
82 * A set of running HTTP requests. Can be used to cancel all of them at once.
84 typedef struct _PurpleHttpConnectionSet PurpleHttpConnectionSet
;
89 * An callback called after performing (successfully or not) HTTP request.
91 typedef void (*PurpleHttpCallback
)(PurpleHttpConnection
*http_conn
,
92 PurpleHttpResponse
*response
, gpointer user_data
);
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
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
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
);
152 /**************************************************************************/
153 /* Performing HTTP requests */
154 /**************************************************************************/
157 * purple_http_get: (skip)
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.
163 * Fetches the data from a URL with GET request, and passes it to a callback
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: (skip)
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.
177 * @...: The parameters to insert into the format string.
179 * Constructs an URL and fetches the data from it with GET request, then passes
180 * it to a callback function.
182 * Returns: The HTTP connection struct.
184 PurpleHttpConnection
* purple_http_get_printf(PurpleConnection
*gc
,
185 PurpleHttpCallback callback
, gpointer user_data
,
186 const gchar
*format
, ...) G_GNUC_PRINTF(4, 5);
189 * purple_http_request: (skip)
190 * @gc: The connection for which the request is needed, or NULL.
191 * @request: The request.
192 * @callback: (scope call): The callback function.
193 * @user_data: The user data to pass to the callback function.
195 * Fetches a HTTP request and passes the response to a callback function.
196 * Provided request struct can be shared by multiple http requests but can not
197 * be modified when any of these is running.
199 * Returns: The HTTP connection struct.
201 PurpleHttpConnection
* purple_http_request(PurpleConnection
*gc
,
202 PurpleHttpRequest
*request
, PurpleHttpCallback callback
,
205 /**************************************************************************/
206 /* HTTP connection API */
207 /**************************************************************************/
210 * purple_http_conn_cancel: (skip)
211 * @http_conn: The data returned when you initiated the HTTP request.
213 * Cancel a pending HTTP request.
215 void purple_http_conn_cancel(PurpleHttpConnection
*http_conn
);
218 * purple_http_conn_cancel_all: (skip)
221 * Cancels all HTTP connections associated with the specified handle.
223 void purple_http_conn_cancel_all(PurpleConnection
*gc
);
226 * purple_http_conn_is_running: (skip)
227 * @http_conn: The HTTP connection (may be invalid pointer).
229 * Checks, if provided HTTP request is running.
231 * Returns: TRUE, if provided connection is currently running.
233 gboolean
purple_http_conn_is_running(PurpleHttpConnection
*http_conn
);
236 * purple_http_conn_get_request: (skip)
237 * @http_conn: The HTTP connection.
239 * Gets PurpleHttpRequest used for specified HTTP connection.
241 * Returns: The PurpleHttpRequest object.
243 PurpleHttpRequest
* purple_http_conn_get_request(
244 PurpleHttpConnection
*http_conn
);
247 * purple_http_conn_get_cookie_jar: (skip)
248 * @http_conn: The HTTP connection.
250 * Gets cookie jar used within connection.
252 * Returns: The cookie jar.
254 PurpleHttpCookieJar
* purple_http_conn_get_cookie_jar(
255 PurpleHttpConnection
*http_conn
);
258 * purple_http_conn_get_purple_connection: (skip)
259 * @http_conn: The HTTP connection.
261 * Gets PurpleConnection tied with specified HTTP connection.
263 * Returns: The PurpleConnection object.
265 PurpleConnection
* purple_http_conn_get_purple_connection(
266 PurpleHttpConnection
*http_conn
);
269 * purple_http_conn_set_progress_watcher: (skip)
270 * @http_conn: The HTTP connection.
271 * @watcher: (scope call): The watcher.
272 * @user_data: The user data to pass to the callback function.
273 * @interval_threshold: Minimum interval (in microseconds) of calls to
274 * watcher, or -1 for default.
276 * Sets the watcher, called after writing or reading data to/from HTTP stream.
277 * May be used for updating transfer progress gauge.
279 void purple_http_conn_set_progress_watcher(PurpleHttpConnection
*http_conn
,
280 PurpleHttpProgressWatcher watcher
, gpointer user_data
,
281 gint interval_threshold
);
284 /**************************************************************************/
285 /* URL processing API */
286 /**************************************************************************/
289 * purple_http_url_parse: (skip)
290 * @url: The URL to parse.
294 * The returned data must be freed with purple_http_url_free.
296 * Returns: The parsed url or NULL, if the URL is invalid.
299 purple_http_url_parse(const char *url
);
302 * purple_http_url_free: (skip)
303 * @parsed_url: The parsed URL struct, or NULL.
305 * Frees the parsed URL struct.
308 purple_http_url_free(PurpleHttpURL
*parsed_url
);
311 * purple_http_url_relative: (skip)
312 * @base_url: The base URL. The result is stored here.
313 * @relative_url: The relative URL.
315 * Converts the base URL to the absolute form of the provided relative URL.
317 * Example: "https://example.com/path/to/file.html" + "subdir/other-file.html" =
318 * "https://example.com/path/to/subdir/another-file.html"
321 purple_http_url_relative(PurpleHttpURL
*base_url
, PurpleHttpURL
*relative_url
);
324 * purple_http_url_print: (skip)
325 * @parsed_url: The URL struct.
327 * Converts the URL struct to the printable form. The result may not be a valid
328 * URL (in cases, when the struct doesn't have all fields filled properly).
330 * The result must be g_free'd.
332 * Returns: The printable form of the URL.
335 purple_http_url_print(PurpleHttpURL
*parsed_url
);
338 * purple_http_url_get_protocol: (skip)
339 * @parsed_url: The URL struct.
341 * Gets the protocol part of URL.
343 * Returns: The protocol.
346 purple_http_url_get_protocol(const PurpleHttpURL
*parsed_url
);
349 * purple_http_url_get_username: (skip)
350 * @parsed_url: The URL struct.
352 * Gets the username part of URL.
354 * Returns: The username.
357 purple_http_url_get_username(const PurpleHttpURL
*parsed_url
);
360 * purple_http_url_get_password: (skip)
361 * @parsed_url: The URL struct.
363 * Gets the password part of URL.
365 * Returns: The password.
368 purple_http_url_get_password(const PurpleHttpURL
*parsed_url
);
371 * purple_http_url_get_host: (skip)
372 * @parsed_url: The URL struct.
374 * Gets the hostname part of URL.
376 * Returns: The hostname.
379 purple_http_url_get_host(const PurpleHttpURL
*parsed_url
);
382 * purple_http_url_get_port: (skip)
383 * @parsed_url: The URL struct.
385 * Gets the port part of URL.
387 * Returns: The port number.
390 purple_http_url_get_port(const PurpleHttpURL
*parsed_url
);
393 * purple_http_url_get_path: (skip)
394 * @parsed_url: The URL struct.
396 * Gets the path part of URL.
401 purple_http_url_get_path(const PurpleHttpURL
*parsed_url
);
404 * purple_http_url_get_fragment: (skip)
405 * @parsed_url: The URL struct.
407 * Gets the fragment part of URL.
409 * Returns: The fragment.
412 purple_http_url_get_fragment(const PurpleHttpURL
*parsed_url
);
415 /**************************************************************************/
417 /**************************************************************************/
420 * purple_http_cookie_jar_new: (skip)
422 * Creates new cookie jar,
424 * Returns: empty cookie jar.
426 PurpleHttpCookieJar
* purple_http_cookie_jar_new(void);
429 * purple_http_cookie_jar_ref: (skip)
430 * @cookie_jar: The cookie jar.
432 * Increment the reference count.
434 void purple_http_cookie_jar_ref(PurpleHttpCookieJar
*cookie_jar
);
437 * purple_http_cookie_jar_unref: (skip)
438 * @cookie_jar: The cookie jar.
440 * Decrement the reference count.
442 * If the reference count reaches zero, the cookie jar will be freed.
444 * Returns: @cookie_jar or %NULL if the reference count reached zero.
446 PurpleHttpCookieJar
* purple_http_cookie_jar_unref(
447 PurpleHttpCookieJar
*cookie_jar
);
450 * purple_http_cookie_jar_set: (skip)
451 * @cookie_jar: The cookie jar.
452 * @name: Cookie name.
453 * @value: Cookie contents.
457 void purple_http_cookie_jar_set(PurpleHttpCookieJar
*cookie_jar
,
458 const gchar
*name
, const gchar
*value
);
461 * purple_http_cookie_jar_get: (skip)
462 * @cookie_jar: The cookie jar.
463 * @name: Cookie name.
467 * The result must be g_free'd.
469 * Returns: Cookie contents, or NULL, if cookie doesn't exists.
471 gchar
* purple_http_cookie_jar_get(PurpleHttpCookieJar
*cookie_jar
,
475 * purple_http_cookie_jar_is_empty: (skip)
476 * @cookie_jar: The cookie jar.
478 * Checks, if the cookie jar contains any cookies.
480 * Returns: TRUE, if cookie jar contains any cookie, FALSE otherwise.
482 gboolean
purple_http_cookie_jar_is_empty(PurpleHttpCookieJar
*cookie_jar
);
485 /**************************************************************************/
486 /* HTTP Request API */
487 /**************************************************************************/
490 * purple_http_request_new: (skip)
491 * @url: The URL to request for, or NULL to leave empty (to be set with
492 * purple_http_request_set_url).
494 * Creates the new instance of HTTP request configuration.
496 * Returns: The new instance of HTTP request struct.
498 PurpleHttpRequest
* purple_http_request_new(const gchar
*url
);
501 * purple_http_request_ref: (skip)
502 * @request: The request.
504 * Increment the reference count.
506 void purple_http_request_ref(PurpleHttpRequest
*request
);
509 * purple_http_request_unref: (skip)
510 * @request: The request.
512 * Decrement the reference count.
514 * If the reference count reaches zero, the http request struct will be freed.
516 * Returns: @request or %NULL if the reference count reached zero.
518 PurpleHttpRequest
* purple_http_request_unref(PurpleHttpRequest
*request
);
521 * purple_http_request_set_url: (skip)
522 * @request: The request.
525 * Sets URL for HTTP request.
527 void purple_http_request_set_url(PurpleHttpRequest
*request
, const gchar
*url
);
530 * purple_http_request_set_url_printf: (skip)
531 * @request: The request.
532 * @format: The format string.
533 * @...: The parameters to insert into the format string.
535 * Constructs and sets an URL for HTTP request.
537 void purple_http_request_set_url_printf(PurpleHttpRequest
*request
,
538 const gchar
*format
, ...) G_GNUC_PRINTF(2, 3);
541 * purple_http_request_get_url: (skip)
542 * @request: The request.
544 * Gets URL set for the HTTP request.
546 * Returns: URL set for this request.
548 const gchar
* purple_http_request_get_url(PurpleHttpRequest
*request
);
551 * purple_http_request_set_method: (skip)
552 * @request: The request.
553 * @method: The method, or NULL for default.
555 * Sets custom HTTP method used for the request.
557 void purple_http_request_set_method(PurpleHttpRequest
*request
,
558 const gchar
*method
);
561 * purple_http_request_get_method: (skip)
562 * @request: The request.
564 * Gets HTTP method set for the request.
566 * Returns: The method.
568 const gchar
* purple_http_request_get_method(PurpleHttpRequest
*request
);
571 * purple_http_request_set_keepalive_pool: (skip)
572 * @request: The request.
573 * @pool: The new KeepAlive pool, or NULL to reset.
575 * Sets HTTP KeepAlive connections pool for the request.
577 * It increases pool's reference count.
580 purple_http_request_set_keepalive_pool(PurpleHttpRequest
*request
,
581 PurpleHttpKeepalivePool
*pool
);
584 * purple_http_request_get_keepalive_pool: (skip)
585 * @request: The request.
587 * Gets HTTP KeepAlive connections pool associated with the request.
589 * It doesn't affect pool's reference count.
591 * Returns: The KeepAlive pool, used for the request.
593 PurpleHttpKeepalivePool
*
594 purple_http_request_get_keepalive_pool(PurpleHttpRequest
*request
);
597 * purple_http_request_set_contents: (skip)
598 * @request: The request.
599 * @contents: The contents.
600 * @length: The length of contents (-1 if it's a NULL-terminated string)
602 * Sets contents of HTTP request (for example, POST data).
604 void purple_http_request_set_contents(PurpleHttpRequest
*request
,
605 const gchar
*contents
, int length
);
608 * purple_http_request_set_contents_reader: (skip)
609 * @request: The request.
610 * @reader: (scope call): The reader callback.
611 * @contents_length: The size of all contents.
612 * @user_data: The user data to pass to the callback function.
614 * Sets contents reader for HTTP request, used mainly for possible large
617 void purple_http_request_set_contents_reader(PurpleHttpRequest
*request
,
618 PurpleHttpContentReader reader
, int contents_length
, gpointer user_data
);
621 * purple_http_request_set_response_writer: (skip)
622 * @request: The request.
623 * @writer: (scope call): The writer callback, or %NULL to remove existing.
624 * @user_data: The user data to pass to the callback function.
626 * Set contents writer for HTTP response.
628 void purple_http_request_set_response_writer(PurpleHttpRequest
*request
,
629 PurpleHttpContentWriter writer
, gpointer user_data
);
632 * purple_http_request_set_timeout: (skip)
633 * @request: The request.
634 * @timeout: Time (in seconds) after that timeout will be cancelled,
635 * -1 for infinite time.
637 * Set maximum amount of time, that request is allowed to run.
639 void purple_http_request_set_timeout(PurpleHttpRequest
*request
, int timeout
);
642 * purple_http_request_get_timeout: (skip)
643 * @request: The request.
645 * Get maximum amount of time, that request is allowed to run.
647 * Returns: Timeout currently set (-1 for infinite).
649 int purple_http_request_get_timeout(PurpleHttpRequest
*request
);
652 * purple_http_request_set_max_redirects: (skip)
653 * @request: The request.
654 * @max_redirects: Maximum amount of redirects, or -1 for unlimited.
656 * Sets maximum amount of redirects.
658 void purple_http_request_set_max_redirects(PurpleHttpRequest
*request
,
662 * purple_http_request_get_max_redirects: (skip)
663 * @request: The request.
665 * Gets maximum amount of redirects.
667 * Returns: Current maximum amount of redirects (-1 for unlimited).
669 int purple_http_request_get_max_redirects(PurpleHttpRequest
*request
);
672 * purple_http_request_set_cookie_jar: (skip)
673 * @request: The request.
674 * @cookie_jar: The cookie jar.
676 * Sets cookie jar used for the request.
678 void purple_http_request_set_cookie_jar(PurpleHttpRequest
*request
,
679 PurpleHttpCookieJar
*cookie_jar
);
682 * purple_http_request_get_cookie_jar: (skip)
683 * @request: The request.
685 * Gets cookie jar used for the request.
687 * Returns: The cookie jar.
689 PurpleHttpCookieJar
* purple_http_request_get_cookie_jar(
690 PurpleHttpRequest
*request
);
693 * purple_http_request_set_http11: (skip)
694 * @request: The request.
695 * @http11: TRUE for HTTP/1.1, FALSE for HTTP/1.0.
697 * Sets HTTP version to use.
699 void purple_http_request_set_http11(PurpleHttpRequest
*request
,
703 * purple_http_request_is_http11: (skip)
704 * @request: The request.
706 * Gets used HTTP version.
708 * Returns: TRUE, if we use HTTP/1.1, FALSE for HTTP/1.0.
710 gboolean
purple_http_request_is_http11(PurpleHttpRequest
*request
);
713 * purple_http_request_set_max_len: (skip)
714 * @request: The request.
715 * @max_len: Maximum length of response to read (-1 for the maximum
718 * Sets maximum length of response content to read.
720 * Headers length doesn't count here.
723 void purple_http_request_set_max_len(PurpleHttpRequest
*request
, int max_len
);
726 * purple_http_request_get_max_len: (skip)
727 * @request: The request.
729 * Gets maximum length of response content to read.
731 * Returns: Maximum length of response to read, or -1 if unlimited.
733 int purple_http_request_get_max_len(PurpleHttpRequest
*request
);
736 * purple_http_request_header_set: (skip)
737 * @request: The request.
738 * @key: A header to be set.
739 * @value: A value to set, or NULL to remove specified header.
741 * Sets (replaces, if exists) specified HTTP request header with provided value.
743 * See purple_http_request_header_add().
745 void purple_http_request_header_set(PurpleHttpRequest
*request
,
746 const gchar
*key
, const gchar
*value
);
749 * purple_http_request_header_set_printf: (skip)
750 * @request: The request.
751 * @key: A header to be set.
752 * @format: The format string.
754 * Constructs and sets (replaces, if exists) specified HTTP request header.
756 void purple_http_request_header_set_printf(PurpleHttpRequest
*request
,
757 const gchar
*key
, const gchar
*format
, ...) G_GNUC_PRINTF(3, 4);
760 * purple_http_request_header_add: (skip)
761 * @request: The request.
762 * @key: A header to be set.
763 * @value: A value to set.
765 * Adds (without replacing, if exists) an HTTP request header.
767 * See purple_http_request_header_set().
769 void purple_http_request_header_add(PurpleHttpRequest
*request
,
770 const gchar
*key
, const gchar
*value
);
773 /**************************************************************************/
774 /* HTTP Keep-Alive pool API */
775 /**************************************************************************/
778 * purple_http_keepalive_pool_new: (skip)
780 * Creates a new HTTP Keep-Alive pool.
782 PurpleHttpKeepalivePool
*
783 purple_http_keepalive_pool_new(void);
786 * purple_http_keepalive_pool_ref: (skip)
787 * @pool: The HTTP Keep-Alive pool.
789 * Increment the reference count.
792 purple_http_keepalive_pool_ref(PurpleHttpKeepalivePool
*pool
);
795 * purple_http_keepalive_pool_unref: (skip)
796 * @pool: The HTTP Keep-Alive pool.
798 * Decrement the reference count.
800 * If the reference count reaches zero, the pool will be freed and all
801 * connections will be closed.
803 * Returns: @pool or %NULL if the reference count reached zero.
805 PurpleHttpKeepalivePool
*
806 purple_http_keepalive_pool_unref(PurpleHttpKeepalivePool
*pool
);
809 * purple_http_keepalive_pool_set_limit_per_host: (skip)
810 * @pool: The HTTP Keep-Alive pool.
811 * @limit: The new limit, 0 for unlimited.
813 * Sets maximum allowed number of connections to specific host-triple (is_ssl +
817 purple_http_keepalive_pool_set_limit_per_host(PurpleHttpKeepalivePool
*pool
,
821 * purple_http_keepalive_pool_get_limit_per_host: (skip)
822 * @pool: The HTTP Keep-Alive pool.
824 * Gets maximum allowed number of connections to specific host-triple (is_ssl +
827 * Returns: The limit.
830 purple_http_keepalive_pool_get_limit_per_host(PurpleHttpKeepalivePool
*pool
);
833 /**************************************************************************/
834 /* HTTP connection set API */
835 /**************************************************************************/
838 * purple_http_connection_set_new: (skip)
840 * Creates a new connection set.
842 * Returns: A new connection set.
844 PurpleHttpConnectionSet
*
845 purple_http_connection_set_new(void);
848 * purple_http_connection_set_destroy: (skip)
849 * @set: The connection set to be destroyed
851 * Destroys connection set @set.
854 purple_http_connection_set_destroy(PurpleHttpConnectionSet
*set
);
857 * purple_http_connection_set_add: (skip)
858 * @set: The connection set to add to
859 * @http_conn: The connection to add
861 * Adds @http_conn to @set.
864 purple_http_connection_set_add(PurpleHttpConnectionSet
*set
,
865 PurpleHttpConnection
*http_conn
);
868 /**************************************************************************/
869 /* HTTP response API */
870 /**************************************************************************/
873 * purple_http_response_is_successful: (skip)
874 * @response: The response.
876 * Checks, if HTTP request was performed successfully.
878 * Returns: TRUE, if request was performed successfully.
880 gboolean
purple_http_response_is_successful(PurpleHttpResponse
*response
);
883 * purple_http_response_get_code: (skip)
884 * @response: The response.
886 * Gets HTTP response code.
888 * Returns: HTTP response code.
890 int purple_http_response_get_code(PurpleHttpResponse
*response
);
893 * purple_http_response_get_error: (skip)
894 * @response: The response.
896 * Gets error description.
898 * Returns: Localized error description or NULL, if there was no error.
900 const gchar
* purple_http_response_get_error(PurpleHttpResponse
*response
);
903 * purple_http_response_get_data_len: (skip)
904 * @response: The response.
906 * Gets HTTP response data length.
908 * Returns: Data length;
910 gsize
purple_http_response_get_data_len(PurpleHttpResponse
*response
);
913 * purple_http_response_get_data: (skip)
914 * @response: The response.
915 * @len: Return address for the size of the data. Can be NULL.
917 * Gets HTTP response data.
919 * Response data is not written, if writer callback was set for request.
923 const gchar
* purple_http_response_get_data(PurpleHttpResponse
*response
, size_t *len
);
926 * purple_http_response_get_all_headers: (skip)
927 * @response: The response.
929 * Gets all headers got with response.
931 * Returns: (element-type PurpleKeyValuePair) (transfer none): Keys are header
932 * field names (gchar*) and values are its contents (gchar*).
934 const GList
* purple_http_response_get_all_headers(PurpleHttpResponse
*response
);
937 * purple_http_response_get_headers_by_name: (skip)
938 * @response: The response.
939 * @name: The name of header field.
941 * Gets all headers with specified name got with response.
943 * Returns: (element-type gchar*) (transfer none): Header field record contents.
945 const GList
* purple_http_response_get_headers_by_name(
946 PurpleHttpResponse
*response
, const gchar
*name
);
949 * purple_http_response_get_header: (skip)
950 * @response: The response.
951 * @name: The name of header field.
953 * Gets one header contents with specified name got with response.
955 * To get all headers with the same name, use
956 * purple_http_response_get_headers_by_name instead.
958 * Returns: Header field contents or NULL, if there is no such one.
960 const gchar
* purple_http_response_get_header(PurpleHttpResponse
*response
,
964 /**************************************************************************/
966 /**************************************************************************/
971 * Initializes the http subsystem.
973 void purple_http_init(void);
976 * purple_http_uninit:
978 * Uninitializes the http subsystem.
980 void purple_http_uninit(void);
984 #endif /* PURPLE_HTTP_H */