diff -r 3a1d5a52adfc -r b7908bf38f9f src/server/safs/service.c --- a/src/server/safs/service.c Sat Mar 16 23:11:34 2013 +0100 +++ b/src/server/safs/service.c Sun Mar 17 12:47:59 2013 +0100 @@ -107,15 +107,6 @@ net_sendfile(sn->csd, &sfd); vfs_close(fd); - - - /* send file*/ - //SystemIOStream *io = (SystemIOStream*) sn->csd; - //off_t fileoffset = 0; - //int len = atoi(pblock_findkeyval(pb_key_content_length, rq->srvhdrs)); - //sendfile(io->fd, fd->fd, &fileoffset, len); - - //close(fd); return REQ_PROCEED; } @@ -139,30 +130,9 @@ sstr_t r_uri = sstr(uri); /* open the file */ - int fd = open(ppath, O_RDONLY); - if(fd < 0) { - //perror("service_index: open"); - - int status = 500; - switch(errno) { - case EACCES: { - status = 403; - break; - } - case ENOENT: { - status = 404; - break; - } - } - protocol_status(sn, rq, status, NULL); - //printf("REQ_ABORTED\n"); - return REQ_ABORTED; - } - - DIR *dir = fdopendir(fd); - if(dir == NULL) { - protocol_status(sn, rq, 500, NULL); - //printf("DIR is null\n"); + VFSContext *vfs = vfs_request_context(sn, rq); + VFS_DIR dir = vfs_opendir(vfs, ppath); + if(!dir) { return REQ_ABORTED; } @@ -175,13 +145,14 @@ sbuf_puts(out, uri); sbuf_puts(out, "