Fossil

Check-in [5627d795]
Login

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

Overview
Comment:Make a best effort to record the IP of the remote host in rcvfrom.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | ssh-test-http
Files: files | file ages | folders
SHA1:5627d795c30186c452f5f750b29a99eebad84b31
User & Date: andybradford 2013-08-24 19:02:50
Context
2013-08-25
03:25
Move some posix only includes so they are not used on _WIN32. Can compile again on MinGW. check-in: 8278a03f user: mgagnon tags: ssh-test-http
2013-08-24
19:02
Make a best effort to record the IP of the remote host in rcvfrom. check-in: 5627d795 user: andybradford tags: ssh-test-http
2013-08-23
14:14
Remove unused sshin_read() function that was missed. check-in: f64c003d user: andybradford tags: ssh-test-http
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/http_socket.c.

207
208
209
210
211
212
213

















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
























>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
    if( got<=0 ) break;
    total += (size_t)got;
    N -= (size_t)got;
    pContent = (void*)&((char*)pContent)[got];
  }
  return total;
}

/*
** Attempt to resolve g.urlName to IP 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(void){
  struct hostent *pHost;        /* Used to make best effort for rcvfrom */
  struct sockaddr_in addr;

  memset(&addr, 0, sizeof(addr));
  pHost = gethostbyname(g.urlName);
  if( pHost!=0 ){
    memcpy(&addr.sin_addr,pHost->h_addr_list[0],pHost->h_length);
    g.zIpAddr = mprintf("%s", inet_ntoa(addr.sin_addr));
  }
}

Changes to src/http_transport.c.

95
96
97
98
99
100
101

102
103
104
105
106
107
108
  static int fPrintSshCmd = 1;  /* Print SSH command only once */
  const char *zSshFossilCmd;    /* Path to fossil on remote host */
  const char *zSsh;  /* The base SSH command */
  Blob zCmd;         /* The SSH command */
  char *zHost;       /* The host name to contact */
  int n;             /* Size of prefix string */


  zSsh = db_get("ssh-command", zDefaultSshCmd);
  zSshFossilCmd = db_get("ssh-fossil", "fossil");
  blob_init(&zCmd, zSsh, -1);
  if( g.urlPort!=g.urlDfltPort && g.urlPort ){
#ifdef __MINGW32__
    blob_appendf(&zCmd, " -P %d", g.urlPort);
#else







>







95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
  static int fPrintSshCmd = 1;  /* Print SSH command only once */
  const char *zSshFossilCmd;    /* Path to fossil on remote host */
  const char *zSsh;  /* The base SSH command */
  Blob zCmd;         /* The SSH command */
  char *zHost;       /* The host name to contact */
  int n;             /* Size of prefix string */

  socket_ssh_resolve_addr();
  zSsh = db_get("ssh-command", zDefaultSshCmd);
  zSshFossilCmd = db_get("ssh-fossil", "fossil");
  blob_init(&zCmd, zSsh, -1);
  if( g.urlPort!=g.urlDfltPort && g.urlPort ){
#ifdef __MINGW32__
    blob_appendf(&zCmd, " -P %d", g.urlPort);
#else