<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>My program outputs JSON. decode_json works fine with HTTP,
      to_json is required for PSGI.<br>
    </p>
    <div class="moz-cite-prefix">On 04.03.2019 19:03, Alexander Borisov
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:1E2F0364-6545-43EC-87B1-4FC49D62F8CD@nginx.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      Hello Alexander,<br class="">
      <div><br class="">
        <blockquote type="cite" class="">
          <div class="">4 марта 2019 г., в 14:25, Александр Поволоцкий
            <<a href="mailto:tarkhil@over.ru" class=""
              moz-do-not-send="true">tarkhil@over.ru</a>> написал(а):</div>
          <br class="Apple-interchange-newline">
          <div class="">
            <div class="">Hello<br class="">
              <br class="">
              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.<br class="">
              <br class="">
              2. UTF-8 data gets double encoded.<br class="">
            </div>
          </div>
        </blockquote>
        <div><br class="">
        </div>
        <div>I tried this example:</div>
        <div>
          <div style="color: rgb(212, 212, 212); background-color: rgb(30, 30, 30); font-family: Menlo, Monaco, "Courier New", monospace; line-height: 18px; white-space: pre;" class=""><div class=""><span style="color: #c586c0;" class="">use</span> Mojolicious::Lite;</div><div class=""><span style="color: #c586c0;" class="">use</span> Devel::StackTrace;</div><div class="">
</div><div class="">get <span style="color: #ce9178;" class="">'/'</span> => <span style="color: #569cd6;" class="">sub</span> {</div><div class="">    <span style="color: #569cd6;" class="">my</span> <span style="color: #9cdcfe;" class="">$c</span> = <span style="color: #dcdcaa;" class="">shift</span>;</div><div class="">    <span style="color: #9cdcfe;" class="">$c</span>->render(text => <span style="color: #ce9178;" class="">'Привет'</span>);</div><div class="">};</div>
<div class="">app->start;</div>
</div>
        </div>
        <div><br class="">
        </div>
        <div>Works fine for me.</div>
        <div><br class="">
        </div>
        <div>
          <div style="margin: 0px; font-stretch: normal; line-height:
            normal; font-family: Courier; color: rgb(59, 35, 34);
            background-color: rgb(215, 211, 183);" class=""><span
              style="font-variant-ligatures: no-common-ligatures"
              class="">> GET / HTTP/1.1</span></div>
          <div style="margin: 0px; font-stretch: normal; line-height:
            normal; font-family: Courier; color: rgb(59, 35, 34);
            background-color: rgb(215, 211, 183);" class=""><span
              style="font-variant-ligatures: no-common-ligatures"
              class="">> Host: localhost:8500</span></div>
          <div style="margin: 0px; font-stretch: normal; line-height:
            normal; font-family: Courier; color: rgb(59, 35, 34);
            background-color: rgb(215, 211, 183);" class=""><span
              style="font-variant-ligatures: no-common-ligatures"
              class="">> User-Agent: curl/7.54.0</span></div>
          <div style="margin: 0px; font-stretch: normal; line-height:
            normal; font-family: Courier; color: rgb(59, 35, 34);
            background-color: rgb(215, 211, 183);" class=""><span
              style="font-variant-ligatures: no-common-ligatures"
              class="">> Accept: */*</span></div>
          <div style="margin: 0px; font-stretch: normal; line-height:
            normal; font-family: Courier; color: rgb(59, 35, 34);
            background-color: rgb(215, 211, 183);" class=""><span
              style="font-variant-ligatures: no-common-ligatures"
              class="">> </span></div>
          <div style="margin: 0px; font-stretch: normal; line-height:
            normal; font-family: Courier; color: rgb(59, 35, 34);
            background-color: rgb(215, 211, 183);" class=""><span
              style="font-variant-ligatures: no-common-ligatures"
              class="">< HTTP/1.1 200 OK</span></div>
          <div style="margin: 0px; font-stretch: normal; line-height:
            normal; font-family: Courier; color: rgb(59, 35, 34);
            background-color: rgb(215, 211, 183);" class=""><span
              style="font-variant-ligatures: no-common-ligatures"
              class="">< Date: Mon, 04 Mar 2019 15:51:50 GMT</span></div>
          <div style="margin: 0px; font-stretch: normal; line-height:
            normal; font-family: Courier; color: rgb(59, 35, 34);
            background-color: rgb(215, 211, 183);" class=""><span
              style="font-variant-ligatures: no-common-ligatures"
              class="">< Content-Type: text/html;charset=UTF-8</span></div>
          <div style="margin: 0px; font-stretch: normal; line-height:
            normal; font-family: Courier; color: rgb(59, 35, 34);
            background-color: rgb(215, 211, 183);" class=""><span
              style="font-variant-ligatures: no-common-ligatures"
              class="">< Content-Length: 12</span></div>
          <div style="margin: 0px; font-stretch: normal; line-height:
            normal; font-family: Courier; color: rgb(59, 35, 34);
            background-color: rgb(215, 211, 183);" class=""><span
              style="font-variant-ligatures: no-common-ligatures"
              class="">< Server: Unit/1.8.0</span></div>
          <div style="margin: 0px; font-stretch: normal; line-height:
            normal; font-family: Courier; color: rgb(59, 35, 34);
            background-color: rgb(215, 211, 183);" class=""><span
              style="font-variant-ligatures: no-common-ligatures"
              class="">< </span></div>
          <div style="margin: 0px; font-stretch: normal; line-height:
            normal; font-family: Courier; color: rgb(59, 35, 34);
            background-color: rgb(215, 211, 183);" class=""><span
              style="font-variant-ligatures: no-common-ligatures"
              class="">* Connection #0 to host localhost left intact</span></div>
          <div style="margin: 0px; font-stretch: normal; line-height:
            normal; font-family: Courier; color: rgb(59, 35, 34);
            background-color: rgb(215, 211, 183);" class=""><span
              style="font-variant-ligatures: no-common-ligatures"
              class="">Привет</span></div>
        </div>
        <br class="">
        <blockquote type="cite" class="">
          <div class="">
            <div class=""><br class="">
              If you need, I'll make a short example.<br class="">
              <br class="">
              --<br class="">
              <br class="">
              Alex<br class="">
              <br class="">
              _______________________________________________<br
                class="">
              unit mailing list<br class="">
              <a href="mailto:unit@nginx.org" class=""
                moz-do-not-send="true">unit@nginx.org</a><br class="">
              <a class="moz-txt-link-freetext" href="https://mailman.nginx.org/mailman/listinfo/unit">https://mailman.nginx.org/mailman/listinfo/unit</a><br
                class="">
            </div>
          </div>
        </blockquote>
      </div>
      <br class="">
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
unit mailing list
<a class="moz-txt-link-abbreviated" href="mailto:unit@nginx.org">unit@nginx.org</a>
<a class="moz-txt-link-freetext" href="https://mailman.nginx.org/mailman/listinfo/unit">https://mailman.nginx.org/mailman/listinfo/unit</a></pre>
    </blockquote>
  </body>
</html>