Has anyone tried out the Apache module for XSendFile with Perl? I installed it and it seams to be working (Apache started). I have tried a few attempts using the following Perl code to download a file:
print "X-Sendfile: C:\\Path\\to\\file\\video\\";
print "Content-Type:application/octet-stream; name=\"File-12.mp4\"\r\n
print "Content-Disposition: attachment; filename=\"File-12.mp4\"\r\n\n
I'm not getting the video to download. In Chrome, I not getting the correct header, and Apache is giving me a 404 error when I run the script. I'm trying to serve large video files after the user passes muster in my app. Here is the sample PHP code I based my Perl script on.
header("Content-Disposition: attachment; filename=\"$somefile\"");
I tried to serve the file via Perl but the file is over 1.7GB and it hangs my server with an out of memory error.
Sorry where are my manners. As always, Thank You for your time and help...
Update with Solution:
I had two things wrong. The first was my Apache Config. The config must look like this in-order to work:
# enable xsendfile
The actual XsendFile On can be located in a vhost block as well, but the XSendFilePath must be located in the httpd.conf file.
My Perl header was in the wrong order. It needs to look like this:
my $file = "C:/Patch to file/FiletoSend.mp4";
my $filesize = -s $file;
# remove comment below to make file download. Add the comment to strea
+m data to player
#print "Content-Disposition: attachment; filename=\"FiletoSend.mp4\"\n
print "Content-Length: $filesize\n";
print "X-Sendfile: $file";
Now my system can stream the video after the user has been authenticated and I can create a one-time use URL.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] |