What response header should the HTTP HEAD method get for the dynamically generated file?

The http spec says the HEAD request:

The HEAD method is identical to GET, except that the server SHOULD NOT return the message body in response. The meta information contained in the HTTP headers in response to the HEAD request MUST be the same as the information sent in response to the GET request.

And also :

The Content-Length entity-header field indicates the size of the entity-body, in decimal number of OCTETs sent to the recipient or in the case of the HEAD method, the size of the body of the object that was sent if the request was GET.

So, if the requested resource is dynamically generated for a query HEADis to create a resource of ALSO ? Should a title Content-Lengthor Transfer-Encoding: chunkedtitle?

(I feel this is about how to implement the HTTP protocol.)

ADD 1

I do not see specification mandates whether tosend a Content-Length header or how tosend it for a dynamically generated resource. Such a dynamic resource will be sent with encoding with a short transmission, and GETthere will be no header when using the method Content-Length. Thus, if the HEAD response should simulate a GET response, then the Contnet-Length should not be sent either.

0
source share
1 answer

a) HTTP. W3C RFC 2616 1999 .

b) . https://greenbytes.de/tech/webdav/rfc7231.html#HEAD

: , , Content-Length HEAD, .

+1

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


All Articles