I noticed that loading videos using a HTML5 <video> tag didn't work when I hosted my application through svelte-adapter-bun.
After a while, I figured out that all 206 partial content responses had one byte less than expected. This ended in a infinite-loop of 1-byte requests that got a 0-byte response back.
For example, this request:
GET /video/example.mp4 HTTP/1.1
Range: bytes=5742303-
...after which my browser just sends the same request again and again.
Eventually, I found the bug in svelte-adapter-bun, which creates a slice of a file using the inclusive end definition for a slice constructor that expects an exclusive definition. A classic off-by-one error :)
@gornostay25 Please take a look at my PR #64 to fix that.
Hi!
TLDR: I found a bug and here is the fix: https://github.com/gornostay25/svelte-adapter-bun/pull/64
Context:
I noticed that loading videos using a HTML5 <video> tag didn't work when I hosted my application through svelte-adapter-bun.
After a while, I figured out that all 206 partial content responses had one byte less than expected. This ended in a infinite-loop of 1-byte requests that got a 0-byte response back.
For example, this request:
I would get back
...after which my browser just sends the same request again and again.
Eventually, I found the bug in svelte-adapter-bun, which creates a slice of a file using the inclusive end definition for a slice constructor that expects an exclusive definition. A classic off-by-one error :)
@gornostay25 Please take a look at my PR #64 to fix that.