diff options
| author | Kostya <mail@sartin.in> | 2026-10-10 14:12:55 +0300 |
|---|---|---|
| committer | Kostya <mail@sartin.in> | 2026-10-10 14:13:20 +0300 |
| commit | 6f0ab9c9a20b96890ed60bc168b28d29f5db39e5 (patch) | |
| tree | 51b85eab9c6b9995b8836544f54ddae861b18b06 /lib/okhttp/kotlin-stdlib-1.4.10.jar | |
| parent | 33d313e17b841db3736c465447913df0cc73d5df (diff) | |
| download | guess-market-6f0ab9c9a20b96890ed60bc168b28d29f5db39e5.tar.gz guess-market-6f0ab9c9a20b96890ed60bc168b28d29f5db39e5.tar.xz guess-market-6f0ab9c9a20b96890ed60bc168b28d29f5db39e5.zip | |
server: accept event file uploads held entirely in memory
Add POST /api/upload: a logged-in user sends a Schema v3 file as a
multipart part, its events join the market for everyone, and the
uploader becomes their Market Maker. It uses the Servlet API's own
multipart support, as the spec asks, and hands the part's stream to
the v3 loader, so validation errors (bad XML, broken Exercise 1 rules,
a name already in the market) come back as 400 with their reason.
As in Exercise 1, a file whose name does not end in .xml is refused
before it is read, since a request need not come from our client.
The spec warns that the grading server cannot write files, and Tomcat
writes any multipart part larger than @MultipartConfig's
fileSizeThreshold to a temp file. That threshold defaults to 0, so a
plain upload servlet always touches the disk. Cap uploads at 1 MB and
put the threshold above the whole request limit, so every upload stays
in memory. Bigger files get 413, requests without a session 401, and
non-multipart bodies 400.
Tomcat deletes spooled parts once the request ends, so comparing the
files before and after an upload cannot catch spooling. The test
instead watches the webapp's temp directory for any file being
created while a near-limit upload runs. It fails if the threshold is
set back to 0.
Diffstat (limited to 'lib/okhttp/kotlin-stdlib-1.4.10.jar')
0 files changed, 0 insertions, 0 deletions