in reply to Re^7: Perl not playing video with vlc plugin
in thread Perl not playing video with vlc plugin

I added this line in starting
print "Content-type: text/plain\n\n";
The output is generated was
Content-Type: application/x-vlc-plugin Cache-Control: public, must-revalidate, max-age=0 Pragma: no-cache Accept-Ranges: bytes Content-Length: 128959310 - 0 Content-Range: bytes 0'-'128959310'/'128959310 Content-Disposition: inline; filename="lua.mp4" Content-Transfer-Encoding: binary Connection: close
I think the http headers are not giving expected output.

Replies are listed 'Best First'.
Re^9: Perl not playing video with vlc plugin
by Corion (Patriarch) on Dec 29, 2015 at 13:28 UTC

    Maybe now is a good time to find out what the supposed format of the Content-Length and Content-Range headers is. I recommend comparing the headers your script produces against the headers another web server produces for Content-Range headers for example.

    Also see Simple HTTP in under 100 lines for a small webserver that correctly (enough) implements Content-Range replies.

      I am not sure about this
      my $content_length = $end - $begin; print "Content-Type: text/html \r\n"; print "Content-Type: application/x-vlc-plugin \r\n"; print "Cache-Control: public, must-revalidate, max-age=0 \r\n"; print "Pragma: no-cache \r\n" ; print "Accept-Ranges: bytes \r\n"; print "Content-Length: $content_length", "\r\n"; print "Content-Range: bytes $begin-$end/$size \r\n"; print "Content-Disposition: inline; filename=\"$name$ext\"\r\n"; print "Content-Transfer-Encoding: binary\r\n"; print "Connection: close\r\n";
      but still it is giving internal server error

        Whenever you see "internal server error", that just means that the real error is in the web server error log.

        Why are you "not sure about this" anyway? When you run the program outside of the web server, Perl will show you the output of your program and also errors if it finds them. Do you know how to run your program outside of the web server?

        Note that HTTP headers conventionally do not have whitespace before the line breaks. Instead of

        print "Content-Type: text/html \r\n";

        you should write:

        print "Content-Type: text/html\r\n";

        (without the space before the \r\n)