Reputation: 163602
I am building a small embedded web server application utilizing the HttpListener class. When I serve MP3 (audio/mpeg
) documents to Chrome (and other players), often times a handful of requests are fired off, containing Range:
headers. I assume this is to support seeking of the media.
I do not wish to support range requests in my application. Is it possible to put the HttpListener
into a mode where it returns HTTP/1.0
for the protocol, so that user agents will not bother with subsequent range requests?
Alternatively, is there a proper response I can send, indicating to the client that I will not honor a range request?
Edit: I just tried the Accept-Ranges: none
headers (as defined by the RFC), but the browser made a request with a range header anyway. Perhaps there is another way?
Upvotes: 2
Views: 1152
Reputation: 70369
It seems that most clients ignore Accept-Ranges: none
when the server says that it support http 1.1 .
You can set the http version to 1.0 in your HttpListenerResponse
by
response.ProtocolVersion = new Version("1.0");
Upvotes: 2