python - Why video served through CGI is not played by the browser -


i'm trying create python cgi loads videos hidden location in server , "prints" video stdout http client it's content.

here python cgi script:

import os import sys  filepath = "test_video.mp4"  print "last-modified: fri, 24 apr 2015 22:09:52 gmt" print "accept-ranges: bytes" print "content-length:", os.path.getsize(filepath) print "content-type: video/mp4\n" sys.stdout.flush() content = file(filepath, "rb").read() sys.stdout.write(content) sys.stdout.flush() 

when open link points video, google chrome, example (http://192.168.0.4/~fccoelho/mpeg/test_video.mp4) video played perfectly. when open (http://192.168.0.4/~fccoelho/mpeg/test.py) cgi script serving same file, video not played.

what odd when both wget, served file same.

i have checked headers curl:

curl -i http://192.168.0.4/~fccoelho/mpeg/test.py  http/1.1 200 ok date: fri, 24 apr 2015 23:09:34 gmt server: apache/2.4.7 (ubuntu) accept-ranges: bytes last-modified: fri, 24 apr 2015 22:09:52 gmt content-length: 32445874 content-type: video/mp4  curl -i http://192.168.0.4/~fccoelho/mpeg/test_video.mp4  http/1.1 200 ok date: fri, 24 apr 2015 23:09:55 gmt server: apache/2.4.7 (ubuntu) last-modified: fri, 24 apr 2015 22:09:52 gmt etag: "1ef15b2-5147fa7cfbd80" accept-ranges: bytes content-length: 32445874 content-type: video/mp4 

and seem compatible. give clue on why approach not working?

i have tried here in firefox , works. scares me how google chrome can behave differently receiving same response.


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -