diff options
Diffstat (limited to 'src/plugins/MangaGeneric.cpp')
-rw-r--r-- | src/plugins/MangaGeneric.cpp | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/plugins/MangaGeneric.cpp b/src/plugins/MangaGeneric.cpp index 738c6dc..87b4f1d 100644 --- a/src/plugins/MangaGeneric.cpp +++ b/src/plugins/MangaGeneric.cpp @@ -169,7 +169,8 @@ namespace QuickMedia { std::string target_url; std::string website_data; - if(download_to_string(url, website_data, args, true, fail_on_http_error) != DownloadResult::OK) + std::vector<std::string> website_headers; + if(download_to_string(url, website_data, args, true, fail_on_http_error, false, &website_headers) != DownloadResult::OK) return PluginResult::NET_ERR; if(website_data.empty()) @@ -199,17 +200,10 @@ namespace QuickMedia { goto cleanup; if(!text_query.url_field && !new_result_items.empty()) { - if(target_url.empty()) { - std::string response_headers; - DownloadResult download_result = download_head_to_string(url, response_headers, true); - if(download_result != DownloadResult::OK) { - result = -1; - goto cleanup; - } - - target_url = header_extract_value(response_headers, "location"); + if(target_url.empty() && !website_headers.empty()) { + target_url = header_extract_value(website_headers.front(), "location"); if(target_url.empty()) { - fprintf(stderr, "Failed to extract target location from %s HEAD\n", url.c_str()); + fprintf(stderr, "Failed to extract target location from %s\n", url.c_str()); result = -1; goto cleanup; } |