summaryrefslogtreecommitdiff
path: root/cgit-70.c
diff options
context:
space:
mode:
authorKatolaZ <katolaz@freaknet.org>2018-07-30 06:58:49 +0100
committerKatolaZ <katolaz@freaknet.org>2018-07-30 06:58:49 +0100
commitee667540e07eaffaed612e8ca8572611ea1f42d9 (patch)
tree17ca186b87b06045eb85f7b8eadc0cb0b8fc3daa /cgit-70.c
parentd466dfc252f9896b1d6bdce623067378e04b8e71 (diff)
fixed repolist
Diffstat (limited to 'cgit-70.c')
-rw-r--r--cgit-70.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/cgit-70.c b/cgit-70.c
index 0fcd08e..21e3c85 100644
--- a/cgit-70.c
+++ b/cgit-70.c
@@ -402,6 +402,7 @@ 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");
@@ -721,19 +722,18 @@ static void process_request(void)
cmd = cgit_get_cmd();
if (!cmd) {
ctx.page.title = "cgit error";
- cgit_print_error_page(404, "Not found", "Invalid request");
+ cgit_gopher_error("Invalid request");
return;
}
if (!ctx.cfg.enable_http_clone && cmd->is_clone) {
ctx.page.title = "cgit error";
- cgit_print_error_page(404, "Not found", "Invalid request");
+ cgit_gopher_error("Invalid request");
return;
}
if (cmd->want_repo && !ctx.repo) {
- cgit_print_error_page(400, "Bad request",
- "No repository selected");
+ cgit_gopher_error("No repository selected");
return;
}
@@ -953,15 +953,24 @@ static void cgit_parse_args(int argc, const char **argv)
switch (++argc){
case 5:
ctx.env.server_port = xstrdup(argv[4]);
+ fprintf(stdout, "i -- port: %s\n", ctx.env.server_port);
case 4:
ctx.env.server_name = xstrdup(argv[3]);
+ fprintf(stdout, "i -- hostname: %s\n", ctx.env.server_name);
case 3:
- ctx.env.query_string = xstrdup(argv[2]);
- ctx.qry.raw = xstrdup(argv[2]);
+ if (strlen(argv[2])){
+ ctx.env.query_string = xstrdup(argv[2]);
+ ctx.qry.raw = xstrdup(argv[2]);
+ }
+ fprintf(stdout, "i -- query_string: '%s'\n", ctx.env.query_string);
case 2:
- ctx.env.gopher_search = xstrdup(argv[1]);
+ if (strlen(argv[1])){
+ ctx.env.gopher_search = xstrdup(argv[1]);
+ }
+ fprintf(stdout, "i -- gopher_search: %s\n", ctx.env.gopher_search);
case 1:
ctx.env.script_name = xstrdup(argv[0]);
+ fprintf(stdout, "i -- script_name: %s\n", ctx.env.script_name);
}
}
@@ -1003,10 +1012,10 @@ 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;
- fprintf(stderr, " -- cmd_main -- ctx.qry.raw: %s\n", ctx.qry.raw);
+ fprintf(stdout, "i -- cmd_main -- ctx.qry.raw: %s\n", ctx.qry.raw);
http_parse_querystring(ctx.qry.raw, querystring_cb);
- fprintf(stderr, " -- cmd_main -- got url: %s\n", ctx.qry.url);
+ fprintf(stdout, "i -- cmd_main -- got url: %s\n", ctx.qry.url);
/* If virtual-root isn't specified in cgitrc, lets pretend
* that virtual-root equals SCRIPT_NAME, minus any possibly
@@ -1021,7 +1030,7 @@ int cmd_main(int argc, const char **argv)
* long as PATH_INFO is included in the cache lookup key).
*/
path = ctx.env.path_info;
- if (!ctx.qry.url && path) {
+/* if (!ctx.qry.url && path) {
if (path[0] == '/')
path++;
ctx.qry.url = xstrdup(path);
@@ -1033,7 +1042,7 @@ int cmd_main(int argc, const char **argv)
ctx.qry.raw = xstrdup(ctx.qry.url);
cgit_parse_url(ctx.qry.url);
}
-
+*/
/* Before we go any further, we set ctx.env.authenticated by checking to see
* if the supplied cookie is valid. All cookies are valid if there is no
* auth_filter. If there is an auth_filter, the filter decides. */