Ranges
Note
Because ASPX pages don't support ranges natively (see below), instead of writing a new handler I've created a static HTML page that should be served directly and will
allow ranges. There's a link here on how to do it (linked from the blog below): http://dotnetslackers.com/articles/aspnet/Range-Specific-Requests-in-ASP-NET.aspx, but that page doesn't exist so need to use the wayback machine.
The new static page can be found here, but use PostMan to test this.
This page will hopefully enable me to test the range header to test issue 2388.
206 Response Codes – So, I can reproduce sending a request to a server to only return 1000 bytes and it works on a test page on my local IIS (Ranges must be enabled by default, or I configured it and I’ve forgotten I did!).
I have a theory as to what might be happening with IDOX. I suspect there’s a JavaScript call that is asking for chunks of data, let’s say it runs in a loop and gets 1000 bytes each time:
- First Request: bytes=0-999,
- Second Request: bytes = 1000-1999
Etc.
But what happens if during the first request we actually send back 1003 bytes because we’ve modified the data? It asked for 1000 bytes, we’ve modified what we got from the base site, and we return 1003 bytes.
By the time the second request comes along, they ask for bytes 1000 to 1999, but we’ve already sent them four of those bytes and when they come to combine the data they’ve got too much, their JavaScript doesn’t care though, all it cares about is it’s asked for 1000 bytes and it got some bytes back. I need to prove that theory by creating a test page that has replacements in it and then asking for a range of bytes.
The key is realising that it’s a range of bytes, not a number of bytes – the client can ask for bytes 0 to 999 and then 1000 to 1999 we can even ask for bytes 0-10 and then 100-499 if we wanted to be completely insane!
Of course all the above is just an idea, as Richard pointed out - we're only seeing one request in fiddler and if the above was happening surely we'd see more requests? This page is an attempt to see if I can debug the WSM to see what's going on and to see if we can fix it when it does happen.
To test this you need to use Postman to generate the request and add the following header: Range, bytes=0-100
An update; I read this article: https://blogs.visigo.com/chriscoulson/easy-handling-of-http-range-requests-in-asp-net/ and this paragraph jumped out at me:
IIS 7 supports range requests natively, so if you are simply serving the video files directly from IIS you won’t have any problems. In this case, all file requests were being served by an ASPX page – it looked up information in a database as well as did some authorization checking before returning the file. Unfortunately range requests are not natively supported from aspx responses – they have to be handled manually.