Branch: Tag:

2008-12-11

2008-12-11 15:32:54 by 0

Fix IPv6 bugs.

Rev: server/base_server/module.pike:1.233
Rev: server/base_server/prototypes.pike:1.221
Rev: server/base_server/roxen.pike:1.1001
Rev: server/config_interface/sites/site_content.pike:1.153
Rev: server/etc/modules/Roxen.pmod:1.261
Rev: server/etc/modules/RoxenRPC.pmod/HTTP.pmod/Client.pike:1.11
Rev: server/modules/proxies/gopher.pike:1.28
Rev: server/modules/proxies/relay2.pike:1.39
Rev: server/modules/proxies/wais.pike:1.29
Rev: server/modules/tags/html_wash.pike:1.34
Rev: server/protocols/http.pike:1.572

5:   #include <config.h>   #include <module.h>   #include <module_constants.h> - constant cvs_version="$Id: prototypes.pike,v 1.220 2008/09/26 13:20:27 mast Exp $"; + constant cvs_version="$Id: prototypes.pike,v 1.221 2008/12/11 15:32:28 jonasw Exp $";      #ifdef DAV_DEBUG   #define DAV_WERROR(X...) werror(X)
1762:       // First look at the host header in the request.    if (tmp = misc->host) { +  string scheme = port_obj->prot_name; +  if (has_prefix(tmp, "[")) { +  // IPv6 +  sscanf(tmp, "[%s]:%d", string host, int port); +  if (!port || port == port_obj->default_port) +  cached_url_base = scheme + "://[" + host + "]"; +  else +  cached_url_base = scheme + "://" + tmp; +  } else {    int scanres = sscanf(tmp, "%[^:]:%d", string host, int port);    if ((scanres < 2) || (port == port_obj->default_port)) {    // Some clients don't send the port in the host header
1771:    // may be port remappers in the way.    port = port_obj->default_port;    // Remove redundant port number. -  cached_url_base = port_obj->prot_name + "://" + host; +  cached_url_base = scheme + "://" + host;    } else { -  cached_url_base = port_obj->prot_name + "://" + tmp; +  cached_url_base = scheme + "://" + tmp;    }    } -  +  }    // Then use the port object.    else if (port_obj) {    string host = port_obj->conf_data[conf]->hostname;    if (host == "*")    if (conf && sizeof (host = conf->get_url()) && -  sscanf (host, "%*s://%[^:/]", host) == 2) { +  (sscanf (host, "%*s://[%s]", string hostv6) == 2 || +  sscanf (host, "%*s://%[^:/]", string hostv4) == 2)) {    // Use the hostname in the configuration url. -  +  host = hostv6 ? ("[" + hostv6 + "]") : hostv4;    }    else    // Fall back to the numeric ip.