Re-added support for https (#33)
This commit is contained in:
9
fiche.c
9
fiche.c
@@ -201,6 +201,8 @@ void fiche_init(Fiche_Settings *settings) {
|
|||||||
9999,
|
9999,
|
||||||
// slug length
|
// slug length
|
||||||
4,
|
4,
|
||||||
|
// https
|
||||||
|
false,
|
||||||
// buffer length
|
// buffer length
|
||||||
32768,
|
32768,
|
||||||
// user name
|
// user name
|
||||||
@@ -360,7 +362,12 @@ static void get_date(char *buf) {
|
|||||||
|
|
||||||
static int set_domain_name(Fiche_Settings *settings) {
|
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;
|
const int len = strlen(settings->domain) + strlen(prefix) + 1;
|
||||||
|
|
||||||
char *b = malloc(len);
|
char *b = malloc(len);
|
||||||
|
|||||||
6
fiche.h
6
fiche.h
@@ -24,6 +24,7 @@ $ cat fiche.c | nc localhost 9999
|
|||||||
#define FICHE_H
|
#define FICHE_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -52,6 +53,11 @@ typedef struct Fiche_Settings {
|
|||||||
*/
|
*/
|
||||||
uint8_t slug_len;
|
uint8_t slug_len;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief If set, returns url with https prefix instead of http
|
||||||
|
*/
|
||||||
|
bool https;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Connection buffer length
|
* @brief Connection buffer length
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user