2008-04-24 01:42:53 +00:00
|
|
|
/*
|
2014-01-19 01:09:44 +00:00
|
|
|
* This file Copyright (C) 2008-2014 Mnemosyne LLC
|
2008-04-24 01:42:53 +00:00
|
|
|
*
|
2014-01-21 03:10:30 +00:00
|
|
|
* It may be used under the GNU GPL versions 2 or 3
|
2014-01-19 01:09:44 +00:00
|
|
|
* or any future license endorsed by Mnemosyne LLC.
|
2008-04-24 01:42:53 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2016-03-29 16:37:21 +00:00
|
|
|
#pragma once
|
2008-04-24 01:42:53 +00:00
|
|
|
|
2020-08-11 18:11:55 +00:00
|
|
|
#include "tr-macros.h"
|
|
|
|
|
|
|
|
TR_BEGIN_DECLS
|
2010-12-11 21:27:15 +00:00
|
|
|
|
2009-10-23 03:41:36 +00:00
|
|
|
struct tr_address;
|
2011-07-10 15:24:51 +00:00
|
|
|
struct tr_web_task;
|
|
|
|
|
2010-03-06 15:05:05 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
TR_WEB_CLOSE_WHEN_IDLE,
|
|
|
|
TR_WEB_CLOSE_NOW
|
|
|
|
}
|
|
|
|
tr_web_close_mode;
|
2008-04-25 19:46:36 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
void tr_webClose(tr_session* session, tr_web_close_mode close_mode);
|
2010-03-06 15:05:05 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
typedef void (* tr_web_done_func)(tr_session* session, bool did_connect_flag, bool timeout_flag, long response_code,
|
2017-04-20 16:02:19 +00:00
|
|
|
void const* response, size_t response_byte_count, void* user_data);
|
2008-04-25 04:26:04 +00:00
|
|
|
|
2017-04-20 16:02:19 +00:00
|
|
|
char const* tr_webGetResponseStr(long response_code);
|
2008-04-24 01:42:53 +00:00
|
|
|
|
2017-04-20 16:02:19 +00:00
|
|
|
struct tr_web_task* tr_webRun(tr_session* session, char const* url, tr_web_done_func done_func, void* done_func_user_data);
|
2008-04-24 01:42:53 +00:00
|
|
|
|
2017-04-20 16:02:19 +00:00
|
|
|
struct tr_web_task* tr_webRunWithCookies(tr_session* session, char const* url, char const* cookies, tr_web_done_func done_func,
|
2017-04-19 12:04:45 +00:00
|
|
|
void* done_func_user_data);
|
2013-04-13 20:25:28 +00:00
|
|
|
|
2009-11-11 01:03:06 +00:00
|
|
|
struct evbuffer;
|
|
|
|
|
2017-04-20 16:02:19 +00:00
|
|
|
struct tr_web_task* tr_webRunWebseed(tr_torrent* tor, char const* url, char const* range, tr_web_done_func done_func,
|
2017-04-19 12:04:45 +00:00
|
|
|
void* done_func_user_data, struct evbuffer* buffer);
|
2011-07-10 15:24:51 +00:00
|
|
|
|
2020-08-27 23:41:26 +00:00
|
|
|
long tr_webGetTaskResponseCode(struct tr_web_task* task);
|
|
|
|
|
|
|
|
char const* tr_webGetTaskRealUrl(struct tr_web_task* task);
|
2011-01-06 01:00:21 +00:00
|
|
|
|
2017-04-20 16:02:19 +00:00
|
|
|
void tr_http_escape(struct evbuffer* out, char const* str, size_t len, bool escape_slashes);
|
2008-04-24 01:42:53 +00:00
|
|
|
|
2017-04-20 16:02:19 +00:00
|
|
|
void tr_http_escape_sha1(char* out, uint8_t const* sha1_digest);
|
2011-03-11 04:19:01 +00:00
|
|
|
|
2017-04-20 16:02:19 +00:00
|
|
|
char* tr_http_unescape(char const* str, size_t len);
|
2009-11-20 04:38:19 +00:00
|
|
|
|
2020-08-11 18:11:55 +00:00
|
|
|
TR_END_DECLS
|