Closed amyspark closed 2 years ago
Thanks for the two PR @amyspark !
Hi @amyspark , I've added a new option user_agent
in the cimg::load_network()
function. Could you please check that I did it right for powershell ?
Basically, I've done something like this:
#if cimg_OS==2
if (cimg::fsize(filename_local)<=0) { // Try with 'powershell' otherwise.
if (timeout) cimg_snprintf(s_timeout.assign(64),64,"-TimeoutSec %u",timeout);
else s_timeout.assign(1,1,1,1,0);
if (referer) cimg_snprintf(s_referer.assign(1024),1024,"-Headers @{'Referer'='%s'}",referer);
else s_referer.assign(1,1,1,1,0);
if (user_agent) cimg_snprintf(s_user_agent.assign(1024),1024,"-UserAgent \"%s\"",user_agent);
else s_user_agent.assign(1,1,1,1,0);
cimg_snprintf(command,command._width,
"\"%s\" -NonInteractive -Command Invoke-WebRequest %s %s -OutFile \"%s\" -Uri \"%s\"",
cimg::powershell_path(),s_timeout._data,s_referer._data,filename_local,
CImg<char>::string(url)._system_strescape().data());
cimg::system(command,cimg::powershell_path());
}
#endif
@dtschump it looks correct! 👍
This is useful for systems where libcurl isn't available at build time.
See dtschump/gmic#374
See https://krita-artists.org/t/unknown-filename-gmic-qt/37813