Fossil SCM

Populate the ipaddr column of the rcvfrom table when a file is received from a remote source (push/pull/sync).

dan 2007-08-01 09:04 trunk
Commit 36edf3fd5c8ed8ea20da2c723b956e1fc489ac06
2 files changed +8 -1 +6
+8 -1
--- src/cgi.c
+++ src/cgi.c
@@ -1001,11 +1001,18 @@
10011001
for(i=0; zToken[i] && zToken[i]!='?'; i++){}
10021002
if( zToken[i] ) zToken[i++] = 0;
10031003
cgi_setenv("PATH_INFO", zToken);
10041004
cgi_setenv("QUERY_STRING", &zToken[i]);
10051005
if( getpeername(fileno(stdin), (struct sockaddr*)&remoteName, &size)>=0 ){
1006
- cgi_setenv("REMOTE_ADDR", inet_ntoa(remoteName.sin_addr));
1006
+ char *zIpAddr = inet_ntoa(remoteName.sin_addr);
1007
+ cgi_setenv("REMOTE_ADDR", zIpAddr);
1008
+
1009
+ /* Set the Global.zIpAddr variable to the server we are talking to.
1010
+ ** This is used to populate the ipaddr column of the rcvfrom table,
1011
+ ** if any files are received from the connected client.
1012
+ */
1013
+ g.zIpAddr = mprintf("%s", zIpAddr);
10071014
}
10081015
10091016
/* Get all the optional fields that follow the first line.
10101017
*/
10111018
while( fgets(zLine,sizeof(zLine),stdin) ){
10121019
--- src/cgi.c
+++ src/cgi.c
@@ -1001,11 +1001,18 @@
1001 for(i=0; zToken[i] && zToken[i]!='?'; i++){}
1002 if( zToken[i] ) zToken[i++] = 0;
1003 cgi_setenv("PATH_INFO", zToken);
1004 cgi_setenv("QUERY_STRING", &zToken[i]);
1005 if( getpeername(fileno(stdin), (struct sockaddr*)&remoteName, &size)>=0 ){
1006 cgi_setenv("REMOTE_ADDR", inet_ntoa(remoteName.sin_addr));
 
 
 
 
 
 
 
1007 }
1008
1009 /* Get all the optional fields that follow the first line.
1010 */
1011 while( fgets(zLine,sizeof(zLine),stdin) ){
1012
--- src/cgi.c
+++ src/cgi.c
@@ -1001,11 +1001,18 @@
1001 for(i=0; zToken[i] && zToken[i]!='?'; i++){}
1002 if( zToken[i] ) zToken[i++] = 0;
1003 cgi_setenv("PATH_INFO", zToken);
1004 cgi_setenv("QUERY_STRING", &zToken[i]);
1005 if( getpeername(fileno(stdin), (struct sockaddr*)&remoteName, &size)>=0 ){
1006 char *zIpAddr = inet_ntoa(remoteName.sin_addr);
1007 cgi_setenv("REMOTE_ADDR", zIpAddr);
1008
1009 /* Set the Global.zIpAddr variable to the server we are talking to.
1010 ** This is used to populate the ipaddr column of the rcvfrom table,
1011 ** if any files are received from the connected client.
1012 */
1013 g.zIpAddr = mprintf("%s", zIpAddr);
1014 }
1015
1016 /* Get all the optional fields that follow the first line.
1017 */
1018 while( fgets(zLine,sizeof(zLine),stdin) ){
1019
+6
--- src/http.c
+++ src/http.c
@@ -61,10 +61,16 @@
6161
{
6262
fossil_panic("can't resolve host name: %s\n", g.urlName);
6363
}
6464
}
6565
addrIsInit = 1;
66
+
67
+ /* Set the Global.zIpAddr variable to the server we are talking to.
68
+ ** This is used to populate the ipaddr column of the rcvfrom table,
69
+ ** if any files are received from the server.
70
+ */
71
+ g.zIpAddr = mprintf("%s", inet_ntoa(addr.sin_addr));
6672
}
6773
s = socket(AF_INET,SOCK_STREAM,0);
6874
if( s<0 ){
6975
fossil_panic("cannot create a socket");
7076
}
7177
--- src/http.c
+++ src/http.c
@@ -61,10 +61,16 @@
61 {
62 fossil_panic("can't resolve host name: %s\n", g.urlName);
63 }
64 }
65 addrIsInit = 1;
 
 
 
 
 
 
66 }
67 s = socket(AF_INET,SOCK_STREAM,0);
68 if( s<0 ){
69 fossil_panic("cannot create a socket");
70 }
71
--- src/http.c
+++ src/http.c
@@ -61,10 +61,16 @@
61 {
62 fossil_panic("can't resolve host name: %s\n", g.urlName);
63 }
64 }
65 addrIsInit = 1;
66
67 /* Set the Global.zIpAddr variable to the server we are talking to.
68 ** This is used to populate the ipaddr column of the rcvfrom table,
69 ** if any files are received from the server.
70 */
71 g.zIpAddr = mprintf("%s", inet_ntoa(addr.sin_addr));
72 }
73 s = socket(AF_INET,SOCK_STREAM,0);
74 if( s<0 ){
75 fossil_panic("cannot create a socket");
76 }
77

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button