Fossil

Changes On Branch no_ssh_sync_ip_resolve
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch no_ssh_sync_ip_resolve Excluding Merge-Ins

This is equivalent to a diff from 8f9f2cb7cd to 5d5911e6fd

2023-01-13
14:34
Use the hostname as the report IP when doing SSH synchronization. ... (check-in: 0b7af9d865 user: drh tags: trunk)
2023-01-11
18:07
Enable horizontal scrolling for individual text blocks in unified diffs. [forum:91c3e7854c | Forum Post 91c3e7854c] and the following. ... (check-in: 603816d221 user: florian tags: trunk)
07:56
Enable horizontal scrolling for individual text blocks in unified diffs. ... (Closed-Leaf check-in: 15ba7e616c user: florian tags: udiff-hscroll)
03:06
merge latest change from trunk. ... (Closed-Leaf check-in: 5d5911e6fd user: mgagnon tags: no_ssh_sync_ip_resolve)
02:51
Make proxy setting "system" by default to use http_proxy environment variable. Closer to old behavior and conform with most programs on Unix-like system. ... (check-in: 8f9f2cb7cd user: mgagnon tags: trunk)
2023-01-09
13:25
Help text improvements for diffcmd.c. ... (check-in: e1b51150af user: danield tags: trunk)
2023-01-06
21:33
Do not try to resolve the IP from the hostname when syncing using ssh:// protocol. Ssh may use the provided name as an alias defined in ~/.ssh/config which may not be resolvable or even resolve to an unrelated ip. This change can potentially avoid long timeout during name resolution failure. Equivalent to [52f08008e2790a81]. ... (check-in: e5c5622d4b user: mgagnon tags: no_ssh_sync_ip_resolve)

Changes to src/http_socket.c.
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
230
231
232
233
234
235
236



































-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
    if( got<=0 ) break;
    total += (size_t)got;
    N -= (size_t)got;
    pContent = (void*)&((char*)pContent)[got];
  }
  return total;
}

/*
** Attempt to resolve pUrlData->name to an IP address and setup g.zIpAddr
** so rcvfrom gets populated. For hostnames with more than one IP (or
** if overridden in ~/.ssh/config) the rcvfrom may not match the host
** to which we connect.
*/
void socket_ssh_resolve_addr(UrlData *pUrlData){
  struct addrinfo *ai = 0;
  struct addrinfo hints;
  char zRemote[NI_MAXHOST];
  memset(&hints, 0, sizeof(hints));
  hints.ai_family = AF_UNSPEC;
  hints.ai_socktype = SOCK_STREAM;
  hints.ai_protocol = IPPROTO_TCP;
  fossil_free(g.zIpAddr);
  g.zIpAddr = 0;
  if( getaddrinfo(pUrlData->name, NULL, &hints, &ai)==0
   && ai!=0
   && getnameinfo(ai->ai_addr, ai->ai_addrlen, zRemote,
                  sizeof(zRemote), 0, 0, NI_NUMERICHOST)==0 ){
    g.zIpAddr = mprintf("%s (%s)", zRemote, pUrlData->name);
  }
  if( ai ) freeaddrinfo(ai);
  if( g.zIpAddr==0 ){
    g.zIpAddr = mprintf("%s", pUrlData->name);
  }
}
Changes to src/http_transport.c.
115
116
117
118
119
120
121

122

123
124
125
126
127
128
129
115
116
117
118
119
120
121
122

123
124
125
126
127
128
129
130







+
-
+







int transport_ssh_open(UrlData *pUrlData){
  /* For SSH we need to create and run SSH fossil http
  ** to talk to the remote machine.
  */
  Blob zCmd;         /* The SSH command */
  char *zHost;       /* The host name to contact */

  fossil_free(g.zIpAddr);
  socket_ssh_resolve_addr(pUrlData);
  g.zIpAddr = mprintf("%s", pUrlData->name);
  transport_ssh_command(&zCmd);
  if( pUrlData->port!=pUrlData->dfltPort && pUrlData->port ){
    blob_appendf(&zCmd, " -p %d", pUrlData->port);
  }
  blob_appendf(&zCmd, " -T --");  /* End of switches */
  if( pUrlData->user && pUrlData->user[0] ){
    zHost = mprintf("%s@%s", pUrlData->user, pUrlData->name);
Changes to src/xfer.c.
2854
2855
2856
2857
2858
2859
2860
2861

2862
2863
2864
2865
2866
2867
2868
2854
2855
2856
2857
2858
2859
2860

2861
2862
2863
2864
2865
2866
2867
2868







-
+







                    db_timespan_name(-rSkew));
     g.clockSkewSeen = 1;
  }

  fossil_force_newline();
  if( g.zHttpCmd==0 ){
    fossil_print(
       "%s done, wire bytes sent: %lld  received: %lld  ip: %s\n",
       "%s done, wire bytes sent: %lld  received: %lld  remote: %s\n",
       zOpType, nSent, nRcvd, g.zIpAddr);
  }
  if( syncFlags & SYNC_VERBOSE ){
    fossil_print(
      "Uncompressed payload sent: %lld  received: %lld\n", nUncSent, nUncRcvd);
  }
  transport_close(&g.url);