Curl: fix --verbose-curl option

This commit is contained in:
Megamouse 2021-11-11 14:20:11 +01:00
parent 3fde455932
commit cbec04cd0f
3 changed files with 17 additions and 4 deletions

View File

@ -545,7 +545,20 @@ int main(int argc, char** argv)
return 0;
// Set curl to verbose if needed
rpcs3::curl::s_curl_verbose = parser.isSet(arg_verbose_curl);
rpcs3::curl::g_curl_verbose = parser.isSet(arg_verbose_curl);
if (rpcs3::curl::g_curl_verbose)
{
#ifdef _WIN32
if (AttachConsole(ATTACH_PARENT_PROCESS) || AllocConsole())
{
[[maybe_unused]] const auto con_out = freopen("CONOUT$", "w", stdout);
[[maybe_unused]] const auto con_err = freopen("CONOUT$", "w", stderr);
}
#endif
fprintf(stdout, "Enabled Curl verbose logging.\n");
sys_log.always()("Enabled Curl verbose logging. Please look at your console output.");
}
// Handle update of commit database
if (parser.isSet(arg_commit_db))

View File

@ -22,8 +22,8 @@ curl_handle::curl_handle(QObject* parent) : QObject(parent)
m_uses_error_buffer = err == CURLE_OK;
err = curl_easy_setopt(m_curl, CURLOPT_VERBOSE, s_curl_verbose);
if (err != CURLE_OK) network_log.error("curl_easy_setopt(CURLOPT_VERBOSE, %d): %s", s_curl_verbose, curl_easy_strerror(err));
err = curl_easy_setopt(m_curl, CURLOPT_VERBOSE, g_curl_verbose);
if (err != CURLE_OK) network_log.error("curl_easy_setopt(CURLOPT_VERBOSE, %d): %s", g_curl_verbose, curl_easy_strerror(err));
#ifdef _WIN32
// This shouldn't be needed on linux

View File

@ -10,7 +10,7 @@
namespace rpcs3::curl
{
static bool s_curl_verbose = false;
inline bool g_curl_verbose = false;
class curl_handle : public QObject
{