Subject: Re: git_inetd_server: run git-http-backend using inetd

From: Torsten Bögershausen <[email-masked]>
Date: Sun, 20 Jul 2014 08:10:44 +0200

On 07/19/2014 07:06 PM, Jonathan Nieder wrote:
> Torsten Bögershausen wrote:
>
>> Jonathan, (I'm good in searching, but bad in finding)
>> could you point out where the source code for the git package for
>> debian is ?
>>
>> I recently learned about mDNS, and will probably do some tests
>> and experiments later, and would like to test the lookup feature
>> of "0010".
> Thanks.  It's at git://git.debian.org/~jrnieder-guest/git branch
> release+patches and mirrored at http://repo.or.cz/r/git/debian
With my limited reading of the RFC and the code, and without having
test environment, my spontanous (and probably incomplete) change could 
look like this:
- Treat "host:9418" the same as "host"
- When the hosts ends with .local, do not use DNS.

static int git_tcp_connect_sock(char *host, int flags)
{
     struct strbuf error_message = STRBUF_INIT;
     int sockfd = -1, gai = 0;
     const char *port = NULL;
     struct host *hosts = NULL;
     int j, n = 0;

     get_host_and_port(&host, &port);
     if (!port)
         port = STR(DEFAULT_GIT_PORT);

     n = get_srv(host, &hosts);
     if ((n <= 0) && ends_with(host, ".local")) {
         /*
           host.local is really local, do not send it to a DNS resolver
           The user may try host without .local
          */
         die("Unable to look up %s", host);
     }
     if (!n) {
         hosts = xmalloc(sizeof(*hosts));
         hosts[0].hostname = xstrdup(host);
         hosts[0].port = xstrdup(port);
[snip]