Loreto Parisi
2018-11-15 09:59:33 UTC
My express node.js server does mp4 streaming with Partial HTTP Content
(206). When in Safari this works on, but not in Chrome.
My workflow it this one
Client (Chrome) :/streams/#streamID?start=12&end=34 ----> REQUEST 1 ---->
Node.js/Express --(Range)---> MediaServer ---- RESPONSE 1
(Content-Range)---> Client (Chrome) bytes
When in Chrome, the browser raises REQUEST 2 (with the wrong header "Range=
bytes 0-", while Safari will not. In fact Safari works ok, while Chrome is
not. So the problem is? Does Safari implement HTTP 206 differently and
Chrome is more strict on that? I will not expect this.
You can see the REQUEST/RESPONSE 1 and 2 here:
https://gist.github.com/loretoparisi/11680342ae7387489c720f2e7d529903
There should not be the REQUEST 2 from the browser. This request comes from
the Google Chrome page when you put in a streaming URL like mp3, etc. It
injects into the page a built-in payer (strangely it's a <video> tag, while
it should be a <audio> tag), and start that request.
Let's make an example. If you go here (this is not mine, just an example)
you will see how Chrome raises a bad request (REQUEST 2) pushing an invalid
"*Range: bytes=0-"* header in in this example:
http://www.hochmuth.com/mp3/Beethoven_12_Variation.mp3
You can see in the Console the two requests
*REQUEST 1*
GET /mp3/Beethoven_12_Variation.mp3 HTTP/1.1
Host: www.hochmuth.com
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36
Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Referer: http://www.hochmuth.com/mp3-samples.htm
Accept-Encoding: gzip, deflate
Accept-Language:
it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7,es;q=0.6,de;q=0.5,ru;q=0.4
*RESPONSE 1*
HTTP/1.1 200 OK
Date: Thu, 15 Nov 2018 09:52:54 GMT
Server: Apache
Last-Modified: Fri, 26 Mar 2004 15:55:11 GMT
ETag: "1d014e-3d68ac9e215c0"
*Accept-Ranges: bytes*
*Content-Length: 1900878*
Keep-Alive: timeout=2, max=200
Connection: Keep-Alive
Content-Type: audio/mpeg
*REQUEST 2*
GET /mp3/Beethoven_12_Variation.mp3 HTTP/1.1
Host: www.hochmuth.com
Connection: keep-alive
Accept-Encoding: identity;q=1, *;q=0
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36
Accept: */*
Referer: http://www.hochmuth.com/mp3/Beethoven_12_Variation.mp3
Accept-Language:
it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7,es;q=0.6,de;q=0.5,ru;q=0.4
*Range: bytes=0- <----------- HERE!!!! IT's CHROME BUG THEN ?!?*
*RESPONSE 2*
HTTP/1.1 206 Partial Content
Date: Thu, 15 Nov 2018 09:52:55 GMT
Server: Apache
Last-Modified: Fri, 26 Mar 2004 15:55:11 GMT
ETag: "1d014e-3d68ac9e215c0"
Accept-Ranges: bytes
Keep-Alive: timeout=2, max=200
Connection: Keep-Alive
Content-Type: audio/mpeg
*Content-Range: bytes 0-1900877/1900878*
*Content-Length: 1900878*
(206). When in Safari this works on, but not in Chrome.
My workflow it this one
Client (Chrome) :/streams/#streamID?start=12&end=34 ----> REQUEST 1 ---->
Node.js/Express --(Range)---> MediaServer ---- RESPONSE 1
(Content-Range)---> Client (Chrome) bytes
When in Chrome, the browser raises REQUEST 2 (with the wrong header "Range=
bytes 0-", while Safari will not. In fact Safari works ok, while Chrome is
not. So the problem is? Does Safari implement HTTP 206 differently and
Chrome is more strict on that? I will not expect this.
You can see the REQUEST/RESPONSE 1 and 2 here:
https://gist.github.com/loretoparisi/11680342ae7387489c720f2e7d529903
There should not be the REQUEST 2 from the browser. This request comes from
the Google Chrome page when you put in a streaming URL like mp3, etc. It
injects into the page a built-in payer (strangely it's a <video> tag, while
it should be a <audio> tag), and start that request.
Let's make an example. If you go here (this is not mine, just an example)
you will see how Chrome raises a bad request (REQUEST 2) pushing an invalid
"*Range: bytes=0-"* header in in this example:
http://www.hochmuth.com/mp3/Beethoven_12_Variation.mp3
You can see in the Console the two requests
*REQUEST 1*
GET /mp3/Beethoven_12_Variation.mp3 HTTP/1.1
Host: www.hochmuth.com
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36
Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Referer: http://www.hochmuth.com/mp3-samples.htm
Accept-Encoding: gzip, deflate
Accept-Language:
it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7,es;q=0.6,de;q=0.5,ru;q=0.4
*RESPONSE 1*
HTTP/1.1 200 OK
Date: Thu, 15 Nov 2018 09:52:54 GMT
Server: Apache
Last-Modified: Fri, 26 Mar 2004 15:55:11 GMT
ETag: "1d014e-3d68ac9e215c0"
*Accept-Ranges: bytes*
*Content-Length: 1900878*
Keep-Alive: timeout=2, max=200
Connection: Keep-Alive
Content-Type: audio/mpeg
*REQUEST 2*
GET /mp3/Beethoven_12_Variation.mp3 HTTP/1.1
Host: www.hochmuth.com
Connection: keep-alive
Accept-Encoding: identity;q=1, *;q=0
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36
Accept: */*
Referer: http://www.hochmuth.com/mp3/Beethoven_12_Variation.mp3
Accept-Language:
it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7,es;q=0.6,de;q=0.5,ru;q=0.4
*Range: bytes=0- <----------- HERE!!!! IT's CHROME BUG THEN ?!?*
*RESPONSE 2*
HTTP/1.1 206 Partial Content
Date: Thu, 15 Nov 2018 09:52:55 GMT
Server: Apache
Last-Modified: Fri, 26 Mar 2004 15:55:11 GMT
ETag: "1d014e-3d68ac9e215c0"
Accept-Ranges: bytes
Keep-Alive: timeout=2, max=200
Connection: Keep-Alive
Content-Type: audio/mpeg
*Content-Range: bytes 0-1900877/1900878*
*Content-Length: 1900878*
--
--
Chromium Developers mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev+***@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/5437bdb3-700f-47fd-b632-5b3769f5430e%40chromium.org.
--
Chromium Developers mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev+***@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/5437bdb3-700f-47fd-b632-5b3769f5430e%40chromium.org.