Fossil

Diff
Login

Diff

Differences From Artifact [1c04a36a98]:

To Artifact [319788f66a]:


2590
2591
2592
2593
2594
2595
2596















2597
2598




2599
2600

2601
2602

2603
2604
2605
2606
2607
2608
2609
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611


2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+


+


+







        file_set_mode(g.zSockName, listener, "0660", 1);
      }
    }else{
      /* Initialize a TCP/IP socket on port iPort */
      memset(&inaddr, 0, sizeof(inaddr));
      inaddr.sin6_family = AF_INET6;
      if( zIpAddr ){
        /* Bind to the specific IP address given by zIpAddr[] */
        size_t nAddr = strlen(zIpAddr);
        char z4to6[30];
        
        if( nAddr<16 ){
          /* The specified IP address might be in IPv4 notation (ex: 1.2.3.4)
          ** which inet_pton() does not understand.  Convert in into a IPv6
          ** mapping of an IPv4 address: (::FFFF:1.2.3.4) */
          memcpy(z4to6,"::ffff:", 7);
          memcpy(z4to6+7, zIpAddr, nAddr+2);
        }else{
          z4to6[0] = 0;
        }

        /* Convert the zIpAddr text string into an actual IPv6 address */
        if( inet_pton(AF_INET6, zIpAddr, &inaddr.sin6_addr)==0 ){
          fossil_fatal("not a valid IP address: %s", zIpAddr);
        if( inet_pton(AF_INET6, zIpAddr, &inaddr.sin6_addr)==0
         && (z4to6[0]==0 || inet_pton(AF_INET6, z4to6, &inaddr.sin6_addr)==0)
        ){
          fossil_fatal("not a valid IP address: %s", z4to6);
        }
      }else if( flags & HTTP_SERVER_LOCALHOST ){
        /* Bind to the loop-back IP address */
        inaddr.sin6_addr = in6addr_loopback;
      }else{
        /* Bind to any and all available IP addresses */
        inaddr.sin6_addr = in6addr_any;
      }
      inaddr.sin6_port = htons(iPort);
      listener = socket(AF_INET6, SOCK_STREAM, 0);
      if( listener<0 ){
        iPort++;
        continue;