Introduction
Introduction Statistics Contact Development Disclaimer Help
enhancement #33 - fiche - A pastebin adjusted for gopher use
git clone git://vernunftzentrum.de/fiche.git
Log
Files
Refs
LICENSE
---
commit a5c137c06d20e96fb97e946378437ec198299287
parent abf8ae51177e4dc6080e1e23265e4d515b42c1a8
Author: solusipse <[email protected]>
Date: Sat, 23 Jan 2016 12:36:53 +0100
enhancement #33
Diffstat:
fiche.c | 20 +++++++++++++++++---
fiche.h | 4 +++-
2 files changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/fiche.c b/fiche.c
@@ -36,6 +36,7 @@ int main(int argc, char **argv)
time_seed = time(0);
parse_parameters(argc, argv);
+ set_domain_name();
if (getuid() == 0)
{
@@ -404,11 +405,21 @@ void error(char *buffer)
exit(1);
}
+void set_domain_name() {
+ char b[128];
+ memcpy(b, DOMAIN, sizeof DOMAIN);
+
+ if (HTTPS)
+ snprintf(DOMAIN, sizeof DOMAIN, "%s%s", "https://", b);
+ else
+ snprintf(DOMAIN, sizeof DOMAIN, "%s%s", "http://", b);
+}
+
void parse_parameters(int argc, char **argv)
{
int c;
- while ((c = getopt (argc, argv, "Dep:b:s:d:o:l:B:u:w:")) != -1)
+ while ((c = getopt (argc, argv, "DeSp:b:s:d:o:l:B:u:w:")) != -1)
switch (c)
{
case 'D':
@@ -417,8 +428,11 @@ void parse_parameters(int argc, char **argv)
case 'e':
snprintf(symbols, sizeof symbols, "%s", "abcdefghijklmnopqrstu…
break;
+ case 'S':
+ HTTPS = 1;
+ break;
case 'd':
- snprintf(DOMAIN, sizeof DOMAIN, "%s%s%s", "http://", optarg, "…
+ snprintf(DOMAIN, sizeof DOMAIN, "%s%s", optarg, "/");
break;
case 'p':
PORT = atoi(optarg);
@@ -447,7 +461,7 @@ void parse_parameters(int argc, char **argv)
load_list(WHITEFILE, 1);
break;
default:
- printf("usage: fiche [-pbsdolBuw].\n");
+ printf("usage: fiche [-pbsdSolBuw].\n");
printf(" [-d domain] [-p port] [-s slug_si…
printf(" [-o output directory] [-B buffer_…
printf(" [-l log file] [-b banlist] [-w wh…
diff --git a/fiche.h b/fiche.h
@@ -54,11 +54,12 @@ char *BANFILE;
char *WHITEFILE;
char *WHITELIST;
int DAEMON = 0;
+int HTTPS = 0;
int PORT = 9999;
int SLUG_SIZE = 4;
int BUFSIZE = 32768;
int QUEUE_SIZE = 500;
-char DOMAIN[128] = "http://localhost/";
+char DOMAIN[128] = "localhost/";
char symbols[67] = "abcdefghijklmnopqrstuvwxyz0123456789";
unsigned int time_seed;
@@ -87,6 +88,7 @@ void save_to_file(char *buffer, char *slug, struct client_dat…
void display_info(struct client_data data, char *slug, char *message);
void startup_message();
void set_basedir();
+void set_domain_name();
void load_list(char *file_path, int type);
void parse_parameters(int argc, char **argv);
void save_log(char *slug, char *hostaddrp, char *h_name);
You are viewing proxied material from vernunftzentrum.de. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.