Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Josh Wilcox
crown-core
Commits
6364b429
Commit
6364b429
authored
7 years ago
by
Ashot
Browse files
Options
Download
Email Patches
Plain Diff
Used CURLOPT_CAPATH to set directory holding CA certificate
parent
7e1da62c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/updater.cpp
+18
-1
src/updater.cpp
src/updater.h
+1
-0
src/updater.h
with
19 additions
and
1 deletion
+19
-1
src/updater.cpp
View file @
6364b429
...
...
@@ -9,7 +9,10 @@
#include <stdio.h>
#include <curl/curl.h>
#include <boost/thread.hpp>
#include <boost/filesystem.hpp>
using
namespace
boost
::
filesystem
;
struct
DownloadProgress
{
double
lastruntime
;
CURL
*
curl
;
...
...
@@ -99,6 +102,18 @@ void Updater::SetJsonPath()
}
}
void
Updater
::
SetCAPath
(
CURL
*
curl
)
{
#ifdef __linux__
path
app
=
strprintf
(
"/proc/%s/exe"
,
getpid
());
if
(
exists
(
app
)
&&
is_symlink
(
app
))
{
path
appPath
=
canonical
(
app
).
parent_path
();
curl_easy_setopt
(
curl
,
CURLOPT_CAPATH
,
appPath
);
}
#endif
}
bool
Updater
::
LoadUpdateInfo
()
{
bool
result
=
false
;
...
...
@@ -112,6 +127,7 @@ bool Updater::LoadUpdateInfo()
curl_easy_setopt
(
curl
,
CURLOPT_URL
,
updaterInfoUrl
.
c_str
());
curl_easy_setopt
(
curl
,
CURLOPT_WRITEFUNCTION
,
GetUpdateData
);
curl_easy_setopt
(
curl
,
CURLOPT_WRITEDATA
,
&
updateData
);
SetCAPath
(
curl
);
res
=
curl_easy_perform
(
curl
);
curl_easy_cleanup
(
curl
);
}
...
...
@@ -245,6 +261,7 @@ CURLcode Updater::DownloadFile(std::string url, std::string fileName, void(progr
curl_easy_setopt
(
curl_handle
,
CURLOPT_NOPROGRESS
,
0L
);
curl_easy_setopt
(
curl_handle
,
CURLOPT_FOLLOWLOCATION
,
1L
);
curl_easy_setopt
(
curl_handle
,
CURLOPT_WRITEFUNCTION
,
write_data
);
SetCAPath
(
curl_handle
);
curl_easy_setopt
(
curl_handle
,
CURLOPT_XFERINFOFUNCTION
,
xferinfo
);
curl_easy_setopt
(
curl_handle
,
CURLOPT_XFERINFODATA
,
&
prog
);
...
...
This diff is collapsed.
Click to expand it.
src/updater.h
View file @
6364b429
...
...
@@ -70,6 +70,7 @@ private:
int
GetVersionFromJson
();
std
::
string
GetUrl
(
const
Value
&
value
);
std
::
string
GetSha256sum
(
Value
value
);
void
SetCAPath
(
CURL
*
curl
);
};
#endif
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help