> "contentProgress" is ...

this is all correct.

> The await in there is somehow receiving the output of "onRecv" and once 
> "onRecv"evaluates to true, the await stops waiting and the code continues, 
> granting you now have access to the body of the request.

This is incorrect. The diff doesn't enough context, so you'd need to read this 
with httpclient.nim around it. `httpclient.recvFull` is an unexported function 
responsible for repeatedly recv'ing from a socket until it gets a certain 
number of bytes. With this patch `recvFull` also checks `onRecv` and returns 
early if that function returns true.

> You only want the first n characters of that response-body (since you might 
> not have more), so you explicitly substring whatever you received to be only 
> the n characters you want.

I think you probably understand the, but you phrased it opposite way. With my 
patch, httpclient itself doesn't limit the size of the content it returns. It 
just stops collecting content after the `onRecv` returns true. So if you want 3 
bytes you can get 1000 bytes if that's what the very first `recv` call 
returned. The substring strips off the excess.

Reply via email to