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 - 2001, 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.131 2004/05/10 08:22:19 grubba Exp $"; + constant cvs_version= "$Id: filesystem.pike,v 1.132 2004/05/10 11:41:56 grubba Exp $";   constant thread_safe=1;      #include <module.h>   #include <roxen.h>   #include <stat.h>   #include <request_trace.h>         //<locale-token project="mod_filesystem">LOCALE</locale-token>   #define LOCALE(X,Y) _DEF_LOCALE("mod_filesystem",X,Y)
Roxen.git/server/modules/filesystems/filesystem.pike:1586:    TRACE_LEAVE("PUT: Out of quota.");    return http_low_answer(413, "<h2>Out of disk quota.</h2>",    "413 Out of disk quota");    }    object source_file = open(source_path, "r");    if (!source_file) {    TRACE_LEAVE("Failed to open source file.");    return Roxen.http_status(404);    }    object privs; -  SIMPLE_TRACE_ENTER(this, "COPY: Copying file."); +  SETUID_TRACE("COPY: Copying file.", 0);    object dest_file = open(dest_path, "cwt");    privs = 0;    if (!dest_file) {    TRACE_LEAVE("Failed to open destination file."); -  TRACE_LEAVE("Copy failed."); +     return Roxen.http_status(403);    }    int len = source_st->size;    while (len > 0) {    string buf = source_file->read((len > 4096)?4096:len);    if (buf && sizeof(buf)) {    int sub_len;    len -= (sub_len = sizeof(buf));    while (sub_len > 0) {    int written = dest_file->write(buf);    if ((sub_len -= written) > 0) {    if (!written) {    SIMPLE_TRACE_LEAVE("Write failed with errno %d",    dest_file->errno());    dest_file->close();    source_file->close(); -  SIMPLE_TRACE_LEAVE("Insufficient storage."); +     return Roxen.http_status(Protocols.HTTP.DAV_STORAGE_FULL);    }    buf = buf[written..];    }    }    } else {    break;    }    }    if (len > 0) {    SIMPLE_TRACE_LEAVE("Read failed with %d bytes left.", len);    } else {    SIMPLE_TRACE_LEAVE("Copy complete.");    }    dest_file->close();    source_file->close(); -  TRACE_LEAVE("Copy ok."); +     return Roxen.http_status(dest_st?Protocols.HTTP.HTTP_NO_CONTENT:    Protocols.HTTP.HTTP_CREATED);    }   }      string query_name()   {    if (sizeof(path) > 20) {    return sprintf((string)LOCALE(63,"%s from %s...%s"),    mountpoint, path[..7], path[sizeof(path)-8..]);    }    return sprintf((string)LOCALE(50,"%s from %s"), mountpoint, path);   }