Roxen.git / server / base_server / roxen.pike

version» Context lines:

Roxen.git/server/base_server/roxen.pike:1:   // This file is part of Roxen WebServer.   // Copyright © 1996 - 2004, Roxen IS.   //   // The Roxen WebServer main program.   //   // 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.1013 2009/01/11 15:23:12 mast Exp $"; + constant cvs_version="$Id: roxen.pike,v 1.1014 2009/01/11 15:51:14 mast Exp $";      //! @appears roxen   //!   //! The Roxen WebServer main program.      // The argument cache. Used by the image cache.   ArgCache argcache;      // Some headerfiles   #define IN_ROXEN
Roxen.git/server/base_server/roxen.pike:1657:    int port;    //! The currently bound portnumber       string ip;    //! The canonical IP-number (0 for ANY) this port is bound to.    //!    //! IPv6 numbers are in colon separated four-digit lower-case hexadecimal    //! notation with the first longest sequence of zeros compressed.       int refs; -  //! The number of references to this port +  //! The number of references to this port. This is the same as the +  //! size of @[urls] and @[sorted_urls].       program requesthandler;    //! The per-connection request handling class       array(string) sorted_urls = ({});    //! Sorted by length, longest first       mapping(string:mapping(string:mixed)) urls = ([]);    //! .. url -> ([ "conf":.., ... ])    //!
Roxen.git/server/base_server/roxen.pike:1712:    }       void unref(string _name)    //! Remove a ref for the URL '_name'    {   // if(!urls[name]) // only unref once   // return;       m_delete(conf_data, urls[_name]->conf);    m_delete(urls, _name); -  if (!path && sizeof (Array.uniq (values (urls)->path)) == 1) -  path = values (urls)[0]->path; +  if (!path) { +  array(string) paths = Array.uniq (values (urls)->path); +  if (sizeof (paths) == 1) path = paths[0]; +  }    sorted_urls -= ({_name});   #ifdef PORT_DEBUG    report_debug("Protocol(%s)->unref(%O): refs:%d\n",    get_url(), _name, refs);   #endif /* PORT_DEBUG */    if( !--refs ) {    if (retries) {    remove_call_out(bind);    }    if (port_obj) {
Roxen.git/server/base_server/roxen.pike:1780:    {    if( !requesthandler && rrhf )    {    requesthandler = (program)(rrhf);    }    Configuration c;    if( refs < 2 )    {    if(!mu)    { -  mu = urls[sorted_urls[0]]; +  mu = get_iterator(urls)->value();    if(!(c=mu->conf)->inited ) {    handle (lambda () {    c->enable_all_modules();    call_out (requesthandler, 0, q, this, c);    });    return;    }    } else    c = mu->conf;    }    requesthandler( q, this_object(), c );    }    }       private Protocol any_port;       mapping(string:mixed) find_url_data_for_url (string url, int no_default,    RequestID id)    { -  if( sizeof( urls ) == 1 && !no_default) +  if( refs == 1 )    { -  if(!mu) mu=urls[sorted_urls[0]]; -  URL2CONF_MSG ("%O %O Only one configuration: %O\n", this, url, mu->conf); +  if (!no_default) { +  if(!mu) mu=get_iterator(urls)->value(); +  URL2CONF_MSG ("%O %O Only one configuration: %O\n", +  this, url, mu->conf);    return mu; -  } else if (!sizeof(sorted_urls)) { +  } +  } else if (!refs) {    URL2CONF_MSG("%O %O No active URLS!\n", this, url);    return 0;    }       url = lower_case( url );    URL2CONF_MSG("sorted_urls: %O\n"    "url: %O\n", sorted_urls, url);    // The URLs are sorted from longest to shortest, so that short    // urls (such as http://*/) will not match before more complete    // ones (such as http://*.roxen.com/)