Documentation Source Text

Check-in [bb31c42ef2]
Login

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

Overview
Comment:More althttpd.c changes to remove ::ffff: prefixes from IP addresses.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: bb31c42ef2ce4b853d2f2ea76ef43c6a890140a80f01bb0289374146399492da
User & Date: drh 2018-01-12 15:24:44.163
Context
2018-01-12
17:40
Update the speed-and-size spreadsheet to the latest performance numbers. (check-in: 3ce75e588e user: drh tags: trunk)
15:24
More althttpd.c changes to remove ::ffff: prefixes from IP addresses. (check-in: bb31c42ef2 user: drh tags: trunk)
14:44
Fix althttpd so that it omits the prefix from REMOTE_ADDRs of the form "::ffff:1.2.3.4" (check-in: a2f73b0c80 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to misc/althttpd.c.
1977
1978
1979
1980
1981
1982
1983


1984
1985


1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
    address remoteAddr;
    unsigned int size = sizeof(remoteAddr);
    char zHost[NI_MAXHOST];
    if( getpeername(0, &remoteAddr.sa, &size)>=0 ){
      getnameinfo(&remoteAddr.sa, size, zHost, sizeof(zHost), 0, 0,
                  NI_NUMERICHOST);
      zRemoteAddr = StrDup(zHost);


      if( strncmp(zRemoteAddr, "::ffff:", 7)==0
       && strchr(zRemoteAddr+7, ':')==0 ){


        zRemoteAddr += 7;
      }
    }
  }

  /* Process the input stream */
  for(i=0; i<100; i++){
    ProcessOneRequest(0);
  }
  ProcessOneRequest(1);







>
>
|
|
>
>
|
<
<







1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990


1991
1992
1993
1994
1995
1996
1997
    address remoteAddr;
    unsigned int size = sizeof(remoteAddr);
    char zHost[NI_MAXHOST];
    if( getpeername(0, &remoteAddr.sa, &size)>=0 ){
      getnameinfo(&remoteAddr.sa, size, zHost, sizeof(zHost), 0, 0,
                  NI_NUMERICHOST);
      zRemoteAddr = StrDup(zHost);
    }
  }
  if( strncmp(zRemoteAddr, "::ffff:", 7)==0
   && strchr(zRemoteAddr+7, ':')==0
   && strchr(zRemoteAddr+7, '.')!=0
  ){
    zRemoteAddr += 7;


  }

  /* Process the input stream */
  for(i=0; i<100; i++){
    ProcessOneRequest(0);
  }
  ProcessOneRequest(1);