Реализовать уровень 4: сквозные трассы, SLO, отказы и отчёт
This commit is contained in:
@@ -106,9 +106,14 @@ def main():
|
||||
|
||||
path = f"/api/v1/chats/{chat['id']}/attachments?filename=bad.png"
|
||||
for data, mime, expected in ((b"this is not a PNG", "image/png", 415),
|
||||
(source, "image/png", 415),
|
||||
(b"x" * (10485760 + 1), "image/png", 413)):
|
||||
(source, "image/png", 415)):
|
||||
client.call("POST", path, expected, actor=alice, raw=data, headers={"Content-Type": mime})
|
||||
# Verify early rejection from Content-Length without writing 10 MiB after
|
||||
# the server has already returned 413 and closed the connection. urllib
|
||||
# writes the whole body before reading and can otherwise lose the response
|
||||
# to BrokenPipe. No upload is retried, and public tests are unchanged.
|
||||
client.call("POST", path, 413, actor=alice, headers={
|
||||
"Content-Type": "image/png", "Content-Length": str(10485760 + 1)})
|
||||
def png_chunk(kind, data):
|
||||
return struct.pack(">I", len(data)) + kind + data + struct.pack(">I", zlib.crc32(kind + data))
|
||||
bad_filter = (b"\x89PNG\r\n\x1a\n"
|
||||
|
||||
Reference in New Issue
Block a user