Question

I have a problem that is difficult to reproduce in a smaller test case, but here is the basic description:

  1. I'm running Perl's Twiggy web server as root, bound to port 81.

  2. I use Plack::App::File->(root => "/my/directory") as the default web application to serve static content from /my/directory/...

  3. For small files, this works fine, but for larger files (say, over 30kB or so) the output is pretty reliably truncated by a 400 Bad Request error. For example, I'm requesting /my.css, which serves the beginning of /my/directory/my.css, but ends with:

    .rowH a:link, .rowH a:visited, .rowH a:hover, .rowH a:active {
        color:#0066CC;
    }
    .rowI { background-color:#99CCFF;}
    .rowN { background-color:#FDC651;}
    .rowZ { background-color: #f5f2EA; }/*F7F5de*/
    
    .disabled { backgrouHTTP/1.0 400 Bad Request
    Content-Type: text/plain
    

I would expect Twiggy to serve the entire file rather than truncating it as above.

I tried working through Twiggy/Server.pm to see what happens for serving filehandles, but I got lost. :(

Was it helpful?

Solution

I found that the error was caused when I tried to drop privileges from root to another user. Leaving it as root, or running on an unprivileged port with a NAT redirection to port 81 solved my problem.

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