Commit Diff


commit - fdea6aa0bca24f6f947e2126ce101fd59caa7a31
commit + 737a6b50c599460a5e69c8a89e41f9881ff07f88
blob - f6c4288ba7c6a77e42712f451cc92f9dc06a02dd
blob + 580f507be68041217931b1de0f2fc98f92d3ee29
--- ChangeLog
+++ ChangeLog
@@ -1,4 +1,6 @@
 2021-04-30  Omar Polo  <op@omarpolo.com>
+
+	* server.c (fmt_sbuf): ensure %p (path) is always absolute
 
 	* gmid.c (load_vhosts): allow ``root'' rule to be specified per-location block
 
blob - 53f154981a51d0c6f424563b4272a62d4410f025
blob + 5e61d2a4327e4c1bc365deefbda815b2a0a84332
--- regress/runtime
+++ regress/runtime
@@ -271,7 +271,7 @@ restart
 eq "$(head /dir/foo.gmi)"	"40 % /foo.gmi  10965 localhost test"
 echo OK GET /dir/foo.gmi with strip and block
 
-eq "$(head /bigfile)"		"40 %   10965 localhost test"
+eq "$(head /bigfile)"		"40 % /  10965 localhost test"
 echo OK GET /bigfile with strip and block
 
 check "should be running"
blob - 60d1da89e8af270710e78b6adaf856ed25f9a56f
blob + 79c7d9cd40b139087bcbc8fd064ab1f6aaa77a7f
--- server.c
+++ server.c
@@ -514,6 +514,8 @@ fmt_sbuf(const char *fmt, struct client *c, const char
 			strlcat(c->sbuf, "%", sizeof(c->sbuf));
 			break;
 		case 'p':
+			if (*path != '/')
+				strlcat(c->sbuf, "/", sizeof(c->sbuf));
 			strlcat(c->sbuf, path, sizeof(c->sbuf));
 			break;
 		case 'q':