retoor 5b5e6989ce feat: add initial CGI support with environment variable passing
Implement basic CGI functionality including environment variable setup for
REQUEST_METHOD, QUERY_STRING, CONTENT_TYPE, CONTENT_LENGTH, PATH_INFO,
SCRIPT_NAME, SERVER_PROTOCOL, SERVER_SOFTWARE, GATEWAY_INTERFACE, and
SERVER_PORT. The implementation passes CGI environment variables to the
child process and handles basic request routing. Note: this is an untested
initial implementation that requires further validation.
2025-11-28 04:34:38 +00:00

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)
  • Make or CMake
  • SQLite3 development libraries
  • OpenSSL development libraries
  • UUID library (Linux)

Debian/Ubuntu

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

RHEL/CentOS/Fedora

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

macOS

brew install sqlite openssl

Building

Using Make

make

Using CMake

mkdir build && cd build
cmake ..
make

Build Output

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

Installation

make install

Default installation prefix is /usr/local. Override with PREFIX:

make install PREFIX=/opt/nwedav

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

Copy nwedav.conf.sample to nwedav.conf and modify as needed:

[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 > Go > Connect to Server > 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

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

S
Description
EDS stands for Enterprise DAV server because of it's high quality. It has user management and quota management. It is made for performance and concurrency and implements the whole RFC 4918. This server is made for production usage for my cloud storage provider.
Readme
2.3 MiB
Languages
C 98.4%
CMake 1.3%
Makefile 0.3%