git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Sep 11, 2013, 02:14 UTC
Message-ID
<20130911021359.GA118418@vauxhall.crustytoothpaste.net>
In-Reply-To
<20130909041812.GA3430@elie.Belkin>
On Sun, Sep 08, 2013 at 09:18:12PM -0700, Jonathan Nieder wrote:
Show 26 quoted lines
> > --- 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.
I plan on doing a reroll tomorrow.
-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
Previous: Jonathan NiederNext: Jeff King
Message 3 of 4 in “http-backend: provide Allow header for 405”
  1. http-backend: provide Allow header for 405brian m. carlson, Sep 8, 2013
  2. Jonathan NiederSep 9, 2013
  3. brian m. carlsonSep 11, 2013
  4. Jeff KingSep 10, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.