|
|
|
@ -384,7 +384,7 @@ static void prepare_context(void) |
|
|
|
|
ctx.cfg.renamelimit = -1; |
|
|
|
|
ctx.cfg.remove_suffix = 0; |
|
|
|
|
ctx.cfg.robots = "index, nofollow"; |
|
|
|
|
ctx.cfg.root_title = "Git repository browser over Gopher"; |
|
|
|
|
ctx.cfg.root_title = "cgit-70 -- Git repository browser over Gopher"; |
|
|
|
|
ctx.cfg.root_desc = "a fast Gopher interface for the git dscm"; |
|
|
|
|
ctx.cfg.scan_hidden_path = 0; |
|
|
|
|
ctx.cfg.script_name = CGIT_SCRIPT_NAME; |
|
|
|
@ -402,7 +402,6 @@ static void prepare_context(void) |
|
|
|
|
ctx.env.no_http = getenv("NO_HTTP"); |
|
|
|
|
ctx.env.path_info = getenv("PATH_INFO"); |
|
|
|
|
ctx.env.query_string = getenv("QUERY_STRING"); |
|
|
|
|
fprintf(stdout, "i -- QUERY_STRING: '%s'\n", ctx.env.query_string); |
|
|
|
|
ctx.env.request_method = getenv("REQUEST_METHOD"); |
|
|
|
|
ctx.env.script_name = getenv("SCRIPT_NAME"); |
|
|
|
|
ctx.env.server_name = getenv("SERVER_NAME"); |
|
|
|
@ -953,24 +952,34 @@ static void cgit_parse_args(int argc, const char **argv) |
|
|
|
|
switch (++argc){ |
|
|
|
|
case 5: |
|
|
|
|
ctx.env.server_port = xstrdup(argv[4]); |
|
|
|
|
#ifdef DEBUG_GOPHER |
|
|
|
|
fprintf(stdout, "i -- port: %s\n", ctx.env.server_port); |
|
|
|
|
#endif |
|
|
|
|
case 4: |
|
|
|
|
ctx.env.server_name = xstrdup(argv[3]); |
|
|
|
|
#ifdef DEBUG_GOPHER |
|
|
|
|
fprintf(stdout, "i -- hostname: %s\n", ctx.env.server_name); |
|
|
|
|
#endif |
|
|
|
|
case 3: |
|
|
|
|
if (strlen(argv[2])){ |
|
|
|
|
ctx.env.query_string = xstrdup(argv[2]); |
|
|
|
|
ctx.qry.raw = xstrdup(argv[2]); |
|
|
|
|
} |
|
|
|
|
#ifdef DEBUG_GOPHER |
|
|
|
|
fprintf(stdout, "i -- query_string: '%s'\n", ctx.env.query_string); |
|
|
|
|
#endif |
|
|
|
|
case 2: |
|
|
|
|
if (strlen(argv[1])){ |
|
|
|
|
ctx.env.gopher_search = xstrdup(argv[1]); |
|
|
|
|
} |
|
|
|
|
#ifdef DEBUG_GOPHER |
|
|
|
|
fprintf(stdout, "i -- gopher_search: %s\n", ctx.env.gopher_search); |
|
|
|
|
#endif |
|
|
|
|
case 1: |
|
|
|
|
ctx.env.script_name = xstrdup(argv[0]); |
|
|
|
|
#ifdef DEBUG_GOPHER |
|
|
|
|
fprintf(stdout, "i -- script_name: %s\n", ctx.env.script_name); |
|
|
|
|
#endif |
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
@ -1000,7 +1009,7 @@ static int calc_ttl(void) |
|
|
|
|
|
|
|
|
|
int cmd_main(int argc, const char **argv) |
|
|
|
|
{ |
|
|
|
|
const char *path; |
|
|
|
|
/*const char *path;*/ |
|
|
|
|
int err, ttl; |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1012,10 +1021,14 @@ int cmd_main(int argc, const char **argv) |
|
|
|
|
cgit_parse_args(argc, argv); |
|
|
|
|
parse_configfile(expand_macros(ctx.env.cgit_config), config_cb); |
|
|
|
|
ctx.repo = NULL; |
|
|
|
|
#ifdef DEBUG_GOPHER |
|
|
|
|
fprintf(stdout, "i -- cmd_main -- ctx.qry.raw: %s\n", ctx.qry.raw); |
|
|
|
|
#endif |
|
|
|
|
http_parse_querystring(ctx.qry.raw, querystring_cb); |
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_GOPHER |
|
|
|
|
fprintf(stdout, "i -- cmd_main -- got url: %s\n", ctx.qry.url);
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
/* If virtual-root isn't specified in cgitrc, lets pretend
|
|
|
|
|
* that virtual-root equals SCRIPT_NAME, minus any possibly |
|
|
|
@ -1029,8 +1042,8 @@ int cmd_main(int argc, const char **argv) |
|
|
|
|
* urls without the need for rewriterules in the webserver (as |
|
|
|
|
* long as PATH_INFO is included in the cache lookup key). |
|
|
|
|
*/ |
|
|
|
|
path = ctx.env.path_info; |
|
|
|
|
/* if (!ctx.qry.url && path) {
|
|
|
|
|
/* path = ctx.env.path_info;
|
|
|
|
|
if (!ctx.qry.url && path) { |
|
|
|
|
if (path[0] == '/') |
|
|
|
|
path++; |
|
|
|
|
ctx.qry.url = xstrdup(path); |
|
|
|
|