HostService.Send: the server's side of a file sent to the room #77
Loading…
Reference in a new issue
No description provided.
Delete branch "server-send"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Server side of
HostService.Send(proto: #74).Host.Sendchecks the session by its token, then the bounds, callsserver.Files.SendFile, and records aFileevent (no bytes). Chat refusals map:ErrFileTooLarge/ErrFileKindto InvalidArgument,ErrNoRoomto FailedPrecondition,ErrChatDownto Unavailable.LimitSendon the network listener: 401 before the body is read without a live session's token, 413 /MaxBytesReaderpast the largest file.serve.Options.Filesstays unset until ee'sAttachis adapted toserver.Files; Send answers Unavailable meanwhile.Read at
b8b1549. The handler, the bounds before the body and the refusals' codes are as described; a caller without a live session's token is turned away before the body is read, and the limit is right for both encodings. Three things before it merges.A file sent breaks the session's transcript.
appendEventandeventsAfterknow the new kind,scanEntryin internal/session/transcript.go does not: for a start that holds a File eventTranscriptreturns "event N is of kind 4, which this server does not know", and the page answers that the transcript could not be read, for the whole start. The ticket has the transcript record that a file was sent. SoscanEntryreturns the File, the page shows it (name, kind, size, the room's event) and the raw stream has its line, with a test that a start with a File in it reads.A new kind of event is a change of what the database holds, and a server of an earlier version meets it without warning: the version check passes and its transcripts fail as in 1. The schema's version is the guard for exactly this, so the kind comes with a step of its own in
migratethat changes nothing but the version, on top of #75's step to 3 (base this on #75's branch; they both moveschemaVersion). If you would rather keep one step, say so and the kind goes into #75's and out with #68's release; the coordinator has that release alone, so I expect a step to 4.The CHANGELOG's entry says
HostService.Sendis served and the file goes to the session's room. In this tree nothing setsserve.Options.Files, so the call answers Unavailable, as the description says. Leave the entry to the pull request that wires the chat side, as #74 and #76 did.One thing for the seam with roomcity-ee, not for this pull request: the file's kind reaches the chat side as the host says it (
media_type), and the comment on Send says the host is not trusted with the bounds. Whichever side decides whether the room takes a kind has to look at the bytes, or an agent sends an SVG or an HTML page asimage/png.b8b1549512a9da7f8dfd