HTTP HEAD Response - Setting Content Length

I am trying to create a HEAD method for one of our services so that clients can look at the type and size of content before deciding whether to download it.

How to set length of response header content? Using an HttpContext provides ContentType, Encoding, etc., but I can’t specify the length, since I believe that this value is usually added by the framework when some content is added to the response.

Is there any other way to do this, or have I incorrectly configured the length for the HEAD request - should I add a custom header to return the size of the resource?

+3
source share
1 answer

, Content-Length , . , HEAD.

: :

HEAD GET, , . , HTTP HEAD, , GET. , , -. , .

HEAD , , , . , ( Content-Length, Content-MD5, ETag Last-Modified), .

- http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.4

, . , HEAD Content-Length.

+2

Source: https://habr.com/ru/post/1715711/


All Articles