Re: [PATCH] http-backend: provide Allow header for 405

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

brian m. carlson wrote:

> --- a/http-backend.c
> +++ b/http-backend.c
> @@ -594,8 +594,11 @@ int main(int argc, char **argv)
>  
>  			if (strcmp(method, c->method)) {
>  				const char *proto = getenv("SERVER_PROTOCOL");
> -				if (proto && !strcmp(proto, "HTTP/1.1"))
> +				if (proto && !strcmp(proto, "HTTP/1.1")) {
>  					http_status(405, "Method Not Allowed");
> +					hdr_str("Allow", !strcmp("GET", c->method) ?
> +						"GET, HEAD" : c->method);
> +				}
>  				else

Small style nit: the closing brace should go on the same line as the
"else", like so:

				if (proto && ...) {
					...
				} else
					http_status(400, "Bad Request");

Another micronit: the comparison should be !strcmp(c->method, "GET")
--- variable first, then constant it is being compared to.

The functional change looks good.

Thanks,
Jonathan
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]