HTTP HEAD request with Range Header

2019-02-27 21:54发布

问题:

I am working on a DLNA Server using IIS as Server for media. Some DLNA Client sends a http HEAD request with a range Header :

Command: HEAD

+ URI: /RicDLNA/Streamer.ashx?media=/Videos/Guca%20Distant%20Trumpet/Gucha%20Distant%20Trumpet.mp4 ProtocolVersion: HTTP/1.1 Host: 192.168.1.100 range: bytes=0- transferMode.dlna.org: Streaming HeaderEnd: CRLF

I respond only with "Accept-Ranges Bytes". But IIS delivers a statuscode 416 error. It looks that this error Status prevents the client to continue.

  1. Is it allowed to send such a range Header in a HEAD request ?
  2. What shall i response that the client knows that ranges are supported and invoiding the IIS generated statuscode 416.
  3. Is there a possibility to override bad IIS statuscode with an OK status ?

回答1:

In ietf.org RFC7233 section 3.1 Range you can find the excerpt

A server must ignore a Range header field received with a request method other than GET

To me this means as much as : you can make a range-request with a HEAD command, but your server must ignore it.