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 - 2001, 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.851 2003/11/10 12:22:08 grubba Exp $"; + constant cvs_version="$Id: roxen.pike,v 1.852 2003/11/11 15:40:07 grubba 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:2890:    }       static void store_data( string id, string data, mapping meta )    {    if(!stringp(data)) return;   #ifdef ARG_CACHE_DEBUG    werror("store %O (%d bytes)\n", id, strlen(data) );   #endif    meta_cache_insert( id, meta );    string meta_data = encode_value( meta ); -  if( catch { -  QUERY( "UPDATE "+name+" SET size=%d, atime=%d, meta=%s, " -  "data=%s WHERE id=%s", -  strlen(data)+strlen(meta_data), time(1), meta_data, data, id ); +    #ifdef ARG_CACHE_DEBUG -  werror("updated entry for %O, existed before\n", id ); +  werror("Replacing entry for %O\n", id );   #endif -  } ) -  { - #ifdef ARG_CACHE_DEBUG -  werror("new entry for %O\n", id ); - #endif -  QUERY("INSERT INTO "+name+ +  QUERY("REPLACE INTO "+name+    " (id,size,atime,meta,data) VALUES (%s,%d,%d,%s,%s)",    id, strlen(data)+strlen(meta_data), time(1), meta_data, data );    } -  } +        static mapping restore_meta( string id, RequestID rid )    {    if( meta_cache[ id ] )    {    meta_cache[ id ][ 1 ] = time(1); // Update cached atime.    return meta_cache[ id ][ 0 ];    }      #ifdef ARG_CACHE_DEBUG
Roxen.git/server/base_server/roxen.pike:3084:    // Case 2: We have cache entry, but no data.    return 0;    }    else    {    // Case 3: No cache entry. Create one    User u = rid->conf->authenticate(rid);    string uid = "";    if( u ) uid = u->name();    // Might have been insterted from elsewhere. -  catch { -  QUERY("INSERT INTO "+name+ +  QUERY("REPLACE INTO "+name+    " (id,uid,atime) VALUES (%s,%s,UNIX_TIMESTAMP())",    id, uid ); -  }; +     }       return 0;    }          string data( array|string|mapping args, RequestID id, int|void nodraw )    //! Returns the actual raw image data of the image rendered from the    //! @[args] instructions.    //!
Roxen.git/server/base_server/roxen.pike:3225:    error("Expected mapping as the first element of the argument array\n");    update_args( data[0] );    ci = map( map( data, tomapp ), argcache->store )*"$";    } else    ci = data;    update_args = 0; // To avoid garbage.       if( zero_type( uid_cache[ ci ] ) )    {    uid_cache[ci] = user; -  if( catch(QUERY( "UPDATE "+name+" SET uid=%s WHERE id=%s", -  user||"", ci )) ) -  QUERY("INSERT INTO "+name+" (id,uid,atime) VALUES (%s,%s,%d)", +  QUERY("REPLACE INTO "+name+" (id,uid,atime) VALUES (%s,%s,%d)",    ci, user||"", time(1) );    }      #ifndef NO_ARG_CACHE_SB_REPLICATE    if(id->misc->persistent_cache_crawler) {    // Force an update of atime for the requested arg cache id.    foreach(ci/"$", string key) {   #if REPLICATE_DEBUG    werror("Request for id %O from prefetch crawler.\n", key);   #endif /* REPLICATE_DEBUG */
Roxen.git/server/base_server/roxen.pike:4842:    code +=   #"    callback( data );    }   ";       program res = compile_string(code);    string enc = encode_value(res, master()->MyCodec(res));    object con = dbm_cached_get("local");    -  con->query("DELETE FROM compiled_formats WHERE md5=%s", kmd5); -  con->query("INSERT INTO compiled_formats (md5,full,enc) VALUES (%s,%s,%s)", +  con->query("REPLACE INTO compiled_formats (md5,full,enc) VALUES (%s,%s,%s)",    kmd5, fmt, enc);    con = 0;       return compiled_formats[ fmt ] = res()->log;   }      // This array contains the compilation information for the different   // security checks for e.g. htaccess. The layout of the top array is   // triplet of sscanf string that the security command should match,   // the number of arguments that it takes and an array with the actual
Roxen.git/server/base_server/roxen.pike:5355: Inside #if defined(SECURITY_PATTERN_DEBUG) || defined(HTACCESS_DEBUG)
   report_debug(sprintf("Compiling security pattern:\n"    "%{ %s\n%}\n"    "Code:\n"    "%{ %s\n%}\n",    pattern/"\n",    code/"\n"));   #endif /* SECURITY_PATTERN_DEBUG || HTACCESS_DEBUG */    mixed res = compile_string( code );       dbm_cached_get( "local" ) -  ->query("DELETE FROM compiled_formats WHERE md5=%s", kmd5 ); -  dbm_cached_get( "local" ) -  ->query("INSERT INTO compiled_formats (md5,full,enc) VALUES (%s,%s,%s)", +  ->query("REPLACE INTO compiled_formats (md5,full,enc) VALUES (%s,%s,%s)",    kmd5,pattern,encode_value( res, master()->MyCodec( res ) ) );    return compile_string(code)()->f;   }         static string cached_hostname = gethostname();      class LogFile(string fname)   {    Stdio.File fd;