Back to project Clone EDS.git Files

nwedav

A high-performance WebDAV server implementation in pure C.

Features

  • WebDAV Class 2 compliance (RFC 4918)
  • HTTP/1.1 with keep-alive support
  • Basic and Digest authentication
  • Resource locking (exclusive and shared)
  • Property management (dead properties)
  • User quota management
  • Cross-platform (Linux, macOS, Windows)
  • Event-driven I/O (epoll, kqueue, poll, select)
  • Thread pool for request processing
  • Connection pooling
  • SQLite-based metadata storage

Requirements

Build Dependencies

  • GCC or Clang (C11 support)
  • CMake 3.10+
  • SQLite3 development libraries
  • OpenSSL development libraries
  • UUID library (Linux)

Debian/Ubuntu

apt-get install build-essential cmake libsqlite3-dev libssl-dev uuid-dev

RHEL/CentOS/Fedora

dnf install gcc cmake make sqlite-devel openssl-devel libuuid-devel

macOS

brew install cmake sqlite openssl

Building

mkdir build && cd build
cmake ..
make

Build Output

  • nwedav - WebDAV server binary
  • webdavctl - Administration CLI tool

Testing

mkdir build && cd build
cmake ..
make run_tests
./tests/run_tests

Test Categories

  • run_tests - Unit tests
  • run_integration_tests - Integration tests (WebDAV methods, HTTP, auth flows)
  • run_management_tests - User/quota/CGI management tests
  • run_all_tests - All tests
ctest -L unit          # Run unit tests
ctest -L integration # Run integration tests
ctest -L all # Run all tests

Installation

cmake --install . --prefix /usr/local

Configuration

Initialize Database

./webdavctl init -d /var/lib/nwedav

Add User

./webdavctl user add <username> -d /var/lib/nwedav

Set User Quota

./webdavctl quota set <username> <bytes> -d /var/lib/nwedav

Start Server

./nwedav -d /var/lib/nwedav -p 8080

Command Line Options

nwedav

| Option | Description | |--------|-------------| | -c, --config <path> | Configuration file path | | -p, --port <port> | Listen port (default: 8080) | | -b, --bind <addr> | Bind address (default: 0.0.0.0) | | -d, --data <path> | Data directory path | | -f, --foreground | Run in foreground | | -v, --verbose | Enable debug logging | | -V, --version | Show version | | -h, --help | Show help |

webdavctl

webdavctl init [-d <data_dir>]
webdavctl user add <username> [-d <data_dir>]
webdavctl user delete <username> [-d <data_dir>]
webdavctl user list [-d <data_dir>]
webdavctl quota set <username> <bytes> [-d <data_dir>]
webdavctl quota get <username> [-d <data_dir>]

Configuration File

[server]
port = 8080
bind_address = 0.0.0.0
worker_threads = 4
max_connections = 1000

[storage]
root_path = /var/lib/nwedav/files
database_path = /var/lib/nwedav/nwedav.db

[auth]
method = basic
realm = nwedav

[logging]
level = info
file = /var/log/nwedav/access.log

WebDAV Client Access

Linux (cadaver)

cadaver http://localhost:8080/

Windows

Map network drive to \\localhost@8080\DavWWWRoot

macOS

Finder &gt; Go &gt; Connect to Server &gt; http://localhost:8080/

Architecture

src/
├── core/ # Server core, configuration, logging
├── http/ # HTTP parser and response builder
├── webdav/ # WebDAV method handlers
├── storage/ # File system backend, properties, locks
├── auth/ # Authentication (Basic, Digest)
├── user/ # User management
├── concurrency/ # Thread pool, event loop, connection pool
├── platform/ # Platform abstraction layer
└── cli/ # webdavctl tool

tests/
├── unit/ # Unit tests
├── integration/ # Integration tests
├── management/ # Management tests
└── fixtures/ # Test fixtures and helpers

Supported Methods

| Method | Description | |--------|-------------| | OPTIONS | Server capabilities | | GET | Retrieve resource | | HEAD | Retrieve resource metadata | | PUT | Create/update resource | | DELETE | Delete resource | | MKCOL | Create collection | | COPY | Copy resource | | MOVE | Move resource | | PROPFIND | Retrieve properties | | PROPPATCH | Modify properties | | LOCK | Lock resource | | UNLOCK | Unlock resource |

Performance

  • Event-driven I/O with epoll (Linux), kqueue (BSD/macOS)
  • Thread pool for parallel request processing
  • Connection pooling with keep-alive support
  • Zero-copy response building where possible
  • Memory pool for frequent allocations

Security

  • Path traversal protection
  • PBKDF2-SHA256 password hashing
  • Digest authentication with nonce validation
  • Resource locking with owner verification
  • User-based access control

License

MIT License

Files

  • CMakeLists.txt
  • Makefile
  • README.md
  • include
  • src
  • tests