Diff
Not logged in

Differences From:

File src/cgi.c part of check-in [dbda8d6ce9] - Initial check-in of m1 sources. by drh on 2007-07-21 14:10:57. [view]

To:

File src/cgi.c part of check-in [36edf3fd5c] - Populate the ipaddr column of the rcvfrom table when a file is received from a remote source (push/pull/sync). by dan on 2007-08-01 09:04:46. Also file src/cgi.c part of check-in [04f7535ee3] - The merge at dd9633a03d did not work because of the bug just fixed. This change moves the changes that should have been in that merge into the main line of the tree. by drh on 2007-08-01 12:20:24. [view]

@@ -1002,9 +1002,16 @@
   if( zToken[i] ) zToken[i++] = 0;
   cgi_setenv("PATH_INFO", zToken);
   cgi_setenv("QUERY_STRING", &zToken[i]);
   if( getpeername(fileno(stdin), (struct sockaddr*)&remoteName, &size)>=0 ){
-    cgi_setenv("REMOTE_ADDR", inet_ntoa(remoteName.sin_addr));
+    char *zIpAddr = inet_ntoa(remoteName.sin_addr);
+    cgi_setenv("REMOTE_ADDR", zIpAddr);
+
+    /* Set the Global.zIpAddr variable to the server we are talking to.
+    ** This is used to populate the ipaddr column of the rcvfrom table,
+    ** if any files are received from the connected client.
+    */
+    g.zIpAddr = mprintf("%s", zIpAddr);
   }
 
   /* Get all the optional fields that follow the first line.
   */