Merge branch 'unstable' into redis_6_merge
Former-commit-id: 4671cd6002c50dd8484e59fd7434878053340702
This commit is contained in:
commit
c7f1eab8a4
13
src/motd.cpp
13
src/motd.cpp
@ -23,7 +23,7 @@ static const char *szMotdCachePath()
|
||||
return "";
|
||||
const char *homedir = pw->pw_dir;
|
||||
sdsMotdCachePath = sdsnew(homedir);
|
||||
sdsMotdCachePath = sdscat(sdsMotdCachePath, "/.keydb-cli-motd");
|
||||
sdsMotdCachePath = sdscat(sdsMotdCachePath, motd_cache_file);
|
||||
return sdsMotdCachePath;
|
||||
}
|
||||
static size_t motd_write_callback(void *ptr, size_t size, size_t nmemb, sds *str)
|
||||
@ -101,6 +101,17 @@ extern "C" char *fetchMOTD(int cache)
|
||||
sdsfree(str);
|
||||
str = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
long response_code;
|
||||
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code);
|
||||
if ((response_code / 100) != 2)
|
||||
{
|
||||
// An error code not in the 200s implies an error
|
||||
sdsfree(str);
|
||||
str = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
extern const char *motd_url;
|
||||
extern const char *motd_cache_file;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -97,6 +97,7 @@ int spectrum_palette_size;
|
||||
int g_fInCrash = 0;
|
||||
|
||||
const char *motd_url = "http://api.keydb.dev/motd/motd_cli.txt";
|
||||
const char *motd_cache_file = "/.keydb-cli-motd";
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Utility functions
|
||||
|
@ -66,6 +66,7 @@
|
||||
|
||||
int g_fTestMode = false;
|
||||
const char *motd_url = "http://api.keydb.dev/motd/motd_server.txt";
|
||||
const char *motd_cache_file = "/.keydb-server-motd";
|
||||
|
||||
/* Our shared "common" objects */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user