-
Notifications
You must be signed in to change notification settings - Fork 191
Rolling Notes
==== scenarios -- request related
is the request body rewindable?
form reading should induce rewindability if not present?
-- response
is the response body resettable?
- Response.Body.CanSeek
is the response body immediately transferring?
- don't need to know - you only need to ask for immediate writes, not detect it
how does the application induce immediate transferring before writing? how does application code use the response to assume output is sent incrementally?
- Response.WriteTheFlippingBytesIGiveYou()
- IWTFBIGYFeature.EnsureWTFBIGY()
how does the application or software ensure (1) buffering?
- middleware wraps stream
- wrapper also hooks WTFBIGY to flip back to immediage mode again
how would something like MVC do a quick-push at a flush-point? fwk would induce WTFBIGY mode, and have a memory stream that it drops to actual Response.Body at marks
how does middleware introduce a transfer-encoding or content-encoding?
how do servers and software interact with ownership of certain response headers? Content-Length: x App sets it, this stops server from doing chunked/close modes Transfer-Encoding: chunked If software adds chunked transfer-encoding, software has chunked and server is pass-through *** need to figure out what Transfer-Encoding: gzip without encoding Connection: close If app sets it, server will close socket when body has ended
how does application know what stream behaviors are in effect?
how does the application understand what response body mode is in effect?
what control does the application or middleware?
==== first class api- bool HttpResponse.CanReset { true if Response.Body.CanSeek && !ResponseHeadersSent } bool HttpResponse.TryReset() { reset body and headers. }
implicit API- Response.Headers.Clear -> reasonable best-effort of server to return to original state
Response.Body.Length || Response.Body.Position get -> cumulative bytes sent via Write, WriteAsync, and SendFile
Response.Body.CanSeek -> indicate resetability
(if CanSeek) Response.Body.Seek(0) || Response.Body.Position set = 0 -> induce reset, reverting completely
==== concept notes --- response buffering style
-
write with complete internal buildup and exit-path transfer (fully buffered)
-
write with internal buildup and size-based transfer (page-ish writing)
-
write with internal buildup and immediate transfer (async write-behind)
-
write with immediate transfer (sync write-inline)
--- entity body modes Content-Length: x Transfer-Encoding: chunked Connection: close NONE (based on request verb (HEAD) or response status ) Upgrade: (approximately == Connection: close)