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 - 2009, 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.160 2009/05/07 14:15:54 mast Exp $"; + constant cvs_version= "$Id: filesystem.pike,v 1.161 2010/06/29 13:30:31 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:1126:    {    privs = 0;    TRACE_LEAVE("PUT: Open failed");    return errno_to_status (err, 1, id);    }       // FIXME: Race-condition.    string msg = safe_chmod(f, 0666 & ~(id->misc->umask || 022));    privs = 0;    -  putting[id->my_fd] = id->misc->len; -  if(id->data && strlen(id->data)) +  Stdio.File my_fd = id->connection(); +  +  putting[my_fd] = id->misc->len; +  if(strlen(id->data))    { -  // FIXME: What if sizeof(id->data) > id->misc->len ? +  // Note: What if sizeof(id->data) > id->misc->len ? +  // This is not a problem, since that has been handled +  // by the protocol module.    if (id->misc->len > 0) { -  putting[id->my_fd] -= strlen(id->data); +  putting[my_fd] -= strlen(id->data);    }    int bytes = to->write( id->data );    if (id->misc->quota_obj) {    QUOTA_WERR("Allocating " + bytes + "bytes.");    if (!id->misc->quota_obj->allocate(f, bytes)) {    TRACE_LEAVE("PUT: A string");    TRACE_LEAVE("PUT: Out of quota");    return Roxen.http_status(507, "Out of disk quota.");    }    }    } -  if(!putting[id->my_fd]) { +  if(!putting[my_fd]) {    TRACE_LEAVE("PUT: Just a string");    TRACE_LEAVE("Put: Success");    if (size < 0) {    return Roxen.http_status(201, "Created.");    } else {    // FIXME: Isn't 204 better? /mast    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, size }) ); -  id->my_fd->set_nonblocking(got_put_data, 0, done_with_put); +  id->ready_to_receive(); +  my_fd->set_id( ({ to, my_fd, id, URI, size }) ); +  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: !!       if(!query("put"))