When you stream the response, it doesn't use a chunked transfer encoding? -Jon

On Thu, Feb 20, 2020 at 12:40 PM Jay McCarthy <jay.mccar...@gmail.com> wrote:
>
> I assume it is not necessary to be totally accurate, but it is good to when 
> you can, because of the Web principle of accepting broad input and producing 
> specific output. I don't know of any existing program (like a proxy or 
> something) that would fail without an accurate length, but it wouldn't 
> surprise me if there was one.
>
> Jay
>
> --
> Jay McCarthy
> Associate Professor @ CS @ UMass Lowell
> http://jeapostrophe.github.io
> Vincit qui se vincit.
>
>
> On Thu, Feb 20, 2020 at 11:17 AM Brian Adkins <br...@lojic.com> wrote:
>>
>> On Monday, December 3, 2018 at 10:49:40 AM UTC-5, Jay McCarthy wrote:
>>>
>>> > I don't know if the Racket web server (or related libraries) currently 
>>> > provide a way to stream data in the response, but that is something I'll 
>>> > definitely need relatively soon (primarily for streaming large CSV/JSON 
>>> > files). If it doesn't exist, I don't mind writing it, but I also don't 
>>> > want to begin with an approach now that might make adding that capability 
>>> > more difficult later. From my brief research, given the output field of 
>>> > the response struct is a lambda, I think I can stream using that (i.e. 
>>> > return a lambda in the response immediately that begins writing the data 
>>> > as it retrieves it) - hopefully the infrastructure doesn't buffer the 
>>> > entire output. Other than something like that, I'm happy to work mostly 
>>> > at the level of functions from requests to responses.
>>>
>>> The reason why responses have the lambda rather than a byte string is
>>> specifically for streaming like you want. Make sure you specify the
>>> correct response size in the headers.
>>
>>
>> Jay, are you sure it's necessary to specify the correct response size in the 
>> headers? This would be extremely inconvenient in a streaming response 
>> scenario. I looked at some similar code in a Rails project, and it appears 
>> I'm only setting Last-Modified, Content-Disposition and Content-Type headers.
>>
>> Yes, I know this is an old thread, but I'm just now having to stream some 
>> CSV files from the web app :)
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to racket-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/racket-users/995deb39-16f7-432e-8931-3bbae4d86bb7%40googlegroups.com.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CAJYbDa%3Dr%2BqARXUCh90Fw1b5c7XqGCyenZcO--t02vK6Sae7wLA%40mail.gmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAKfDxxx8nFCoMsWH-FbQfwGw8KgAyHqeEYdHJbN8GWmyKV3keg%40mail.gmail.com.

Reply via email to