From: Jeff King <peff@peff.net>
To: "brian m. carlson" <sandals@crustytoothpaste.net>
Cc: git@vger.kernel.org, mhagger@alum.mit.edu, jkoleszar@google.com,
gitster@pobox.com
Subject: Re: [PATCH] http-backend: provide Allow header for 405
Date: Tue, 10 Sep 2013 02:24:00 -0400 [thread overview]
Message-ID: <20130910062359.GA19638@sigill.intra.peff.net> (raw)
In-Reply-To: <1378664106-95936-1-git-send-email-sandals@crustytoothpaste.net>
On Sun, Sep 08, 2013 at 06:15:06PM +0000, brian m. carlson wrote:
> The HTTP 1.1 standard requires an Allow header for 405 Method Not Allowed:
>
> The response MUST include an Allow header containing a list of valid methods
> for the requested resource.
>
> So provide such a header when we return a 405 to the user agent.
Makes sense.
> 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);
> + }
It took me a minute to figure out what is going on here. But we seem to
convert HEAD requests into GETs elsewhere, so any "GET" service should
be able to do either.
Looks OK to me.
-Peff
prev parent reply other threads:[~2013-09-10 6:24 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
2013-09-11 2:14 ` brian m. carlson
2013-09-10 6:24 ` Jeff King [this message]
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=20130910062359.GA19638@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jkoleszar@google.com \
--cc=mhagger@alum.mit.edu \
--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).