511 WebdavVFSOperation *op = webdav_vfs_op(sn, rq, rq->davCollection, TRUE); |
511 WebdavVFSOperation *op = webdav_vfs_op(sn, rq, rq->davCollection, TRUE); |
512 if(!op) { |
512 if(!op) { |
513 return REQ_ABORTED; |
513 return REQ_ABORTED; |
514 } |
514 } |
515 |
515 |
516 int ret = webdav_vfs_op_do(op, WEBDAV_VFS_MKDIR); |
516 int ret = REQ_ABORTED; |
|
517 if(!webdav_vfs_op_do(op, WEBDAV_VFS_MKDIR)) { |
|
518 pblock_nvinsert("content-length", "0", rq->srvhdrs); |
|
519 protocol_status(sn, rq, 201, NULL); |
|
520 protocol_start_response(sn, rq); |
|
521 ret = REQ_PROCEED; |
|
522 } else { |
|
523 int status_code = 500; |
|
524 if(op->vfs->vfs_errno == EEXIST) { |
|
525 // 405 (Method Not Allowed) - MKCOL can only be executed on an unmapped URL. |
|
526 status_code = 405; |
|
527 } else if(op->vfs->vfs_errno == ENOENT) { |
|
528 // 409 (Conflict) - A collection cannot be made at the Request-URI until |
|
529 // one or more intermediate collections have been created. The server |
|
530 // MUST NOT create those intermediate collections automatically. |
|
531 status_code = 409; |
|
532 } |
|
533 protocol_status(sn, rq, status_code, NULL); |
|
534 } |
517 |
535 |
518 return ret; |
536 return ret; |
519 } |
537 } |
520 |
538 |
521 int webdav_post(pblock *pb, Session *sn, Request *rq) { |
539 int webdav_post(pblock *pb, Session *sn, Request *rq) { |