git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: "brian m. carlson" <sandals@crustytoothpaste.net>
Cc: git@vger.kernel.org, mhagger@alum.mit.edu, peff@peff.net,
	jkoleszar@google.com, gitster@pobox.com
Subject: Re: [PATCH] http-backend: provide Allow header for 405
Date: Sun, 8 Sep 2013 21:18:12 -0700	[thread overview]
Message-ID: <20130909041812.GA3430@elie.Belkin> (raw)
In-Reply-To: <1378664106-95936-1-git-send-email-sandals@crustytoothpaste.net>

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

  reply	other threads:[~2013-09-09  4:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-08 18:15 [PATCH] http-backend: provide Allow header for 405 brian m. carlson
2013-09-09  4:18 ` Jonathan Nieder [this message]
2013-09-11  2:14   ` brian m. carlson
2013-09-10  6:24 ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130909041812.GA3430@elie.Belkin \
    --to=jrnieder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jkoleszar@google.com \
    --cc=mhagger@alum.mit.edu \
    --cc=peff@peff.net \
    --cc=sandals@crustytoothpaste.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).