added HTML5 fallback option

This is not part of the project requirements
This commit is contained in:
Godmar Back 2018-04-29 17:58:34 -04:00
parent 3e05379763
commit 65ee63d43e
2 changed files with 12 additions and 1 deletions

View File

@ -6,3 +6,4 @@
extern char *server_root;
extern bool silent_mode;
extern int token_expiration_time;
extern bool html5_fallback;

View File

@ -15,6 +15,12 @@
#include "bufio.h"
#include "globals.h"
/* Implement HTML5 fallback.
* This means that if a non-API path refers to a file and that
* file is not found or is a directory, return /index.html
* instead. Otherwise, return the file.
*/
bool html5_fallback = false;
bool silent_mode = false;
int token_expiration_time = 24 * 60 * 60; // default token expiration time is 1 day
@ -56,8 +62,12 @@ main(int ac, char *av[])
{
int opt;
char *port_string = NULL;
while ((opt = getopt(ac, av, "hp:R:se:")) != -1) {
while ((opt = getopt(ac, av, "ahp:R:se:")) != -1) {
switch (opt) {
case 'a':
html5_fallback = true;
break;
case 'p':
port_string = optarg;
break;