From 5a0e99d72e525fd37c599ae5435f74d7458176f1 Mon Sep 17 00:00:00 2001 From: Jeroen Domburg Date: Thu, 11 Dec 2014 21:32:47 +0100 Subject: [PATCH] Small doc updates --- user/auth.c | 2 +- user/httpd.h | 1 + user/user_main.c | 14 +++++++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/user/auth.c b/user/auth.c index 2281ae9..d181335 100644 --- a/user/auth.c +++ b/user/auth.c @@ -1,5 +1,5 @@ /* -HTTP auth implementation. +HTTP auth implementation. Only does basic authentication for now. */ /* diff --git a/user/httpd.h b/user/httpd.h index 8cdab8d..0170a96 100644 --- a/user/httpd.h +++ b/user/httpd.h @@ -9,6 +9,7 @@ #define HTTPD_CGI_MORE 0 #define HTTPD_CGI_DONE 1 #define HTTPD_CGI_NOTFOUND 2 +#define HTTPD_CGI_AUTHENTICATED 2 //for now typedef struct HttpdPriv HttpdPriv; typedef struct HttpdConnData HttpdConnData; diff --git a/user/user_main.c b/user/user_main.c index 233b533..7e03871 100644 --- a/user/user_main.c +++ b/user/user_main.c @@ -29,7 +29,7 @@ int myPassFn(HttpdConnData *connData, int no, char *user, int userLen, char *pas os_strcpy(user, "admin"); os_strcpy(pass, "s3cr3t"); return 1; -//Add more users this way +//Add more users this way. Check against incrementing no for each user added. // } else if (no==1) { // os_strcpy(user, "user1"); // os_strcpy(pass, "something"); @@ -38,6 +38,17 @@ int myPassFn(HttpdConnData *connData, int no, char *user, int userLen, char *pas return 0; } + +/* +This is the main url->function dispatching data struct. +In short, it's a struct with various URLs plus their handlers. The handlers can +be 'standard' CGI functions you wrote, or 'special' CGIs requiring an argument. +They can also be auth-functions. An asterisk will match any url starting with +everything before the asterisks; "*" matches everything. The list will be +handled top-down, so make sure to put more specific rules above the more +general ones. Authorization things (like authBasic) act as a 'barrier' and +should be placed above the URLs they protect. +*/ HttpdBuiltInUrl builtInUrls[]={ {"/", cgiRedirect, "/index.tpl"}, {"/flash.bin", cgiReadFlash, NULL}, @@ -62,6 +73,7 @@ HttpdBuiltInUrl builtInUrls[]={ }; +//Main routine. Initialize stdout, the I/O and the webserver and we're done. void user_init(void) { stdoutInit(); ioInit();