diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Keep clone files and oversized responses out of the cache
The dumb transport reads files that already sit on the disk, so a pack
copied into a slot cost that disk twice and the request a second write
of every byte. A snapshot took a slot whatever its size, so a visitor
naming distinct refs and ids could fill the cache root with archives.
`cache-max-slot-size`, 64 MB unless set, now serves a larger response
from the lock file and drops it, along with any expired copy it would
have replaced.
Diffstat (limited to '')
| -rw-r--r-- | source/cmd.c | 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 10 insertions, 6 deletions
diff --git a/source/cmd.c b/source/cmd.c index a19aa50..38fe596 100644 --- a/source/cmd.c +++ b/source/cmd.c @@ -208,19 +208,23 @@ static const struct cgit_cmd commands[] = { { .name = "tree", .fn = tree_fn, .want_repo = 1, .want_vpath = 1 }, }; -const struct cgit_cmd *cgit_get_cmd(void) +const struct cgit_cmd *cgit_find_cmd(const char *name) { size_t i; + for (i = 0; i < ARRAY_SIZE(commands); i++) + if (!strcmp(name, commands[i].name)) + return &commands[i]; + return NULL; +} + +const struct cgit_cmd *cgit_get_cmd(void) +{ if (!ctx.qry.page) { if (ctx.repo) ctx.qry.page = "summary"; else ctx.qry.page = "repolist"; } - - for (i = 0; i < ARRAY_SIZE(commands); i++) - if (!strcmp(ctx.qry.page, commands[i].name)) - return &commands[i]; - return NULL; + return cgit_find_cmd(ctx.qry.page); } |
