diff options
author | Mole Shang <[email protected]> | 2023-08-09 17:29:15 +0800 |
---|---|---|
committer | Mole Shang <[email protected]> | 2023-08-09 17:30:30 +0800 |
commit | c636d2e78e464246b3dd7bc8ce0b8e5d8a5bf7a6 (patch) | |
tree | 3ca0539da181565257d41259cc8e539c469fe847 /src/process_url.c | |
parent | c952d1663bf8d7e54926faab23ed2291c68b73f2 (diff) | |
download | hinata-c636d2e78e464246b3dd7bc8ce0b8e5d8a5bf7a6.tar.gz hinata-c636d2e78e464246b3dd7bc8ce0b8e5d8a5bf7a6.tar.bz2 hinata-c636d2e78e464246b3dd7bc8ce0b8e5d8a5bf7a6.zip |
process_url: set referer in the separate function
Diffstat (limited to 'src/process_url.c')
-rw-r--r-- | src/process_url.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/process_url.c b/src/process_url.c index dae6db3..c20b3eb 100644 --- a/src/process_url.c +++ b/src/process_url.c @@ -278,7 +278,7 @@ bool get_info(const char *URL, long *psize, char **p_content_type, *p_cookie = malloc(strlen(pch->value) + 1); strcpy(*p_cookie, pch->value); - if (psize){ + if (psize) { r = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, (curl_off_t *)psize); if (logerr(r)) { @@ -570,13 +570,11 @@ int get(const char *URL, char **pdstr) { * - If outdir is NULL or a empty string, reuse the cached outdir_g * - If fn is NULL or a empty string, infer the filename from URL (otherwise * fail and quit') - * - If referer is NULL or a empty string, uses NULL * - If callback || callback_struct is valid, execute the callback function * after download */ void add_url(const char *URL, const char *outdir, const char *fn, - const char *referer, callback_t callback, - callback_struct_t *p_callback_struct) { + callback_t callback, callback_struct_t *p_callback_struct) { char *filename; if (fn == NULL || fn[0] == '\0') { @@ -590,11 +588,6 @@ void add_url(const char *URL, const char *outdir, const char *fn, if (outdir && outdir[0] != '\0') { outdir_g = outdir; } - referer_g = referer; - if (referer && referer[0] == '\0') { - referer_g = NULL; - } - DEBUG_PRINT("referer_g: %s\n", referer_g); callback_g = callback; if (p_callback_struct) { |