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

Re: [PATCH] Get commits from remote repositories by HTTP

From
MMMartin Mares <mj@ucw.cz>
Date
Apr 16, 2005, 22:17 UTC
Message-ID
<20050416221745.GA10280@ucw.cz>
In-Reply-To
<Pine.LNX.4.21.0504161750020.30848-100000@iabervon.org>
Hello!
> This adds a program to download a commit, the trees, and the blobs in them
> from a remote repository using HTTP. It skips anything you already have.

Is it really necessary to write your own HTTP downloader? If so, is it necessary to forget basic stuff like the "Host:" header? ;-)

If you feel that it should be optimized for speed, then at least use persistent connections.

> +	if (memcmp(target, "http://", 7))
> +		return -1;
Can crash if the string is too short.
> +	entry = gethostbyname(name);
> +	memcpy(&sockad.sin_addr.s_addr,
> +	       &((struct in_addr *)entry->h_addr)->s_addr, 4);

Can crash if the host doesn't exist or if you feed it with an URL containing port number.

> +static int get_connection()
(void)
> +	local = open(filename, O_WRONLY | O_CREAT | O_EXCL, 0666);
What if it fails?
				Have a nice fortnight
-- 
Martin `MJ' Mares   <mj@ucw.cz>   http://atrey.karlin.mff.cuni.cz/~mj/
Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth
A student who changes the course of history is probably taking an exam.
Previous: Daniel BarkalowNext: Daniel Barkalow
Message 2 of 14 in “Get commits from remote repositories by HTTP”
  1. Get commits from remote repositories by HTTPDaniel Barkalow, Apr 16, 2005
  2. Martin MaresApr 16, 2005
  3. Daniel BarkalowApr 16, 2005
  4. Tony LuckApr 16, 2005
  5. Daniel BarkalowApr 16, 2005
  6. Adam KropelinApr 16, 2005
  7. Daniel BarkalowApr 16, 2005
  8. Adam KropelinApr 16, 2005
  9. tony.luck@intel.comApr 17, 2005
  10. tony.luck@intel.comApr 18, 2005
  11. Petr BaudisApr 18, 2005
  12. tony.luck@intel.comApr 18, 2005
  13. Jan-Benedict GlawApr 16, 2005
  14. Daniel BarkalowApr 16, 2005

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.