2 * This file Copyright (C) Mnemosyne LLC
4 * This file is licensed by the GPL version 2. Works owned by the
5 * Transmission project are granted a special exemption to clause 2(b)
6 * so that the bulk of its code can remain under the MIT license.
7 * This exemption does not extend to derived works not owned by
8 * the Transmission project.
10 * $Id: web.h 12539 2011-07-10 15:24:51Z jordan $
16 #include <curl/curl.h>
27 TR_WEB_GET_CODE
= CURLINFO_RESPONSE_CODE
,
28 TR_WEB_GET_REDIRECTS
= CURLINFO_REDIRECT_COUNT
,
29 TR_WEB_GET_REAL_URL
= CURLINFO_EFFECTIVE_URL
33 void tr_webInit( tr_session
* session
);
37 TR_WEB_CLOSE_WHEN_IDLE
,
42 void tr_webClose( tr_session
* session
, tr_web_close_mode close_mode
);
44 typedef void ( tr_web_done_func
)( tr_session
* session
,
46 bool did_connect_flag
,
48 const void * response
,
49 size_t response_byte_count
,
52 const char * tr_webGetResponseStr( long response_code
);
54 struct tr_web_task
* tr_webRun( tr_session
* session
,
58 tr_web_done_func done_func
,
59 void * done_func_user_data
);
63 struct tr_web_task
* tr_webRunWithBuffer( tr_session
* session
,
67 tr_web_done_func done_func
,
68 void * done_func_user_data
,
69 struct evbuffer
* buffer
);
71 void tr_webGetTaskInfo( struct tr_web_task
* task
, tr_web_task_info info
, void * dst
);
73 void tr_http_escape( struct evbuffer
*out
, const char *str
, int len
, bool escape_slashes
);
75 void tr_http_escape_sha1( char * out
, const uint8_t * sha1_digest
);
77 char* tr_http_unescape( const char * str
, int len
);