Question

How to set up Perl Dancer to answer with HTTP/1.1 per default? I just started a hello world app, fired my curl using HTTP/1.1 and it answers with HTTP/1.0.

foo@deathstar:~/MyWeb-App/lib/MyWeb$ curl -v http://localhost:3000

About to connect() to localhost port 3000 (#0)
> *   Trying 127.0.0.1... connected
> * GET / HTTP/1.1
> User-Agent: curl/7.22.0 (i686-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
>  Host: localhost:3000
> Accept: */*
> HTTP 1.0, assume close after body < HTTP/1.0 200 OK < Server: Perl Dancer 1.311 < Content-Length: 5601 < Content-Type: text/html;
> charset=utf-8 < X-Powered-By: Perl Dancer 1.311
Was it helpful?

Solution

It looks like the HTTP protocol is hard-coded in HTTP::Server::Simple::PSGI, which is what Dancer uses when running in standalone mode.

https://metacpan.org/module/Dancer::Deployment has details on options for deploying apps.

As a quick test, I did plackup -s Starman -a ./hello_world.pl and it answered with HTTP/1.1 instead of HTTP/1.0.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top