summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cgit-70.c31
-rw-r--r--ui_70-refs.c2
-rw-r--r--ui_70-repolist.c17
-rw-r--r--ui_70-shared.c6
4 files changed, 36 insertions, 20 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. */
diff --git a/ui_70-refs.c b/ui_70-refs.c
index 7d62e03..f5e52dd 100644
--- a/ui_70-refs.c
+++ b/ui_70-refs.c
@@ -69,13 +69,11 @@ static int print_branch(struct refinfo *ref)
cgit_gopher_text_pad(info->author, GOPHER_SUMMARY_AUTH_LEN);
cgit_print_age(info->committer_date, info->committer_tz, -1);
} else {
- html("</td><td></td><td>");
cgit_object_link(ref->object);
}
cgit_gopher_tab();
cgit_log_link(name, NULL, NULL, name, NULL, NULL, 0, NULL, NULL,
ctx.qry.showmsg, 0);
- cgit_gopher_tab();
cgit_gopher_end_selector();
return 0;
}
diff --git a/ui_70-repolist.c b/ui_70-repolist.c
index 7cf1da9..fd1c0e1 100644
--- a/ui_70-repolist.c
+++ b/ui_70-repolist.c
@@ -97,26 +97,33 @@ static int is_match(struct cgit_repo *repo)
return 1;
if (repo->owner && strcasestr(repo->owner, ctx.qry.search))
return 1;
+ fprintf(stdout, "i -- is_match has failed\n");
return 0;
}
static int is_in_url(struct cgit_repo *repo)
{
- if (!ctx.qry.url)
+ if (!ctx.qry.url){
+ fprintf(stdout, "i -- ctx.qry.url is NULL\n");
return 1;
- if (repo->url && starts_with(repo->url, ctx.qry.url))
+ }
+ if (repo->url && starts_with(repo->url, ctx.qry.url)){
+ fprintf(stdout, "i -- repo URL not in qry.url\n");
return 1;
+ }
return 0;
}
static int is_visible(struct cgit_repo *repo)
{
if (repo->hide || repo->ignore){
- fprintf(stderr, "%s is invisible or ignored", repo->name);
+ fprintf(stdout, "i -- repo: '%s' is invisible or ignored", repo->name);
return 0;
}
- if (!(is_match(repo) && is_in_url(repo)))
+ if (!(is_match(repo) && is_in_url(repo))){
+ fprintf(stdout, "i -- !(is_match(repo) && is_in_url(repo))\n");
return 0;
+ }
return 1;
}
@@ -124,6 +131,8 @@ static int any_repos_visible(void)
{
int i;
+ fprintf(stdout, "i -- ctx.qry.search: %s\n", ctx.qry.search);
+
for (i = 0; i < cgit_repolist.count; i++) {
if (is_visible(&cgit_repolist.repos[i]))
return 1;
diff --git a/ui_70-shared.c b/ui_70-shared.c
index a1b98b7..02376b2 100644
--- a/ui_70-shared.c
+++ b/ui_70-shared.c
@@ -244,10 +244,10 @@ char *cgit_currenturl(void)
const char *cgit_rooturl(void)
{
- if (ctx.cfg.virtual_root)
+/* if (ctx.cfg.virtual_root)
return ctx.cfg.virtual_root;
- else
- return fmtalloc("/%s", ctx.cfg.script_name);
+ else*/
+ return fmtalloc("/%s", ctx.cfg.script_name);
}
const char *cgit_loginurl(void)