Two more problems with Mojolicious

Александр Поволоцкий tarkhil at
Mon Mar 4 14:27:10 UTC 2019

I mean reply, body.

Well, I thought that my application does not do any assumption, but 
write_chunk seems to be not portable. So I need to patch Mojolicious to 
determine PSGI, HTTP/1.1 and HTTP/2 and write data properly, or in my 
app use write instead of write_chunk?

And the problem with double encoding concerns me even more. Looks like 
either PSGI in Mojolicious is broken, or Mojo and unit just speaks 
different dialects...

On 04.03.2019 17:12, Valentin V. Bartenev wrote:
> On Monday 04 March 2019 14:25:15 Александр Поволоцкий wrote:
>> Hello
>> 1. When I'm sending chunked content (I'm using some fairly long database
>> requests, and cursor sending lines one by one is much better in term of
>> both memory usage and response speed) is shown on client side with
>> chunks' lenghts.
> HTTP and PSGI are different.
> There's not such thing as Chunked Transfer Encoding in PSGI.
> PSGI is specifically designed to abastract application from
> transport protocol, like HTTP/1.1.
> Thus application must not do any assumption about transport
> protocol, and must not issue any connection level HTTP headers,
> must not apply any trasfer encodings.  All the body data output
> is interpreted as is (and this is required by PSGI specification).
> When PSGI application writing chunks with lengths, these chunks
> are wrapped into HTTP chunks (if allowed) by web server (Unit in
> this case) and then they are sent to client.  As a result, you
> see exactly what the application outputs.
> The protocol can be HTTP/1.0 (where no chunked transfer encoding
> is possible), or HTTP/2 as well (where chunks have completely
> different representation as binary frames of data).
> If you want to send lines one by one, you should do this in the
> application just by writing these lines as is, Unit will do all
> the work for transferring the data with proper encoding for
> particular protocol (HTTP/1.0, HTTP/1.1, or HTTP/2, HTTP/3 in
> the future).
>> 2. UTF-8 data gets double encoded.
>> If you need, I'll make a short example.
> Do you mean UTF-8 data in headers or in body?
> Request or response?
> An example would be useful.
>    wbr, Valentin V. Bartenev
> _______________________________________________
> unit mailing list
> unit at

More information about the unit mailing list