Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
EOF problem with Dancer streaming proxyby dsheroh (Monsignor) |
on Jan 12, 2017 at 13:59 UTC ( [id://1179444]=perlquestion: print w/replies, xml ) | Need Help?? |
dsheroh has asked for the wisdom of the Perl Monks concerning the following question:
I have a system which needs to act as a proxy to another of our servers, mainly for legacy support reasons. With the help of Dancer as a proxy, I've managed to get it mostly working with the following code:
I say "mostly working" because, while the files are streamed successfully and browsers will accept them without complaint, wget and curl are less forgiving. Both of these command-line programs issue errors after the file is (successfully) received: The byte at which wget reports the read error is always the last byte of the file (i.e., equal to the file size), leading me to suspect that an EOF marker isn't being handled properly. Possibly also relevant is that, while the proxying code copies the Content-Length header from the original source, the original source does not provide that header, so Content-Length is not actually set. Using curl/wget to download the file directly from the original source works perfectly with no error messages issued. Does anyone have any insights as to what the cause of the problem might be? Edit: On further investigation, the problem does not appear to be with Dancer itself. Testing with Dancer's internal mini-server (using bin/app.pl) does not exhibit this problem. It only shows up in the production environment, which has Apache <-> Starman <-> Dancer. So now to work out whether the issue is with one of the other components individually or with the interactions between them.
Back to
Seekers of Perl Wisdom
|
|