Prerequisites
Description
RFC 7231 states in section 6.5.5. 405 Method Not Allowed:
The 405 (Method Not Allowed) status code indicates that the method
received in the request-line is known by the origin server but not
supported by the target resource. The origin server MUST generate an
Allow header field in a 405 response containing a list of the target
resource's currently supported methods.
That Allow: header is not sent by libhttpserver.
Steps to Reproduce
- build with examples
- run
examples/allowing_disallowing_methods
- send POST request, e.g. with
curl -XPOST -v http://localhost:8080/hello
- inspect HTTP headers
Expected behavior: send that header based on allowed_methods member of class http_resource
Actual behavior: HTTP header Allow: is not sent
Reproduces how often: always, at least unless webserver is constructed with a custom method_not_allowed_resource.
Versions
- OS version: Debian GNU/Linux 10 (buster)
- libhttpserver version: 0.18.2-22-g263f2bd (current master)
- libmicrohttpd version: 0.9.62 (Debian package)
Additional Information
curl output (tail):
* Connected to localhost (127.0.0.1) port 8080 (#0)
> POST /hello HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.64.0
> Accept: */*
>
< HTTP/1.1 405 Method Not Allowed
< Connection: Keep-Alive
< Content-Length: 18
< Content-Type: text/plain
< Date: Tue, 09 Nov 2021 13:16:31 GMT
<
* Connection #0 to host localhost left intact
Method not Allowed
Example and explanation for allow header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Allow
Prerequisites
Description
RFC 7231 states in section 6.5.5. 405 Method Not Allowed:
That
Allow:header is not sent by libhttpserver.Steps to Reproduce
examples/allowing_disallowing_methodscurl -XPOST -v http://localhost:8080/helloExpected behavior: send that header based on
allowed_methodsmember ofclass http_resourceActual behavior: HTTP header
Allow:is not sentReproduces how often: always, at least unless webserver is constructed with a custom
method_not_allowed_resource.Versions
Additional Information
curl output (tail):
Example and explanation for allow header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Allow