#include "httpfetch.h"#include "porting.h"#include <list>#include <unordered_map>#include <cerrno>#include <mutex>#include "threading/event.h"#include "config.h"#include "exceptions.h"#include "debug.h"#include "log.h"#include "util/container.h"#include "util/thread.h"#include "version.h"#include "settings.h"#include "noise.h"#include <curl/curl.h>
Include dependency graph for httpfetch.cpp:Classes | |
| class | CurlHandlePool |
| class | HTTPFetchOngoing |
| class | CurlFetchThread |
| struct | CurlFetchThread::Request |
Functions | |
| static std::string | default_user_agent () |
| static void | httpfetch_deliver_result (const HTTPFetchResult &fetch_result) |
| static void | httpfetch_request_clear (u64 caller) |
| u64 | httpfetch_caller_alloc () |
| u64 | httpfetch_caller_alloc_secure () |
| void | httpfetch_caller_free (u64 caller) |
| bool | httpfetch_async_get (u64 caller, HTTPFetchResult &fetch_result) |
| static size_t | httpfetch_writefunction (char *ptr, size_t size, size_t nmemb, void *userdata) |
| static size_t | httpfetch_discardfunction (char *ptr, size_t size, size_t nmemb, void *userdata) |
| void | httpfetch_init (int parallel_limit) |
| void | httpfetch_cleanup () |
| void | httpfetch_async (const HTTPFetchRequest &fetch_request) |
| bool | httpfetch_sync_interruptible (const HTTPFetchRequest &fetch_request, HTTPFetchResult &fetch_result, long interval) |
Variables | |
| static std::mutex | g_httpfetch_mutex |
| static std::unordered_map< u64, std::queue< HTTPFetchResult > > | g_httpfetch_results |
| static PcgRandom | g_callerid_randomness |
| static std::unique_ptr< CurlFetchThread > | g_httpfetch_thread |
|
static |
| void httpfetch_async | ( | const HTTPFetchRequest & | fetch_request | ) |
References g_httpfetch_thread.
Referenced by httpfetch_sync_interruptible(), ClientMediaDownloader::initialStep(), ModApiHttp::l_http_fetch_async(), ServerList::sendAnnounce(), SingleMediaDownloader::startRemoteMediaTransfer(), and ClientMediaDownloader::startRemoteMediaTransfers().
Here is the caller graph for this function:| bool httpfetch_async_get | ( | u64 | caller, |
| HTTPFetchResult & | fetch_result ) |
References g_httpfetch_mutex, and g_httpfetch_results.
Referenced by httpfetch_sync_interruptible(), ModApiHttp::l_http_fetch_async_get(), ClientMediaDownloader::step(), and SingleMediaDownloader::step().
Here is the caller graph for this function:| u64 httpfetch_caller_alloc | ( | ) |
References FATAL_ERROR, g_httpfetch_mutex, g_httpfetch_results, HTTPFETCH_CID_START, and verbosestream.
Referenced by ClientMediaDownloader::initialStep(), and SingleMediaDownloader::initialStep().
Here is the caller graph for this function:| u64 httpfetch_caller_alloc_secure | ( | ) |
References FATAL_ERROR, g_callerid_randomness, g_httpfetch_mutex, g_httpfetch_results, HTTPFETCH_CID_START, HTTPFETCH_DISCARD, PcgRandom::next(), and verbosestream.
Referenced by httpfetch_sync_interruptible(), and ModApiHttp::read_http_fetch_request().
Here is the call graph for this function:
Here is the caller graph for this function:| void httpfetch_caller_free | ( | u64 | caller | ) |
References g_httpfetch_mutex, g_httpfetch_results, HTTPFETCH_DISCARD, httpfetch_request_clear(), and verbosestream.
Referenced by ClientMediaDownloader::~ClientMediaDownloader(), SingleMediaDownloader::~SingleMediaDownloader(), and httpfetch_sync_interruptible().
Here is the call graph for this function:
Here is the caller graph for this function:| void httpfetch_cleanup | ( | ) |
References g_httpfetch_thread, and verbosestream.
Referenced by uninit_common().
Here is the caller graph for this function:
|
static |
References HTTPFetchResult::caller, g_httpfetch_mutex, g_httpfetch_results, and HTTPFETCH_DISCARD.
Referenced by CurlFetchThread::processCurlMessage(), and CurlFetchThread::processQueued().
Here is the caller graph for this function:
|
static |
Referenced by HTTPFetchOngoing::HTTPFetchOngoing(), and HTTPFetchOngoing::~HTTPFetchOngoing().
Here is the caller graph for this function:| void httpfetch_init | ( | int | parallel_limit | ) |
References FATAL_ERROR_IF, g_callerid_randomness, g_httpfetch_thread, porting::secure_rand_fill_buf(), and verbosestream.
Referenced by init_common().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
References g_httpfetch_thread, and Event::wait().
Referenced by httpfetch_caller_free().
Here is the call graph for this function:
Here is the caller graph for this function:| bool httpfetch_sync_interruptible | ( | const HTTPFetchRequest & | fetch_request, |
| HTTPFetchResult & | fetch_result, | ||
| long | interval ) |
References HTTPFetchRequest::caller, Thread::getCurrentThread(), httpfetch_async(), httpfetch_async_get(), httpfetch_caller_alloc_secure(), httpfetch_caller_free(), sleep_ms, and HTTPFetchRequest::url.
Referenced by GUIEngine::downloadFile(), and ModApiHttp::l_http_fetch_sync().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
|
static |
Referenced by httpfetch_caller_alloc_secure(), and httpfetch_init().
|
static |
|
static |
|
static |
Referenced by httpfetch_async(), httpfetch_cleanup(), httpfetch_init(), and httpfetch_request_clear().