Fossil

Check-in [b1cb81eb]
Login

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

Overview
Comment:Fix indentation and remove all strcpy() and strcat() calls (as OpenBSD hates those).
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | ipv6-server
Files: files | file ages | folders
SHA1: b1cb81ebe7c114f3c41e23f39a3854fe84f7576f
User & Date: drh 2015-04-09 23:16:54
Context
2015-04-09
23:22
Remove extraneous printf() statements from the IPv6 logic in the unix CGI server code. Leaf check-in: 2d9d276b user: drh tags: ipv6-server
23:16
Fix indentation and remove all strcpy() and strcat() calls (as OpenBSD hates those). check-in: b1cb81eb user: drh tags: ipv6-server
21:36
Enable the use of IPv6 for "fossil ui" and "fossil server" on unix. check-in: dae37f0e user: drh tags: ipv6-server
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/cgi.c.

1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
  int listener = -1;           /* The server socket */
  int connection;              /* A socket for each individual connection */
  fd_set readfds;              /* Set of file descriptors for select() */
  socklen_t lenaddr;           /* Length of the inaddr structure */
  int child;                   /* PID of the child process */
  int nchildren = 0;           /* Number of child processes */
  struct timeval delay;        /* How long to wait inside select() */
  struct sockaddr_in6 inaddr;   /* The socket address */
  int optyes = 1;                 /* setsockopt flag */
  int optno = 0;                 /* setsockopt flag */
  int iPort = mnPort;
  char ip[INET6_ADDRSTRLEN];
  

  while( iPort<=mxPort ){
    memset(&inaddr, 0, sizeof(inaddr));
    inaddr.sin6_family = AF_INET6;
    if( zIpAddr ){
        printf("zIpAddr: %s", zIpAddr);
        printf("iPort: %d", iPort);
        /* check valid ipv6 address */
      if (inet_pton(AF_INET6, zIpAddr, &(inaddr.sin6_addr)) < 1) {
          /* maybe ipv4 string so try mixed ipv4 notation*/
          strcpy(ip, "::FFFF:");
          strcat(ip, zIpAddr);
          printf("zIpAddr: %s", ip);
          if (inet_pton(AF_INET6, ip, &(inaddr.sin6_addr)) == -1){
            fossil_fatal("not a valid IP address: %s", zIpAddr);
          }
      }
    }else if( flags & HTTP_SERVER_LOCALHOST ){
      inaddr.sin6_addr = in6addr_loopback;
    }else{
      inaddr.sin6_addr = in6addr_any;
    }
    inaddr.sin6_port = htons(iPort);







|
|
|








|
|
|

|
|
<
|
|
|
|







1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739

1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
  int listener = -1;           /* The server socket */
  int connection;              /* A socket for each individual connection */
  fd_set readfds;              /* Set of file descriptors for select() */
  socklen_t lenaddr;           /* Length of the inaddr structure */
  int child;                   /* PID of the child process */
  int nchildren = 0;           /* Number of child processes */
  struct timeval delay;        /* How long to wait inside select() */
  struct sockaddr_in6 inaddr;  /* The socket address */
  int optyes = 1;              /* setsockopt flag */
  int optno = 0;               /* setsockopt flag */
  int iPort = mnPort;
  char ip[INET6_ADDRSTRLEN];
  

  while( iPort<=mxPort ){
    memset(&inaddr, 0, sizeof(inaddr));
    inaddr.sin6_family = AF_INET6;
    if( zIpAddr ){
      printf("zIpAddr: %s", zIpAddr);
      printf("iPort: %d", iPort);
      /* check valid ipv6 address */
      if (inet_pton(AF_INET6, zIpAddr, &(inaddr.sin6_addr)) < 1) {
        /* maybe ipv4 string so try mixed ipv4 notation*/
        sqlite3_snprintf(sizeof(ip), ip, "::FFFF:%s", zIpAddr);

        printf("zIpAddr: %s", ip);
        if (inet_pton(AF_INET6, ip, &(inaddr.sin6_addr)) == -1){
          fossil_fatal("not a valid IP address: %s", zIpAddr);
        }
      }
    }else if( flags & HTTP_SERVER_LOCALHOST ){
      inaddr.sin6_addr = in6addr_loopback;
    }else{
      inaddr.sin6_addr = in6addr_any;
    }
    inaddr.sin6_port = htons(iPort);