aboutsummaryrefslogtreecommitdiff
path: root/lpm.c
diff options
context:
space:
mode:
authorAdam <adamdharrison@gmail.com>2022-09-18 21:15:41 -0400
committerAdam <adamdharrison@gmail.com>2022-09-18 21:15:41 -0400
commit32cb25250832d4a587ce9992f891b5731c9bd8d0 (patch)
tree63a9ad2bc679dba247b47b26ae74e1b9677eba14 /lpm.c
parent3c17efb0fbc6d26d3a59790ba26fab6756688d41 (diff)
downloadlite-xl-plugin-manager-32cb25250832d4a587ce9992f891b5731c9bd8d0.tar.gz
lite-xl-plugin-manager-32cb25250832d4a587ce9992f891b5731c9bd8d0.zip
Almost done.
Diffstat (limited to 'lpm.c')
-rw-r--r--lpm.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/lpm.c b/lpm.c
index 4a7381f..6340c74 100644
--- a/lpm.c
+++ b/lpm.c
@@ -430,6 +430,9 @@ static int lpm_get(lua_State* L) {
// curl_easy_reset(curl);
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
+ #ifdef _WIN32
+ curl_easy_setopt(curl, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NATIVE_CA);
+ #endif
if (path) {
FILE* file = fopen(path, "wb");
if (!file)
@@ -439,12 +442,12 @@ static int lpm_get(lua_State* L) {
CURLcode res = curl_easy_perform(curl);
if (res != CURLE_OK) {
fclose(file);
- return luaL_error(L, "curl error: %d", res);
+ return luaL_error(L, "curl error accessing %s: %s", url, curl_easy_strerror(res));
}
fclose(file);
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code);
if (response_code != 200)
- return luaL_error(L, "curl error, non-200 response code: %d", response_code);
+ return luaL_error(L, "curl error accessing %s, non-200 response code: %d", url, response_code);
lua_pushnil(L);
lua_newtable(L);
return 2;
@@ -455,10 +458,10 @@ static int lpm_get(lua_State* L) {
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &B);
CURLcode res = curl_easy_perform(curl);
if (res != CURLE_OK)
- return luaL_error(L, "curl error: %d", res);
+ return luaL_error(L, "curl error accessing %s: %s", url, curl_easy_strerror(res));
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code);
if (response_code != 200)
- return luaL_error(L, "curl error, non-200 response code: %d", response_code);
+ return luaL_error(L, "curl error accessing %s, non-200 response code: %d", url, response_code);
luaL_pushresult(&B);
lua_newtable(L);
}