diff --git a/fiche.c b/fiche.c index 2255685..11176f7 100644 --- a/fiche.c +++ b/fiche.c @@ -201,6 +201,8 @@ void fiche_init(Fiche_Settings *settings) { 9999, // slug length 4, + // https + false, // buffer length 32768, // user name @@ -360,7 +362,12 @@ static void get_date(char *buf) { static int set_domain_name(Fiche_Settings *settings) { - const char *prefix = "http://"; + char *prefix = ""; + if (settings->https) { + prefix = "https://"; + } else { + prefix = "http://"; + } const int len = strlen(settings->domain) + strlen(prefix) + 1; char *b = malloc(len); diff --git a/fiche.h b/fiche.h index 4b8c958..9b4cf47 100644 --- a/fiche.h +++ b/fiche.h @@ -24,6 +24,7 @@ $ cat fiche.c | nc localhost 9999 #define FICHE_H #include +#include /** @@ -52,6 +53,11 @@ typedef struct Fiche_Settings { */ uint8_t slug_len; + /** + * @brief If set, returns url with https prefix instead of http + */ + bool https; + /** * @brief Connection buffer length * diff --git a/main.c b/main.c index 269633c..53dcf30 100644 --- a/main.c +++ b/main.c @@ -68,6 +68,13 @@ int main(int argc, char **argv) { } break; + // https + case 'S': + { + fs.https = true; + } + break; + // output directory path case 'o': {