stakach / IIS-X-Sendfile-plugin

Provides X-Sendfile functionality for IIS7.x
MIT License
22 stars 18 forks source link

Byte-range requests and Content-length #3

Closed dhastings closed 8 years ago

dhastings commented 9 years ago

Hi there,

First off, thank you for creating this plugin, I appreciate your work very much on this.

I noticed an issue with the response headers returned by the plugin. If I make a request with: Range: bytes=0-1 on a file that is 50000 bytes, the response shows Content-Length: 50000 when it should show Content-Length: 2

In your code on line 101: response.AddHeader("Content-Length", file.Length.ToString());

If a byte-range request is detected, it should use the length of the range instead of the length of the file.

I'd make this change myself but I don't develop in C# or .NET and don't have the appropriate tools. If you make the change I'll test it straight away.

Once again, thanks greatly for your work!

stakach commented 9 years ago

I wrote the code awhile back: 8c64aaa38083d3e16841ebec14e22690e3fc22d1 I'm not sure it works however and I now use cloud blob storage so don't actually maintain this plugin anymore.

If you download the free visual studio community https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx it should compile

boughtonp commented 8 years ago

That commit doesn't compile here (mainly a bunch of errors about System.Web.stuff is inaccessible due to its protection level, plus a couple of others), at least in Xamarin Studio (MonoDevelop) and .NET v4.6

Since we need a bunch of other features I'll see about getting Range support working too - a suitable test case (e.g. a sample file plus curl/wget commands and the expected response) would help with that.

Stephen, since you're not maintaining the plugin, should I bother with any pull requests, or just copy the issue onto my fork and deal with it there?

stakach commented 8 years ago

I'll make you an admin of the repo - done

boughtonp commented 8 years ago

Cool. I'm making progress but may be a while before I get things properly done and pushed.

If anyone wants this and I haven't given an update do feel free to prod me.

smcguire36 commented 8 years ago

I would LOVE to have range request support and would be happy to test it for you! Just let me know when the code is updated and I will pull and test on my system.

stakach commented 8 years ago

I pushed an update that compiles. I don't use IIS at my current job these days so it's not tested. Let me know if it works for you

smcguire36 commented 8 years ago

Thanks. I will try it out and let you know.

smcguire36 commented 8 years ago

Update: I tested it out and it works perfectly! Thanks for this update! This is exactly what I needed to be able to offload video streaming (with proper DLNA skip support) out of my ColdFusion process and into IIS.

stakach commented 8 years ago

Awesome! Thanks for testing it out