Skip to content

HEAD request on a static file should return Content-Length #137

@ihipop

Description

@ihipop

RFC 9110

Section 9.3.2.

HEAD

The HEAD method is identical to GET except that the server MUST NOT send a message body in the response.

The server SHOULD send the same header fields in response to a HEAD request as it would have sent if the request had been a GET, except that the payload header fields (Section 6.4) MAY be omitted.

This method can be used for obtaining metadata about the selected representation without transferring the representation data.

https://www.rfc-editor.org/rfc/rfc9110#section-9.3.2:~:text=the%20server%20should%20send%20the%20same%20header%20fields%20in%20response%20to%20a%20head%20request%20as%20it%20would%20have%20sent%20if%20the%20request%20method%20had%20been%20get

curl -I 'http://192.168.0.214:9091/original.mkv'
HTTP/1.1 200 OK
Accept-Ranges: bytes
content-type: video/x-matroska
Content-Length: 0
Cache-Control: public, max-age=604800
Last-Modified: Tue, 29 Jul 2025 01:15:23 GMT
ETag: W/"6984d317-688820ab.0"
Date: Wed, 30 Jul 2025 16:26:56 GMT
curl -s -D - -o /dev/null http://192.168.0.214:9091/original.mkv
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Type: video/x-matroska
Content-Length: 229630
Cache-Control: public, max-age=604800
Last-Modified: Wed, 30 Jul 2025 16:28:04 GMT
ETag: W/"380fe-688a4814.0"
Date: Wed, 30 Jul 2025 16:30:21 GMT
simple-http-server -V    
Simple HTTP(s) Server 0.6.13

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions