Documentation Source Text

Check-in [a2f73b0c80]
Login

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

Overview
Comment:Fix althttpd so that it omits the prefix from REMOTE_ADDRs of the form "::ffff:1.2.3.4"
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a2f73b0c809579e60fb66893255a02cb9f87abac71306e8a60533e9b0c07cc10
User & Date: drh 2018-01-12 14:44:35
Context
2018-01-12
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
2018-01-11
18:29
Add sqlite3_vtab_nochange() to the change log. check-in: 3b8a8bd89a user: drh tags: trunk
Changes
Hide Diffs Unified Diffs 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
    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);




    }
  }

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







>
>
>
>










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 ){
        zRemoteAddr += 7;
      }
    }
  }

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