From: Martin Mares Date: Thu, 28 Jun 2007 18:06:54 +0000 (+0200) Subject: Maximum submission size is now configurable per task. X-Git-Tag: python-dummy-working~337 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=40dcc618718643313b8f222717c4502ed33081fe;p=eval.git Maximum submission size is now configurable per task. --- diff --git a/TODO b/TODO index c800a3b..88be08f 100644 --- a/TODO +++ b/TODO @@ -26,7 +26,6 @@ New submitter: - contest: local history - contest: task status cache - utilitka, kterou si po soutezi mohou vsichni pretestovat na souteznich datech -- per-task setting of maximum submission size Various ideas: scores dependent on time (like PL olympiad) diff --git a/submit/commands.c b/submit/commands.c index 9542a19..cf4ace6 100644 --- a/submit/commands.c +++ b/submit/commands.c @@ -131,10 +131,10 @@ cmd_status(struct conn *c) /*** SUBMIT ***/ static struct fastbuf * -read_attachment(struct conn *c) +read_attachment(struct conn *c, uns max_size) { uns size = obj_find_anum(c->request, 'S', 0); - if (size > max_attachment_size) + if (size > max_size) { err(c, "Submission too large"); return NULL; @@ -198,7 +198,8 @@ cmd_submit(struct conn *c) return; } - struct fastbuf *fb = read_attachment(c); + uns max_size = task->max_size ? : max_attachment_size; + struct fastbuf *fb = read_attachment(c, max_size); if (!fb) return; diff --git a/submit/config b/submit/config index 2581bfb..02dcc54 100644 --- a/submit/config +++ b/submit/config @@ -18,6 +18,7 @@ SessionTimeout 300 MaxRequestSize 4K # Maximum size of an attachment (i.e., a submitted solution) +# This is a default, which can be overriden in task definitions. MaxAttachSize 256K # Number of bits for the Diffie-Hellman key exchange @@ -35,7 +36,7 @@ Access { # IP address range matched by this rule IP 127.0.0.1 - # Administrator access allowed + # Administrator access allowed (does not do anything yet) Admin 1 # Plain-text connections without any user authentication allowed @@ -71,7 +72,7 @@ TraceCommands 1 Tasks { # Task plans -# Task { Name world; OpenData 10; } + Task { Name world; OpenData 10; MaxSize 1M; } Task necklace Task nei diff --git a/submit/submitd.h b/submit/submitd.h index 1352422..e3ae41e 100644 --- a/submit/submitd.h +++ b/submit/submitd.h @@ -61,6 +61,7 @@ struct task { cnode n; byte *name; uns open_data; // Number of parts for open-data tasks + uns max_size; // Maximum size (0=use global default) clist parts; // List of parts of this task (simp_nodes) clist *extensions; // List of allowed extensions for this task (simp_nodes) }; diff --git a/submit/tasks.c b/submit/tasks.c index 675f4d8..00df760 100644 --- a/submit/tasks.c +++ b/submit/tasks.c @@ -50,6 +50,7 @@ static struct cf_section task_conf = { CF_ITEMS { CF_STRING("Name", PTR_TO(struct task, name)), CF_UNS("OpenData", PTR_TO(struct task, open_data)), + CF_UNS("MaxSize", PTR_TO(struct task, max_size)), CF_END } };