unit, PSGI and Mojolicous

Valentin V. Bartenev vbart at nginx.com
Wed Jan 23 22:58:12 UTC 2019


On Wednesday, 23 January 2019 22:40:55 MSK Александр Поволоцкий wrote:
> 
> On 23.01.2019 19:27, Valentin V. Bartenev wrote:
> > On Wednesday 23 January 2019 18:56:57 Александр Поволоцкий wrote:
> >> Hello
> >>
> >> I'm using Mojolicious::Lite, a Perl framework, which should support PSGI.
> >>
> >> The smallest possible app, however, does not run
> >>
> >> ===
> >> #!/usr/bin/env perl
> >> use Mojolicious::Lite;
> >> get '/' => sub {
> >>       my $c = shift;
> >> $c->render(text=>'hello');
> >> };
> >>
> >> app->start;
> >> ===
> >>
> >> 2019/01/23 09:41:23.029 [error] 26579#26579 [unit] #4: PSGI: Failed to
> >> run Perl Application:
> >> Undefined subroutine &main::1 called.
> >>
> >> plackup runs it Ok, so there is some incompatibility, which I do not
> >> know how to trace.
> >>
> >> What kind of error in framework can it be and how to trace it?
> >>
> > [..]
> >
> > https://mojolicious.org/perldoc/Mojolicious/Guides/Cookbook#PSGI-Plack
> >
> > Seems it doesn't behave like PSGI application by default,
> > unless there's a PLACK_ENV environment variable.
> >
> > Unit doesn't set PLACK_ENV by default.
> 
> Sorry for doubleposting, but I've found one strange thing.
> 
> root at VMNEW:~# telnet localhost 8000
> Trying ::1...
> Trying 127.0.0.1...
> Connected to localhost.
> Escape character is '^]'.
> GET / HTTP/1.0
> 
> HTTP/1.1 200 OK
> Content-Length: 6
> Date: Wed, 23 Jan 2019 19:31:37 GMT
> Content-Type: text/html;charset=UTF-8
> Server: Unit/1.7
> 
> Connection closed by foreign host.
> 
> when I was expecting "hello\n" to be sent as output. You see, 
> Content-Length is correct, but no actual content.
> 
[..]

We've reproduced the issue and looking into it.  Thanks for the report.

  wbr, Valentin V. Bartenev





More information about the unit mailing list