Roxen.git / server / modules / filesystems / filesystem.pike

version» Context lines:

Roxen.git/server/modules/filesystems/filesystem.pike:1:   // This is a roxen module. Copyright © 1996 - 2000, Roxen IS.      // This is a virtual "file-system".   // It will be located somewhere in the name-space of the server.   // Also inherited by some of the other filesystems.      inherit "module";   inherit "socket";    - constant cvs_version= "$Id: filesystem.pike,v 1.85 2000/08/13 04:03:07 per Exp $"; + constant cvs_version= "$Id: filesystem.pike,v 1.86 2000/08/23 18:53:09 per Exp $";   constant thread_safe=1;      #include <module.h>   #include <roxen.h>   #include <stat.h>   #include <request_trace.h>      #if DEBUG_LEVEL > 20   # ifndef FILESYSTEM_DEBUG   # define FILESYSTEM_DEBUG
Roxen.git/server/modules/filesystems/filesystem.pike:369:    }   }      string decode_path( string p )   {    if( path_encoding != "iso-8859-1" )    p = Locale.Charset.encoder( path_encoding )->feed( p )->drain();   #ifndef __NT__    if( String.width( p ) != 8 )    p = string_to_utf8( p ); + #else +  while( strlen(p) && p[-1] == '/' ) +  p = p[..strlen(p)-2];   #endif    return p;   }         int _file_size(string X,object id)   {    array fs;    if( stat_cache )    {
Roxen.git/server/modules/filesystems/filesystem.pike:426:    int size;    string tmp;    string oldf = f;       FILESYSTEM_WERR("Request for \""+f+"\"" +    (id->misc->internal_get ? " (internal)" : ""));       /* only used for the quota system, thus rather unessesary to do for    each request....    */ - #define uri combine_path(mountpoint + "/" + f, ".") + #define URI combine_path(mountpoint + "/" + f, ".")       f = path + f;    - #ifdef __NT__ -  if(f[-1]=='/') f = f[..strlen(f)-2]; - #endif + // #ifdef __NT__ // fixed in decode_path + // if(f[-1]=='/') f = f[..strlen(f)-2]; + // #endif    size = _file_size( f, id );       /*    * FIXME: Should probably move path-info extraction here.    * /grubba 1998-08-26    */       switch(id->method)    {    case "GET":
Roxen.git/server/modules/filesystems/filesystem.pike:594:    if(QUERY(check_auth) && (!id->auth || !id->auth[0])) {    TRACE_LEAVE("PUT: Permission denied");    return Roxen.http_auth_required("foo",    "<h1>Permission to 'PUT' files denied</h1>");    }       puts++;       QUOTA_WERR("Checking quota.\n");    if (id->misc->quota_obj && (id->misc->len > 0) && -  !id->misc->quota_obj->check_quota(uri, id->misc->len)) { +  !id->misc->quota_obj->check_quota(URI, id->misc->len)) {    errors++;    report_warning("Creation of " + f + " failed. Out of quota.\n");    TRACE_LEAVE("PUT: Out of quota.");    return http_low_answer(413, "<h2>Out of disk quota.</h2>",    "413 Out of disk quota");    }       object privs;       if (((int)id->misc->uid) && ((int)id->misc->gid)) {
Roxen.git/server/modules/filesystems/filesystem.pike:624:    return http_low_answer(403, "<h2>Permission denied.</h2>");    }       rm( decode_path(f) );    mkdirhier( decode_path(f) );       if (id->misc->quota_obj) {    QUOTA_WERR("Checking if the file already exists.");    if (size > 0) {    QUOTA_WERR("Deallocating " + size + "bytes."); -  id->misc->quota_obj->deallocate(uri, size); +  id->misc->quota_obj->deallocate(URI, size);    }    if (size) {    QUOTA_WERR("Deleting old file.");    rm(f);    }    }       object to = open(decode_path(f), "wct");    privs = 0;   
Roxen.git/server/modules/filesystems/filesystem.pike:680:    }    if(!putting[id->my_fd]) {    TRACE_LEAVE("PUT: Just a string");    TRACE_LEAVE("Put: Success");    return Roxen.http_string_answer("Ok");    }       if(id->clientprot == "HTTP/1.1") {    id->my_fd->write("HTTP/1.1 100 Continue\r\n");    } -  id->my_fd->set_id( ({ to, id->my_fd, id, uri }) ); +  id->my_fd->set_id( ({ to, id->my_fd, id, URI }) );    id->my_fd->set_nonblocking(got_put_data, 0, done_with_put);    TRACE_LEAVE("PUT: Pipe in progress");    TRACE_LEAVE("PUT: Success so far");    return Roxen.http_pipe_in_progress();    break;       case "CHMOD":    // Change permission of a file.    // FIXME: !!   
Roxen.git/server/modules/filesystems/filesystem.pike:862:    return Roxen.http_auth_required("foo",    "<h1>Permission to 'MOVE' files denied</h1>");    }       if(!sizeof(id->misc["new-uri"] || "")) {    id->misc->error_code = 405;    errors++;    TRACE_LEAVE("MOVE: No dest file");    return 0;    } -  string new_uri = combine_path(uri + "/../", +  string new_uri = combine_path(URI + "/../",    id->misc["new-uri"]);       if (new_uri[..sizeof(mountpoint)-1] != mountpoint) {    id->misc->error_code = 405;    TRACE_LEAVE("MOVE: Dest file on other filesystem.");    return(0);    }    string moveto = path + "/" + new_uri[sizeof(mountpoint)..];       if (FILTER_INTERNAL_FILE (f, id) ||