return fmtalloc("%s:%s", ctx.env.server_name, ctx.env.server_port);
}
+const char *cgit_currenturl()
+{
+ if (!ctx.qry.url)
+ return cgit_rooturl();
+ return ctx.qry.url;
+}
+
const char *cgit_rooturl()
{
if (ctx.cfg.virtual_root)
{
char *delim = "?";
- if (ctx.cfg.virtual_root)
- html_attr(ctx.cfg.virtual_root);
+ if (!page)
+ html_attr(cgit_currenturl());
else
- html_url_path(ctx.cfg.script_name);
+ html_attr(cgit_rooturl());
if (page) {
htmlf("?p=%s", page);
NULL, NULL, 0);
html("</td><td class='form'>");
html("<form method='get' action='");
- html_attr(cgit_rooturl());
+ html_attr(cgit_currenturl());
html("'>\n");
html("<input type='text' name='q' size='10' value='");
html_attr(ctx.qry.search);