roxen.lists.roxen.general

Subject Author Date
Re: A few new latest bugfixes relative to Roxen 5.0 Martin Stjernholm <mast[at]roxen[dot]com> 11-01-2009
"Stephen R. van den Berg" <<srb[at]cuci.nl>> wrote:

> Stephen R. van den Berg wrote:
>>Binding servers doesn't work, and the db code crashes sometimes.
>>Fixes below.
>
>>commit c168bf1f97f287b7c0988900384c86be361044ce
>>Author: Stephen R. van den Berg <<srb[at]cuci.nl>>
>>Date:   Thu Jan 8 03:17:16 2009 +0100
>
>>    Canonicalise properly
>
> The Standards.URI code drops the :80 from the URL, whereas the old
> Roxen code plugged it in always, hence virtual servers never matched anymore.

I'm cc'ing Jonas on this one, since he in roxen.pike rev 1.1001
introduced the Standards.URI stuff that started stripping the standard
port numbers.

To recap, what Stephen does in this patch is to use Standards.URI to
canonicalize the incoming urls in the http protocol, so that they can
match the Standards.URI-normalized urls registered for the port:

--- a/server/protocols/http.pike
+++ b/server/protocols/http.pike
@@ -2516,8 +2516,8 @@ void got_data(mixed fooid, string s, void|int chained)
 
       if (misc->host) {
        conf =
-         port_obj->find_configuration_for_url(port_obj->url_prefix +
-                                              misc->host + raw_url,
+         port_obj->find_configuration_for_url(
+           (string)Standards.URI(port_obj->url_prefix + misc->host + raw_url),
                                               this_object());
        if (conf->query("default_server")) {
          cache_key = port_obj->name+"://"+misc->host+raw_url;
@@ -2525,7 +2525,8 @@ void got_data(mixed fooid, string s, void|int chained)
       } else {
        conf =
          port_obj->find_configuration_for_url(port_obj->url_prefix + "*:" +
-                                              port_obj->port + raw_url,
+           (string)Standards.URI(port_obj->url_prefix +
+              "*:" + port_obj->port + raw_url),
                                               this_object());
       }
     }

I don't think we want the overhead of fiddling with Standards.URI
objects there - that code is among the hottest sections in the whole
server. I think it's better to reinstate the old behavior where the
port always is included in the urls registered in the Protocol
objects.

So a partial revert appears necessary, at least in register_url
(normalize_url is afaik mostly used for viewing, so that one can
probably continue to strip the standard port). Jonas' fix seems to
have a wider scope though, so he better speak his mind on this one, in
case there is an intentional design change to drop the port numbers.