pallas
pallas copied to clipboard
http proc changes after stream-parsing is complete
We would like to improve the handling of parsing TCP packets / HTTP messages. Once that is done (https://github.com/operating-function/pallas/issues/22), the below functions would need to be refactored or removed. This issue is a collection of those message signatures (not using line numbers as they are subject to change)
Main offender:
; TODO: this is a sort of crummy pattern. Each of the parseAndSet* things below
; runs every time, and each of those (see their bodies) have some repeated
; logic for dealing with the _entire_ assembledData bar.
; We should do this more efficiently and in such a way that:
; - this can return a Maybe (so that a consumer knows that NONE == malformed)
; - the individual parsers aren't running unnecessarily
; - the individual parsers don't have logic from othe responsibilities mixed in
> HTTPBuffer > Bar > HTTPBuffer
= (processHttpChunk buffer chunk)
; > Bar > Bar > Maybe HTTPBuffer
; Depending on how the stream-parsing goes, if this function sticks around, it
; should be updated to return a Maybe HTTPBuffer - with the NONE case indicating
; some kind of poorly-constructed request error.
> Bar > Bar > HTTPBuffer
= (parseAndSetBody stream buffer)
; Remove once stream-parsing is complete
> HTTPBuffer > Bit
= (isMessageComplete buffer)