]> mj.ucw.cz Git - eval.git/commitdiff
Maximum submission size is now configurable per task.
authorMartin Mares <mj@ucw.cz>
Thu, 28 Jun 2007 18:06:54 +0000 (20:06 +0200)
committerMartin Mares <mj@ucw.cz>
Thu, 28 Jun 2007 18:06:54 +0000 (20:06 +0200)
TODO
submit/commands.c
submit/config
submit/submitd.h
submit/tasks.c

diff --git a/TODO b/TODO
index c800a3b95cad90a7cacd3cc221ba1e025da791d1..88be08ff9e87f20a1162e4c5ef39f5e605cbd6c7 100644 (file)
--- 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)
index 9542a19983012ef103347242e3f1aec3ba2dc01e..cf4ace6dd842af8d2a2efeeb812ab3f03f37b3bd 100644 (file)
@@ -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;
 
index 2581bfb2fe7d0d2d791dd5e8f458df2e9233c41b..02dcc543317fc3fdc8a923896d437963f4c2cc7c 100644 (file)
@@ -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
index 13524229603b5c5fcb902c78ac79dc6b9277f6be..e3ae41ed5dee0942f3a98a5a0e71c7c6d1c43ca6 100644 (file)
@@ -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)
 };
index 675f4d8a471f5d5f95b6954abd1e3addcabe3da0..00df760f0882bbb76d1d6a55fd9d08cbf49b942a 100644 (file)
@@ -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
   }
 };