summaryrefslogtreecommitdiffabout
authorLars Hjemli <hjemli@gmail.com>2011-03-05 13:01:59 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2011-03-05 13:01:59 (UTC)
commit1b09cbd303d889ec2636127584d57b7f1b70c25e (patch) (side-by-side diff)
tree2b1188f946451d06af4d9120cbc3ba34de716f21
parent979c460e7f71d153ae79da67b8b21c3412f0fe02 (diff)
parent9e849950dc7c1f2fb6ffa62ab65bd30f35717d13 (diff)
downloadcgit-1b09cbd303d889ec2636127584d57b7f1b70c25e.zip
cgit-1b09cbd303d889ec2636127584d57b7f1b70c25e.tar.gz
cgit-1b09cbd303d889ec2636127584d57b7f1b70c25e.tar.bz2
Merge branch 'stable'
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile4
-rw-r--r--cgit.c5
-rw-r--r--html.c2
-rw-r--r--ui-shared.c2
4 files changed, 7 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index a988751..14b4df4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,13 @@
-CGIT_VERSION = v0.8.3.4
+CGIT_VERSION = v0.8.3.5
CGIT_SCRIPT_NAME = cgit.cgi
CGIT_SCRIPT_PATH = /var/www/htdocs/cgit
CGIT_DATA_PATH = $(CGIT_SCRIPT_PATH)
CGIT_CONFIG = /etc/cgitrc
CACHE_ROOT = /var/cache/cgit
prefix = /usr
libdir = $(prefix)/lib
filterdir = $(libdir)/cgit/filters
docdir = $(prefix)/share/doc/cgit
htmldir = $(docdir)
pdfdir = $(docdir)
mandir = $(prefix)/share/man
@@ -232,13 +232,13 @@ $(DOC_HTML): %.html : %.txt
a2x -f xhtml --stylesheet=cgit-doc.css $<
$(DOC_PDF): %.pdf : %.txt
a2x -f pdf cgitrc.5.txt
clean: clean-doc
rm -f cgit VERSION *.o *.d
clean-doc:
rm -f cgitrc.5 cgitrc.5.html cgitrc.5.pdf cgitrc.5.xml cgitrc.5.fo
get-git:
- curl $(GIT_URL) | tar -xj && rm -rf git && mv git-$(GIT_VER) git
+ curl $(GIT_URL) | tar -xjf - && rm -rf git && mv git-$(GIT_VER) git
diff --git a/cgit.c b/cgit.c
index 916feb4..f4dd6ef 100644
--- a/cgit.c
+++ b/cgit.c
@@ -743,28 +743,29 @@ int main(int argc, const char **argv)
prepare_context(&ctx);
cgit_repolist.length = 0;
cgit_repolist.count = 0;
cgit_repolist.repos = NULL;
cgit_parse_args(argc, argv);
parse_configfile(expand_macros(ctx.env.cgit_config), config_cb);
ctx.repo = NULL;
http_parse_querystring(ctx.qry.raw, querystring_cb);
/* If virtual-root isn't specified in cgitrc, lets pretend
- * that virtual-root equals SCRIPT_NAME.
+ * that virtual-root equals SCRIPT_NAME, minus any possibly
+ * trailing slashes.
*/
if (!ctx.cfg.virtual_root)
- ctx.cfg.virtual_root = ctx.cfg.script_name;
+ ctx.cfg.virtual_root = trim_end(ctx.cfg.script_name, '/');
/* If no url parameter is specified on the querystring, lets
* use PATH_INFO as url. This allows cgit to work with virtual
* 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) {
if (path[0] == '/')
path++;
ctx.qry.url = xstrdup(path);
if (ctx.qry.raw) {
diff --git a/html.c b/html.c
index a1fe87d..a60bc13 100644
--- a/html.c
+++ b/html.c
@@ -268,25 +268,25 @@ int hextoint(char c)
char *convert_query_hexchar(char *txt)
{
int d1, d2, n;
n = strlen(txt);
if (n < 3) {
*txt = '\0';
return txt-1;
}
d1 = hextoint(*(txt+1));
d2 = hextoint(*(txt+2));
if (d1<0 || d2<0) {
- memmove(txt, txt+3, n-3);
+ memmove(txt, txt+3, n-2);
return txt-1;
} else {
*txt = d1 * 16 + d2;
memmove(txt+1, txt+3, n-2);
return txt;
}
}
int http_parse_querystring(const char *txt_, void (*fn)(const char *name, const char *value))
{
char *t, *txt, *value = NULL, c;
diff --git a/ui-shared.c b/ui-shared.c
index 7efae7a..5aa9119 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -565,25 +565,25 @@ void cgit_print_http_headers(struct cgit_context *ctx)
{
if (ctx->env.no_http && !strcmp(ctx->env.no_http, "1"))
return;
if (ctx->page.status)
htmlf("Status: %d %s\n", ctx->page.status, ctx->page.statusmsg);
if (ctx->page.mimetype && ctx->page.charset)
htmlf("Content-Type: %s; charset=%s\n", ctx->page.mimetype,
ctx->page.charset);
else if (ctx->page.mimetype)
htmlf("Content-Type: %s\n", ctx->page.mimetype);
if (ctx->page.size)
- htmlf("Content-Length: %ld\n", ctx->page.size);
+ htmlf("Content-Length: %zd\n", ctx->page.size);
if (ctx->page.filename)
htmlf("Content-Disposition: inline; filename=\"%s\"\n",
ctx->page.filename);
htmlf("Last-Modified: %s\n", http_date(ctx->page.modified));
htmlf("Expires: %s\n", http_date(ctx->page.expires));
if (ctx->page.etag)
htmlf("ETag: \"%s\"\n", ctx->page.etag);
html("\n");
if (ctx->env.request_method && !strcmp(ctx->env.request_method, "HEAD"))
exit(0);
}