edicl/hunchentoot

400 Bad Request for HEAD

Closed this issue · 0 comments

In the master branch, Hunchentoot always returns 400 Bad Request for every HEAD requests though it returns 200 OK for GET requests.

Reproducible code

(ql:quickload :hunchentoot)
(hunchentoot:start (make-instance 'hunchentoot:easy-acceptor :port 4242))

And make an HTTP request with curl from a terminal:

$ curl -v -I http://127.0.0.1:4242/
*   Trying 127.0.0.1:4242...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 4242 (#0)
> HEAD / HTTP/1.1
> Host: localhost:4242
> User-Agent: curl/7.66.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
* HTTP 1.0, assume close after body
< HTTP/1.0 400 Bad Request
HTTP/1.0 400 Bad Request
< Connection: close
Connection: close

<
* Excess found: excess = 61 url = / (zero-length body)
* Closing connection 0

Expected behavior

Return 200 OK if the URL path exists.

Considerable reason

Probably because :head isn't in +valid-request-methods+, which was introduced by e1539f0.

Tested environment

  • SBCL v2.0.0
  • Hunchentoot at e70af07