2008-12-11
2008-12-11 15:32:54 by Jonas Wallden <jonasw@roxen.com>
-
dc89287afa84d93c2eb7f1ba068f583ff5189dc9
(100 lines)
(+39/-61)
[
Show
| Annotate
]
Branch: 5.2
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
6:
// Per Hedbor, Henrik Grubbström, Pontus Hagland, David Hedbor and others.
// ABS and suicide systems contributed freely by Francesco Chemolli
- constant cvs_version="$Id: roxen.pike,v 1.1000 2008/12/03 14:44:44 jonasw Exp $";
+ constant cvs_version="$Id: roxen.pike,v 1.1001 2008/12/11 15:32:28 jonasw Exp $";
//! @appears roxen
//!
1478:
// only_this_conf is given then only ports for that configuration are
// searched.
{
- string url_with_port = sprintf("%s://%s:%d%s", url->scheme, url->host,
- url->port,
- (sizeof(url->path)?url->path:"/"));
+ // Force string coersion to incorporate any separate base URI
+ Standards.URI url2 = Standards.URI((string) url);
+ url2->fragment = 0;
+ url2->query = 0;
+ string url_with_port = (string) url2;
URL2CONF_MSG("URL with port: %s\n", url_with_port);
1498:
URL2CONF_MSG("Found config: %O\n", url_data->conf);
if ((only_this_conf && (c != only_this_conf)) ||
- (sscanf (u, "%*[^*?]%*c") == 2 && // u contains * or ?.
+ (sscanf (u, "%*s://%*[^*?]%*c") == 3 && // u contains * or ?.
// u is something like "http://*:80/"
(!host_is_local(url->host)))) {
// Bad match.
2548:
url = lower_case( url );
Standards.URI ui = Standards.URI(url);
ui->fragment = 0;
- url = (string)ui;
- url = replace( url, "/ANY", "/*" );
- url = replace( url, "/any", "/*" );
+ if (ui->host == "any")
+ ui->host = "*";
- string host, path, protocol;
-
- sscanf( url, "%[^:]://%[^/]%s", protocol, host, path );
-
- if (!host || !stringp(host)) return "";
- if (!protocols[ protocol ]) return "";
-
- int port;
- sscanf(host, "%[^:]:%d", host, port);
-
- if( !port )
- {
- port = protocols[ protocol ]->default_port;
- url = protocol+"://"+host+":"+port+path;
+ string host = ui->host;
+ string protocol = ui->scheme;
+ if (!host || !sizeof(host) || !protocols[protocol])
+ return "";
+ if (!ui->port)
+ ui->port = protocols[protocol]->default_port;
+ return (string) ui;
}
- return url;
- }
+
void unregister_url(string url, Configuration conf)
{
2624:
opts[a]=b;
}
ui->fragment = 0;
- url = (string)ui;
+
if( (int)opts->nobind )
{
report_warning(
LOC_M(61,"Not binding the port %O, disabled in configuration")+"\n",
- url );
+ (string) ui );
return 0;
}
- url = replace( url, "/ANY", "/*" );
- url = replace( url, "/any", "/*" );
+ if (ui->host == "any")
+ ui->host = "*";
- sscanf( url, "%[^:]://%[^/]%s", protocol, host, path );
- if (!host || !stringp(host))
- {
+ protocol = ui->scheme;
+ host = ui->host;
+ if (!sizeof(host || "") || !protocols[protocol]) {
report_error(LOC_M(19,"Bad URL '%s' for server `%s'")+"\n",
- url, conf->query_name());
- return 0;
+ (string) ui, conf->query_name());
}
-
+ if (!ui->port)
+ ui->port = protocols[protocol]->default_port;
+ port = ui->port;
- if( !protocols[ protocol ] )
- {
- report_error(LOC_M(7,"The protocol '%s' is not available")+"\n", protocol);
- return 0;
- }
+ url = (string) ui;
- sscanf(host, "%[^:]:%d", host, port);
-
- if( !port )
- {
- port = protocols[ protocol ]->default_port;
- url = protocol+"://"+host+":"+port+path;
+ if (path = ui->path)
+ if (sizeof(path)) {
+ if (has_suffix(path, "/"))
+ path = path[..sizeof(path) - 2];
+ } else {
+ path = 0;
}
- if( strlen( path ) && ( path[-1] == '/' ) )
- path = path[..strlen(path)-2];
- if( !strlen( path ) )
- path = 0;
-
+
if( urls[ url ] )
{
if( !urls[ url ]->port )
2694:
return 0;
}
- if( !port )
- port = prot->default_port;
-
+
urls[ url ] = ([ "conf":conf, "path":path, "hostname": host ]);
urls[ ourl ] = urls[url] + ([]);
sorted_urls += ({ url });
4991: Inside #if defined(THREADS)
#ifdef THREADS
if (sscanf( f, "http://%[^/]", string host ) ||
sscanf (f, "https://%[^/]", host)) {
- if( sscanf( host, "%*s:%*d" ) != 2)
- host += ":80";
+
mapping hd = ([
"User-Agent":version(),
"Host":host,
5025: Inside #if defined(THREADS)
#ifdef THREADS
if (sscanf( f, "http://%[^/]", string host ) ||
sscanf (f, "https://%[^/]", host)) {
- if( sscanf( host, "%*s:%*d" ) != 2)
- host += ":80";
+
mapping hd = ([
"User-Agent":version(),
"Host":host,