httpit
Ultra-fast, lightweight HTTP server for Python. httpit is a high-performance static file server built as a Python C extension, offering exceptional speed and efficiency.
Installation
pip install httpit
Quick Start
Serve files from the current directory on port 8000:
httpit
Serve files from a specific directory:
httpit /path/to/files
Serve on a custom port:
httpit 8080
Combine directory and port:
httpit /path/to/files 8080
Features
- 🚀 Blazing Fast - Built in C with zero-copy sendfile() support
- 🪶 Lightweight - Minimal memory footprint and dependencies
- 🔧 Easy to Use - Simple command-line interface and Python API
- 📁 Directory Listing - Browse directories with built-in HTML interface
- 🔒 Security - Basic authentication and access control support
- 🌐 Modern Standards - HTTP/1.1, IPv6, Keep-Alive, Range requests
- 📊 Production Ready - Access logging, daemon mode, custom MIME types
Command Line Usage
Basic Commands
# Serve current directory on port 8000 (default)
httpit
# Serve on specific port
httpit 8080
# Serve specific directory
httpit /var/www/html
# Serve specific directory on specific port
httpit /var/www/html 8080
Advanced Options
# Enable debug output
httpit -d
# Disable directory listing
httpit -F
# Enable access logging
httpit -l access.log
# Bind to specific IP
httpit -i 192.168.1.100
# Enable CORS headers
httpit -C
# Custom index file
httpit -I index.php
# Set connection timeout (seconds)
httpit -t 30
# Set maximum connections
httpit -c 100
# Run in background (daemon mode)
httpit -D
# Enable basic authentication
httpit -a username:password
# Serve specific virtual host
httpit -n www.example.com
# Custom mime types file
httpit -m /etc/mime.types
Complete Example
# Production server with logging, authentication, and custom settings
httpit /var/www/html 443 \
-D \
-l /var/log/httpit/access.log \
-a admin:secure_password \
-F \
-t 60 \
-c 1000
Python API
Basic Usage
from httpit import HTTPServer
# Create and start server
server = HTTPServer(port=8080, root="/var/www/html")
server.start()
# Check if running
if server.is_running():
print("Server is running")
# Stop server
server.stop()
Context Manager
from httpit import HTTPServer
with HTTPServer(port=8080) as server:
print(f"Serving at http://localhost:{server.port}")
input("Press Enter to stop...")
Advanced Configuration
from httpit import HTTPServer
server = HTTPServer(
port=8080,
root="/var/www/html",
host="www.example.com", # Virtual host
bind_ip="0.0.0.0", # Bind address
debug=True, # Debug output
no_listing=True, # Disable directory listing
auth="user:pass", # Basic auth
log="access.log", # Access log
cors="*", # CORS headers
timeout=60, # Connection timeout
max_connections=1000, # Max concurrent connections
index="index.php" # Index file
)
server.start()
Running in Background Thread
import threading
from httpit import HTTPServer
server = HTTPServer(port=8080)
# Start in background thread
thread = threading.Thread(target=server.serve_forever)
thread.daemon = True
thread.start()
# Your application continues running
# ...
# Stop when done
server.stop()
Performance
httpit is designed for maximum performance:
- Zero-copy file serving using sendfile() system call
- Minimal memory allocations during request handling
- Efficient event loop with epoll/kqueue support
- Smart caching for directory listings and file metadata
Benchmark results show httpit can serve static files 2-5x faster than traditional Python web servers like http.server or SimpleHTTPServer.
Use Cases
- Static file serving - Websites, documentation, downloads
- Development server - Quick testing and prototyping
- Media streaming - Video/audio files with range support
- File sharing - Simple LAN file server
- CDN origin - Backend for content delivery networks
- Docker containers - Minimal footprint for containerized apps
Comparison with Alternatives
| Feature | httpit | http.server | nginx | Apache |
|---|---|---|---|---|
| Performance | ⭐⭐⭐⭐⭐ | ⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ |
| Ease of Use | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐ |
| Memory Usage | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐ |
| Features | ⭐⭐⭐ | ⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ |
| Python Integration | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐ | ⭐ |
Security Considerations
- httpit is designed for serving static files only
- Always use
-Fflag to disable directory listing in production - Use authentication (
-a) for sensitive content - Run as non-root user when possible
- Consider using a reverse proxy for HTTPS in production
Troubleshooting
Port Already in Use
If you see "Port already in use" error:
# Find process using the port
lsof -i :8000
# Or force kill any httpit processes
pkill -f httpit
Permission Denied
If serving from system directories:
# Use sudo (not recommended)
sudo httpit /etc 8080
# Better: copy files to user directory
cp -r /etc/myapp ~/myapp
httpit ~/myapp
No Output / Silent Exit
Run with debug flag to see errors:
httpit -d
Contributing
httpit is a high-performance HTTP server for Python. For feature requests and issues, submit PRs to the httpit repository or visit https://httpit.rodmena.co.uk
License
GNU General Public License v2.0 (GPLv2)
Credits
- httpit is developed and maintained by RODMENA LIMITED
- High-performance C-based HTTP server with Python integration
- Visit https://httpit.rodmena.co.uk for documentation and support
About RODMENA LIMITED
RODMENA LIMITED specializes in high-performance software solutions and web technologies. Visit us at https://rodmena.co.uk for more information about our services and products.
Metadata
Release files for httpit 1.21.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| httpit-1.21.7.tar.gz | 54.5 kB | Details |
Built distributions (wheels)
Total release size: 1.7 MB
Release files / httpit-1.21.7.tar.gz
| Download URL | httpit-1.21.7.tar.gz |
|---|---|
| Size | 54.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b269860e255a82be95f5ebb225f20468b0d74fd22593befd75161c79c1b47163
|
|
BLAKE2b-256 checksum How to use checksums |
a46f313aba777a3e78e74873a7ab917c338ef7e97e0da482daf636b11a9fad94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / httpit-1.21.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | httpit-1.21.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 183.4 kB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
3591503d842df7ab06b6eaed6139e400395fb66ee9d4c81856f341db22fe60b5
|
|
BLAKE2b-256 checksum How to use checksums |
d98304796f466314325d975db33e24a4bd2b8ccaf817f2f58ef069fe41edcf43
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / httpit-1.21.7-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | httpit-1.21.7-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 71.9 kB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
a28899edbbf45dd13df58a7a56b66b7937ba14fc8b85a9ab954e1ac12cc20576
|
|
BLAKE2b-256 checksum How to use checksums |
ae867a1f43445111ad4db66f8ee693d1231c3b2325c345981de84af605427662
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / httpit-1.21.7-cp312-cp312-macosx_10_9_x86_64.whl
| Download URL | httpit-1.21.7-cp312-cp312-macosx_10_9_x86_64.whl |
|---|---|
| Size | 71.3 kB |
| Tags | CPython 3.12 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
e215e6424a08fc5c732ded06467ae853a0ab7f7d7b0bbd3e4570a3e244d5e6c2
|
|
BLAKE2b-256 checksum How to use checksums |
6463e39dc0828e017df4a51a5465d21939b11e9d263b98bdee69d4ad68d068be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / httpit-1.21.7-cp312-cp312-macosx_10_9_universal2.whl
| Download URL | httpit-1.21.7-cp312-cp312-macosx_10_9_universal2.whl |
|---|---|
| Size | 75.7 kB |
| Tags | CPython 3.12 macOS 10.9+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
d361f818757c6bb3696aab04e8733d002babebb803aa4584fdd6b0af95390ae4
|
|
BLAKE2b-256 checksum How to use checksums |
9ab64132f85a592559884b89ac439577e7d5273d4bfbfa8f43fb626bd9d35407
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / httpit-1.21.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | httpit-1.21.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 183.1 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
9cf244039dd2aacf9e0fd1fb9a60e3ac5173cde310eafa2900ed552753588444
|
|
BLAKE2b-256 checksum How to use checksums |
8e0225d7b62f9b317220c3612fd0ecf30d5539313adf4d45c1bf38369f2d97c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / httpit-1.21.7-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | httpit-1.21.7-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 71.9 kB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
da44a7b15381e4b8d9d39b2293cc61ffb6f7d70d3354f68f409a5b3d2ca5e086
|
|
BLAKE2b-256 checksum How to use checksums |
450f96bb8f57e1e960497b55d3dcf325ba8b8cc7c5c7978f656c95f56db01889
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / httpit-1.21.7-cp311-cp311-macosx_10_9_x86_64.whl
| Download URL | httpit-1.21.7-cp311-cp311-macosx_10_9_x86_64.whl |
|---|---|
| Size | 71.3 kB |
| Tags | CPython 3.11 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
6a47a7134f2cb3d44a38dfb8ffe0ebd3c0cf9c11aac5bc7031567aba8bfeb5d5
|
|
BLAKE2b-256 checksum How to use checksums |
93c7e93764a5144437b6dda476a8ead6bd3e30c11b7c95e4975cf0d8701f3153
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / httpit-1.21.7-cp311-cp311-macosx_10_9_universal2.whl
| Download URL | httpit-1.21.7-cp311-cp311-macosx_10_9_universal2.whl |
|---|---|
| Size | 75.7 kB |
| Tags | CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
cd2da175d6eaaf48db118740800fce988a8552f03f1429fc6a8212f8fcdffec0
|
|
BLAKE2b-256 checksum How to use checksums |
baa2e51422ec5ee0dbf3af297caec969c6c38fd5d1be9ca3a4f39fba0ea1a137
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / httpit-1.21.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | httpit-1.21.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 183.1 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
e226ca2f57075b793a9d08572ae3a49f3fb1b9d2c93682c6c08e3e25f9de9a52
|
|
BLAKE2b-256 checksum How to use checksums |
9a9135ef75256242a59dfacb5ad7f404fb992514e20f9b8bc3b91aca25da7d37
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / httpit-1.21.7-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | httpit-1.21.7-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 71.9 kB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
63114778afd96d017dbbd3648a6797c0fb4935846d382140cb1a1006ee5966fe
|
|
BLAKE2b-256 checksum How to use checksums |
27a2afbf4a03cfde90251c4684cf34a45a959899235e8b792a236a352533c8e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / httpit-1.21.7-cp310-cp310-macosx_10_9_x86_64.whl
| Download URL | httpit-1.21.7-cp310-cp310-macosx_10_9_x86_64.whl |
|---|---|
| Size | 71.3 kB |
| Tags | CPython 3.10 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
8a1065fd587a48fe56eb297db044142ef97e1d58e23ec6494a26f4978f102d04
|
|
BLAKE2b-256 checksum How to use checksums |
17cf0dd24a2bad4fe3e909b0244528dd6a4956de5711e2c0d8b93c726ef8c201
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / httpit-1.21.7-cp310-cp310-macosx_10_9_universal2.whl
| Download URL | httpit-1.21.7-cp310-cp310-macosx_10_9_universal2.whl |
|---|---|
| Size | 75.7 kB |
| Tags | CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
97f3e014e28cbfcaa169589ee80322faa3d109c2b5770d950c96a0387b616113
|
|
BLAKE2b-256 checksum How to use checksums |
5858acdeb46d3dedaeae198bb94ebf6046b2520d2d56265f237e577d2ca0a381
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / httpit-1.21.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | httpit-1.21.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 182.8 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
8343e96c64b5df499992415dc1e37f2ca4d59e4a395342f3760eb7a04119fe97
|
|
BLAKE2b-256 checksum How to use checksums |
73a7a7d87692b85da243bd61d96b52d5bdaabf7b2d5ec4d0e90ef9bc65026fcc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / httpit-1.21.7-cp39-cp39-macosx_11_0_arm64.whl
| Download URL | httpit-1.21.7-cp39-cp39-macosx_11_0_arm64.whl |
|---|---|
| Size | 71.9 kB |
| Tags | CPython 3.9 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
900d30bd4fc014cd8af7af2ca27a1829da2dc2caab2bb48f70050ec62ccf3e47
|
|
BLAKE2b-256 checksum How to use checksums |
808e0b2048cfce9365b0a2be748b9a0be12a37b56a093c60e8a9530a66b3dc26
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / httpit-1.21.7-cp39-cp39-macosx_10_9_x86_64.whl
| Download URL | httpit-1.21.7-cp39-cp39-macosx_10_9_x86_64.whl |
|---|---|
| Size | 71.3 kB |
| Tags | CPython 3.9 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
56b678da65b3e6816198fe184eadfce88a636932c015bdd7043624837f571db5
|
|
BLAKE2b-256 checksum How to use checksums |
b90c090d4192706bba5737ae0481ec12433e680abb672f90c4cfa9c454b48455
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / httpit-1.21.7-cp39-cp39-macosx_10_9_universal2.whl
| Download URL | httpit-1.21.7-cp39-cp39-macosx_10_9_universal2.whl |
|---|---|
| Size | 75.7 kB |
| Tags | CPython 3.9 macOS 10.9+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
f1749d1aedf110b7650b0d529ffb89c26dd3650ea43d34fa54be7b8bb53a5346
|
|
BLAKE2b-256 checksum How to use checksums |
c1c481d2f7e1e68b15043dd23744c585f5b781b61bb010304570845990380215
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|