Added uri parsing

This commit is contained in:
2020-12-18 22:06:41 +01:00
parent db224c7452
commit a5c1516468
4 changed files with 224 additions and 34 deletions

View File

@ -10,20 +10,27 @@
#include <sys/stat.h>
#define URI_DIR_MODE_FORBIDDEN 0
#define URI_DIR_MODE_LIST 1
#define URI_DIR_MODE_INFO 2
typedef struct {
char *webroot;
char *path;
char *pathinfo;
char *query;
char *filename;
char *filename_comp;
char *uri;
char *webroot; // "/srv/www/www.test.org"
char *req_path; // "/account/login"
char *path; // "/account/"
char *pathinfo; // "login"
char *query; // "username=test"
char *filename; // "/account/index.php"
char *filename_comp; // "/srv/www/www.test.org/res/.file.css.compressed"
char *uri; // "/account/login?username=test"
char *etag;
struct stat stat;
int is_static:1;
unsigned int is_static:1;
unsigned int is_dir:1;
} http_uri;
int uri_init(http_uri *uri, const char *webroot, const char *uri_str);
int uri_init(http_uri *uri, const char *webroot, const char *uri_str, int dir_mode);
void uri_free(http_uri *uri);