537 if(!webdav_vfs_op_do(op, WEBDAV_VFS_MKDIR)) { |
537 if(!webdav_vfs_op_do(op, WEBDAV_VFS_MKDIR)) { |
538 pblock_nvinsert("content-length", "0", rq->srvhdrs); |
538 pblock_nvinsert("content-length", "0", rq->srvhdrs); |
539 protocol_status(sn, rq, 201, NULL); |
539 protocol_status(sn, rq, 201, NULL); |
540 protocol_start_response(sn, rq); |
540 protocol_start_response(sn, rq); |
541 ret = REQ_PROCEED; |
541 ret = REQ_PROCEED; |
542 } else { |
542 } else if(rq->status_num <= 0) { |
543 if(rq->status_num <= 0) { |
543 int status_code = 500; |
544 int status_code = 500; |
544 if(op->vfs->vfs_errno == EEXIST) { |
545 if(op->vfs->vfs_errno == EEXIST) { |
545 // 405 (Method Not Allowed) - MKCOL can only be executed on an unmapped URL. |
546 // 405 (Method Not Allowed) - MKCOL can only be executed on an unmapped URL. |
546 status_code = 405; |
547 status_code = 405; |
547 } else if(op->vfs->vfs_errno == ENOENT) { |
548 } else if(op->vfs->vfs_errno == ENOENT) { |
548 // 409 (Conflict) - A collection cannot be made at the Request-URI until |
549 // 409 (Conflict) - A collection cannot be made at the Request-URI until |
549 // one or more intermediate collections have been created. The server |
550 // one or more intermediate collections have been created. The server |
550 // MUST NOT create those intermediate collections automatically. |
551 // MUST NOT create those intermediate collections automatically. |
551 status_code = 409; |
552 status_code = 409; |
552 } else { |
553 } |
553 log_ereport(LOG_VERBOSE, "webdav_mkcol: errno: %d", op->vfs->vfs_errno); |
554 protocol_status(sn, rq, status_code, NULL); |
554 } |
555 } |
555 protocol_status(sn, rq, status_code, NULL); |
556 |
|
557 } |
556 } |
558 |
557 |
559 return ret; |
558 return ret; |
560 } |
559 } |
561 |
560 |