Roxen.git / server / etc / modules / Variable.pmod / module.pmod

version» Context lines:

Roxen.git/server/etc/modules/Variable.pmod/module.pmod:1: - // $Id: module.pmod,v 1.60 2001/08/01 19:34:10 per Exp $ + // $Id: module.pmod,v 1.61 2001/08/05 20:12:36 nilsson Exp $      #include <module.h>   #include <roxen.h>      // Locale macros   //<locale-token project="roxen_config"> LOCALE </locale-token>      #define LOCALE(X,Y) \    ([string](mixed)Locale.translate("roxen_config",roxenp()->locale->get(),X,Y))   
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:885:      class URL   //! A URL.   {    inherit String;    constant type = "URL";    int width = 50;       array verify_set_from_form( string new_value )    { -  return verify_port( new_value, 1 ); +  return verify_port( new_value );    }   }      class Directory   //! A Directory.   {    inherit String;    constant type = "Directory";    int width = 50;   
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:1403:    inherit List;    constant type="URLList";       array verify_set_from_form( array(string) new_value )    {    string warn = "";    array res = ({});    foreach( new_value, string vv )    {    string tmp1, tmp2; -  [tmp1,tmp2] = verify_port( vv, 1 ); +  [tmp1,tmp2] = verify_port( vv );    if( tmp1 )    warn += tmp1;    res += ({ tmp2 });    }    if( !strlen( warn ) )    warn = 0;    return ({ warn, res });    }   }   
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:1436:    res += "<select name='"+prefix+"prot'>";    foreach( sort(indices( roxenp()->protocols )), string p )    {    if( p == split->scheme )    res += "<option selected='t'>"+p+"</option>";    else    res += "<option>"+p+"</option>";    }    res += "</select>";    -  if( split->scheme == "fhttp" && !split->port ) -  split->port = 80; -  +     res += "://<input type=string name='"+prefix+"host' value='"+    Roxen.html_encode_string(split->host)+"' />";    res += ":<input type=string size=5 name='"+prefix+"port' value='"+    split->port+"' />";       res += "/<input type=string name='"+prefix+"path' value='"+    Roxen.html_encode_string(split->path[1..])+"' />";       return res;    }
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:1464:    return (string)Standards.URI(va[v+"prot"]+"://"+va[v+"host"]+":"+va[v+"port"]+"/"+va[v+"path"]);    }       array verify_set_from_form( array(string) new_value )    {    string warn = "";    array res = ({});    foreach( new_value, string vv )    {    string tmp1, tmp2; -  [tmp1,tmp2] = verify_port( vv, 0 ); +  [tmp1,tmp2] = verify_port( vv );    if( tmp1 )    warn += tmp1;    res += ({ tmp2 });    }    if( !strlen( warn ) )    warn = "";    return ({ warn, res });    }   }   
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:1526:    return res+"</select>";    }   }               // =================================================================   // Utility functions used in multiple variable classes above   // ================================================================= - static array(string) verify_port( string port, int nofhttp ) + static array(string) verify_port( string port )   {    if(!strlen(port))    return ({ 0, port });       string warning="";    if( (int)port )    {    warning += sprintf(LOCALE(333,"Assuming http://*:%[0]d/ for %[0]d")+"\n",    (int)port);    port = "http://*:"+port+"/";
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:1552:       if(sscanf( port, "%[^:]://%[^/]%s", protocol, host, path ) != 3)    return ({ sprintf(LOCALE(335,"%s does not conform to URL syntax")+"\n",port),    port });       if( path == "" || path[-1] != '/' )    {    warning += sprintf(LOCALE(336,"Added / to the end of %s")+"\n",port);    path += "/";    } -  if( nofhttp && protocol == "fhttp" ) -  { -  warning += sprintf(LOCALE(337,"Changed %s to http")+"\n",protocol); -  protocol = "http"; -  } +     if( protocol != lower_case( protocol ) )    {    warning += sprintf(LOCALE(338,"Changed %s to %s"),    protocol, lower_case( protocol ))+"\n";    protocol = lower_case( protocol );    } -  if(!nofhttp) // it's a port, not a URL -  { +    #if constant(SSL.sslfile) -  /* All is A-OK */ +  // All is A-OK   #else    if( (protocol == "https" || protocol == "ftps") )    warning +=    LOCALE(339,"SSL support not available in this Pike version.")+"\n"+    sprintf(LOCALE(340,"Please use %s instead."),    protocol[..strlen(protocol)-2])+"\n";   #endif -  } +     int pno;    if( sscanf( host, "%s:%d", host, pno ) == 2)    if( roxenp()->protocols[ lower_case( protocol ) ]    && (pno == roxenp()->protocols[ lower_case( protocol ) ]->default_port ))    warning += sprintf(LOCALE(341,"Removed the default port number "    "(%d) from %s"),pno,port)+"\n";    else    host = host+":"+pno;