onion icon indicating copy to clipboard operation
onion copied to clipboard

can not open mp4/mp3 by pc chrome and edge

Open demonelf opened this issue 6 years ago • 4 comments

code: example ofileserver have same problem

onion_connection_status www_resource(void *_, onion_request * req, onion_response * res) { return onion_shortcut_response_file(onion_request_get_fullpath(req) + 1, req, res); }

chrome debug:

GET /%E9%A2%84%E8%A7%88Andreea%20Balan%20Feat.Silviu-Asa%20De%20Frumos.mp3 HTTP/1.1 Host: 127.0.0.1:20002 Connection: keep-alive Pragma: no-cache Cache-Control: no-cache Accept-Encoding: identity;q=1, *;q=0 User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36 Accept: / Referer: http://127.0.0.1:20002/%E9%A2%84%E8%A7%88Andreea%20Balan%20Feat.Silviu-Asa%20De%20Frumos.mp3 Accept-Language: en,zh-CN;q=0.9,zh;q=0.8,zh-TW;q=0.7 Cookie: sessionid=12345678 Range: bytes=0-

HTTP/1.1 206 Partial Content Content-Length: 3027741 Content-Range: bytes 0-3027740/3027740 Content-Type: audio/mpeg Date: Thu, 15 Nov 2018 12:03:15 CST Etag: 2E331C-5BE7F6ADbytes=0- Server: libonion v0.8.121.9dc1f - coralbits.com

program

[625D3700] [2018-11-15 12:03:15] [INFO response.c:195] [127.0.0.1] "GET /预览Andreea Balan Feat.Silviu-Asa De Frumos.mp3" 200 3027740 (Keep-Alive) [625D3700] [2018-11-15 12:03:15] [ERROR shortcuts.c:266] Could not send all file (Transport endpoint is not connected) [625D3700] [2018-11-15 12:03:15] [WARNING response.c:223] Trying to set length after headers sent. Undefined onion behaviour. [625D3700] [2018-11-15 12:03:15] [INFO response.c:195] [127.0.0.1] "GET /预览Andreea Balan Feat.Silviu-Asa De Frumos.mp3" 500 73 (Close connection)

demonelf avatar Nov 15 '18 04:11 demonelf

In the same case, Mobile phone ok

demonelf avatar Nov 15 '18 04:11 demonelf

Is it a Keep-Alive problem?

demonelf avatar Nov 15 '18 10:11 demonelf

I'm no sure that it could be. If it uses the sendfile syscall it may get confused.. not sure.

Can you try to disable sendfile (envvar ONION_SENDFILE=0) and/or keep alive (onion_request_set_no_keep_alive(req))?

If any of these work tell me to look closely.

David.

davidmoreno avatar Nov 15 '18 11:11 davidmoreno

i test biger than 2G mp4 file and can not play by browser(chome / edge) add onion_request_set_no_keep_alive(req) same but Local player can play This problem is difficult for me. because i don't know mechanism that browser how to play video I test onion_response_write can play onion_shortcut_response_file didn't work but don't have Range function

thank you David

demonelf avatar Nov 16 '18 01:11 demonelf