add "verbose" option for debugging which will divert libcurl logging to the screen
This commit is contained in:
@ -36,6 +36,7 @@ void GetURL::command(int narg, char **arg)
|
||||
if (narg < 1) utils::missing_cmd_args(FLERR, "geturl", error);
|
||||
int verify = 1;
|
||||
int overwrite = 1;
|
||||
int verbose = 0;
|
||||
|
||||
// process arguments
|
||||
|
||||
@ -63,6 +64,10 @@ void GetURL::command(int narg, char **arg)
|
||||
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "geturl verify", error);
|
||||
verify = utils::logical(FLERR, arg[iarg + 1], false, lmp);
|
||||
++iarg;
|
||||
} else if (strcmp(arg[iarg], "verbose") == 0) {
|
||||
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "geturl verbose", error);
|
||||
verbose = utils::logical(FLERR, arg[iarg + 1], false, lmp);
|
||||
++iarg;
|
||||
} else {
|
||||
error->all(FLERR, "Unknown geturl keyword: {}", arg[iarg]);
|
||||
}
|
||||
@ -91,8 +96,10 @@ void GetURL::command(int narg, char **arg)
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *) out);
|
||||
curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
|
||||
curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L);
|
||||
if (verbose && screen) {
|
||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_STDERR, (void *) screen);
|
||||
}
|
||||
if (!verify) {
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
#include <mpi.h>
|
||||
|
||||
// whether to print verbose output (i.e. not capturing LAMMPS screen output).
|
||||
bool verbose = true;
|
||||
bool verbose = false;
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
using ::testing::ContainsRegex;
|
||||
@ -565,7 +565,6 @@ TEST_F(SimpleCommandsTest, Geturl)
|
||||
platform::unlink("myindex.html");
|
||||
if (Info::has_curl_support()) {
|
||||
BEGIN_CAPTURE_OUTPUT();
|
||||
command("shell curl -v -o myindex.html https://www.lammps.org/index.html");
|
||||
command("geturl https://www.lammps.org/index.html");
|
||||
command("geturl https://www.lammps.org/index.html output myindex.html");
|
||||
END_CAPTURE_OUTPUT();
|
||||
|
||||
Reference in New Issue
Block a user