Hello Jason,
yes you could send a wrong value and it would be
better to not answer one than a wrong one, but even better woild it
be to follow the RFC recommendation, that states that the headers of a
HEAD should be identical to those of a GET. In fact the content-length
is one of the most interesting informations one would want to query
with a HEAD request.
Gruss
Bernd
Am Fri, 13 Mar 2015 14:55:39 -0500
schrieb Jason Greene <jason.greene(a)redhat.com>:
> On Mar 13, 2015, at 2:47 PM, Bernd Eckenfels
> <ecki(a)zusammenkunft.net> wrote:
>
> Hello,
>
> with all versions I tried (including 1.2.0.Beta9) undertow-core will
> return content-length: 0 if a HEAD request is made.
>
-snip-
> < HTTP/1.1 200 OK
> < Connection: keep-alive
> < Last-Modified: Fri, 13 Mar 2015 19:24:58 GMT
> < Content-Length: 0
> < Content-Type: text/xml
> < Date: Fri, 13 Mar 2015 19:40:51 GMT
> <
> * Connection #0 to host localhost left intact
>
> According to RFC2616 sc 14.13 this needs to be non-null.
>
It’s wasting bandwidth, so we should probably not send it. However,
its a legal value:
14.13 says "Any Content-Length greater than or equal to zero is a
valid value."
--
Jason T. Greene
WildFly Lead / JBoss EAP Platform Architect
JBoss, a division of Red Hat