dotnet / WatsonWebserver

Watson is the fastest, easiest way to build scalable RESTful web servers and services in C#.
MIT License
411 stars 84 forks source link

Watson.Lite : Partial Range Requests status labeled as Internal Server Error 500 despite being handled fine. #135

Closed GitHubProUser67 closed 4 months ago

GitHubProUser67 commented 9 months ago

In Watson.Lite, due to it's reliance on an external TCP service, allows for partial range request handling via some customised code.

However, said code, despite working fine, for some reasons print error 500 in the console logs:

image

image

Here is the demonstration of a movie streaming system in https using Watson.Lite, as you can see, works perfect, despite status 500 in the console.

Note, due to the non-lite version relying on httpListener, it is impossible to handle range request on this backend, it could be neat to indicate this in the documentation if someone wanna use it is a backend project.

GitHubProUser67 commented 9 months ago

After more testing, it can happen sometimes that it does print 206:

image

My theory is that this logger only keep tracks of finished requests, effectively sending an internal server error on a dead connection, but a range request can massively bound the interface and actually uses the same wire for multiples chunck of data, which it seems Watson.Lite is not having any issue with.

jchristn commented 9 months ago

Please share the code you have for your default request handler - seems that is where this content is being served from, correct?

jchristn commented 9 months ago

Also - range requests should 100% be supported. You would have to parse the header NameValueCollection to get access to the Range header and handle it manually. Content routes do not support it today, though.

GitHubProUser67 commented 8 months ago

Here is the code : https://github.com/GitHubProUser67/MultiServer2/blob/main/HTTPSecureServerLite/LocalFileStreamHelper.cs

So what happens is that, the handling of the range is done outside of the API itself, rather I use the API as a transmiter.

jchristn commented 4 months ago

Forgot to close this, thanks again!