Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Attempts to obtain the IPv6 address of the peer do not seem to work. Fallback to getting the IPv4 address until we figure this out. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
cf94d5a0ff2b2716e611c70fbd555deb |
| User & Date: | drh 2018-07-13 18:40:59.957 |
Context
|
2018-07-13
| ||
| 20:36 | An early attempt at the /setup_smtp page. Partly working. ... (check-in: 1e799919b8 user: drh tags: trunk) | |
| 18:40 | Attempts to obtain the IPv6 address of the peer do not seem to work. Fallback to getting the IPv4 address until we figure this out. ... (check-in: cf94d5a0ff user: drh tags: trunk) | |
| 18:20 | Improved code to discover the IP address of the peer. Record the IP address of the peer in a Received: header line of all input emails. ... (check-in: 9979edbdef user: drh tags: trunk) | |
Changes
Changes to src/cgi.c.
| ︙ | ︙ | |||
1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 |
** Determine the IP address on the other side of a connection.
** Return a pointer to a string. Or return 0 if unable.
**
** The string is held in a static buffer that is overwritten on
** each call.
*/
char *cgi_remote_ip(int fd){
static char zIp[100];
struct sockaddr_in6 addr;
socklen_t sz = sizeof(addr);
if( getpeername(fd, &addr, &sz) ) return 0;
zIp[0] = 0;
if( inet_ntop(AF_INET6, &addr, zIp, sizeof(zIp))==0 ){
return 0;
}
return zIp;
}
/*
** This routine handles a single HTTP request which is coming in on
** g.httpIn and which replies on g.httpOut
**
** The HTTP request is read from g.httpIn and is used to initialize
| > > > > > > > | 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 |
** Determine the IP address on the other side of a connection.
** Return a pointer to a string. Or return 0 if unable.
**
** The string is held in a static buffer that is overwritten on
** each call.
*/
char *cgi_remote_ip(int fd){
#if 0
static char zIp[100];
struct sockaddr_in6 addr;
socklen_t sz = sizeof(addr);
if( getpeername(fd, &addr, &sz) ) return 0;
zIp[0] = 0;
if( inet_ntop(AF_INET6, &addr, zIp, sizeof(zIp))==0 ){
return 0;
}
return zIp;
#else
struct sockaddr_in remoteName;
socklen_t size = sizeof(struct sockaddr_in);
if( getpeername(fd, (struct sockaddr*)&remoteName, &size) ) return 0;
return inet_ntoa(remoteName.sin_addr);
#endif
}
/*
** This routine handles a single HTTP request which is coming in on
** g.httpIn and which replies on g.httpOut
**
** The HTTP request is read from g.httpIn and is used to initialize
|
| ︙ | ︙ |