Ultra-fast lightweight HTTP server
Project description
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file httpit-1.21.7.tar.gz.
File metadata
- Download URL: httpit-1.21.7.tar.gz
- Upload date:
- Size: 54.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b269860e255a82be95f5ebb225f20468b0d74fd22593befd75161c79c1b47163
|
|
| MD5 |
22873c0d81ccbf8ad448da96b024a2a0
|
|
| BLAKE2b-256 |
a46f313aba777a3e78e74873a7ab917c338ef7e97e0da482daf636b11a9fad94
|
File details
Details for the file httpit-1.21.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: httpit-1.21.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 183.4 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3591503d842df7ab06b6eaed6139e400395fb66ee9d4c81856f341db22fe60b5
|
|
| MD5 |
805f37b9a64e72d9e965df29beeeeccc
|
|
| BLAKE2b-256 |
d98304796f466314325d975db33e24a4bd2b8ccaf817f2f58ef069fe41edcf43
|
File details
Details for the file httpit-1.21.7-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: httpit-1.21.7-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 71.9 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a28899edbbf45dd13df58a7a56b66b7937ba14fc8b85a9ab954e1ac12cc20576
|
|
| MD5 |
630f143f8956fd72b1c7f5f9ce774f1e
|
|
| BLAKE2b-256 |
ae867a1f43445111ad4db66f8ee693d1231c3b2325c345981de84af605427662
|
File details
Details for the file httpit-1.21.7-cp312-cp312-macosx_10_9_x86_64.whl.
File metadata
- Download URL: httpit-1.21.7-cp312-cp312-macosx_10_9_x86_64.whl
- Upload date:
- Size: 71.3 kB
- Tags: CPython 3.12, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e215e6424a08fc5c732ded06467ae853a0ab7f7d7b0bbd3e4570a3e244d5e6c2
|
|
| MD5 |
d49a2c32aaf4a8c6b2dbba6f6b04d718
|
|
| BLAKE2b-256 |
6463e39dc0828e017df4a51a5465d21939b11e9d263b98bdee69d4ad68d068be
|
File details
Details for the file httpit-1.21.7-cp312-cp312-macosx_10_9_universal2.whl.
File metadata
- Download URL: httpit-1.21.7-cp312-cp312-macosx_10_9_universal2.whl
- Upload date:
- Size: 75.7 kB
- Tags: CPython 3.12, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d361f818757c6bb3696aab04e8733d002babebb803aa4584fdd6b0af95390ae4
|
|
| MD5 |
26d0b3436c267879e8c80828683d057a
|
|
| BLAKE2b-256 |
9ab64132f85a592559884b89ac439577e7d5273d4bfbfa8f43fb626bd9d35407
|
File details
Details for the file httpit-1.21.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: httpit-1.21.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 183.1 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9cf244039dd2aacf9e0fd1fb9a60e3ac5173cde310eafa2900ed552753588444
|
|
| MD5 |
233eef3d75f277ac8203f750ca1d0af6
|
|
| BLAKE2b-256 |
8e0225d7b62f9b317220c3612fd0ecf30d5539313adf4d45c1bf38369f2d97c8
|
File details
Details for the file httpit-1.21.7-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: httpit-1.21.7-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 71.9 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da44a7b15381e4b8d9d39b2293cc61ffb6f7d70d3354f68f409a5b3d2ca5e086
|
|
| MD5 |
9ec8b5d7811392794eae01a8cbe359dc
|
|
| BLAKE2b-256 |
450f96bb8f57e1e960497b55d3dcf325ba8b8cc7c5c7978f656c95f56db01889
|
File details
Details for the file httpit-1.21.7-cp311-cp311-macosx_10_9_x86_64.whl.
File metadata
- Download URL: httpit-1.21.7-cp311-cp311-macosx_10_9_x86_64.whl
- Upload date:
- Size: 71.3 kB
- Tags: CPython 3.11, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a47a7134f2cb3d44a38dfb8ffe0ebd3c0cf9c11aac5bc7031567aba8bfeb5d5
|
|
| MD5 |
857608c2156e00d9fbd9a4cae660239d
|
|
| BLAKE2b-256 |
93c7e93764a5144437b6dda476a8ead6bd3e30c11b7c95e4975cf0d8701f3153
|
File details
Details for the file httpit-1.21.7-cp311-cp311-macosx_10_9_universal2.whl.
File metadata
- Download URL: httpit-1.21.7-cp311-cp311-macosx_10_9_universal2.whl
- Upload date:
- Size: 75.7 kB
- Tags: CPython 3.11, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd2da175d6eaaf48db118740800fce988a8552f03f1429fc6a8212f8fcdffec0
|
|
| MD5 |
73aa96f36fcd1f46b63ffc1cedfd0d2b
|
|
| BLAKE2b-256 |
baa2e51422ec5ee0dbf3af297caec969c6c38fd5d1be9ca3a4f39fba0ea1a137
|
File details
Details for the file httpit-1.21.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: httpit-1.21.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 183.1 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e226ca2f57075b793a9d08572ae3a49f3fb1b9d2c93682c6c08e3e25f9de9a52
|
|
| MD5 |
f0725415149f07dd587b46b8e6da454b
|
|
| BLAKE2b-256 |
9a9135ef75256242a59dfacb5ad7f404fb992514e20f9b8bc3b91aca25da7d37
|
File details
Details for the file httpit-1.21.7-cp310-cp310-macosx_11_0_arm64.whl.
File metadata
- Download URL: httpit-1.21.7-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 71.9 kB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63114778afd96d017dbbd3648a6797c0fb4935846d382140cb1a1006ee5966fe
|
|
| MD5 |
8b5b46735fc24f62195f7a7193a10c80
|
|
| BLAKE2b-256 |
27a2afbf4a03cfde90251c4684cf34a45a959899235e8b792a236a352533c8e1
|
File details
Details for the file httpit-1.21.7-cp310-cp310-macosx_10_9_x86_64.whl.
File metadata
- Download URL: httpit-1.21.7-cp310-cp310-macosx_10_9_x86_64.whl
- Upload date:
- Size: 71.3 kB
- Tags: CPython 3.10, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a1065fd587a48fe56eb297db044142ef97e1d58e23ec6494a26f4978f102d04
|
|
| MD5 |
057649205148e67b7336bc3f62642fa5
|
|
| BLAKE2b-256 |
17cf0dd24a2bad4fe3e909b0244528dd6a4956de5711e2c0d8b93c726ef8c201
|
File details
Details for the file httpit-1.21.7-cp310-cp310-macosx_10_9_universal2.whl.
File metadata
- Download URL: httpit-1.21.7-cp310-cp310-macosx_10_9_universal2.whl
- Upload date:
- Size: 75.7 kB
- Tags: CPython 3.10, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97f3e014e28cbfcaa169589ee80322faa3d109c2b5770d950c96a0387b616113
|
|
| MD5 |
4cb39457f8dc80909b96805dede90184
|
|
| BLAKE2b-256 |
5858acdeb46d3dedaeae198bb94ebf6046b2520d2d56265f237e577d2ca0a381
|
File details
Details for the file httpit-1.21.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: httpit-1.21.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 182.8 kB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8343e96c64b5df499992415dc1e37f2ca4d59e4a395342f3760eb7a04119fe97
|
|
| MD5 |
1d416445bb226cc5a66b766fd3b968ae
|
|
| BLAKE2b-256 |
73a7a7d87692b85da243bd61d96b52d5bdaabf7b2d5ec4d0e90ef9bc65026fcc
|
File details
Details for the file httpit-1.21.7-cp39-cp39-macosx_11_0_arm64.whl.
File metadata
- Download URL: httpit-1.21.7-cp39-cp39-macosx_11_0_arm64.whl
- Upload date:
- Size: 71.9 kB
- Tags: CPython 3.9, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
900d30bd4fc014cd8af7af2ca27a1829da2dc2caab2bb48f70050ec62ccf3e47
|
|
| MD5 |
0726a0f6aef9b975c7f1580f77313d22
|
|
| BLAKE2b-256 |
808e0b2048cfce9365b0a2be748b9a0be12a37b56a093c60e8a9530a66b3dc26
|
File details
Details for the file httpit-1.21.7-cp39-cp39-macosx_10_9_x86_64.whl.
File metadata
- Download URL: httpit-1.21.7-cp39-cp39-macosx_10_9_x86_64.whl
- Upload date:
- Size: 71.3 kB
- Tags: CPython 3.9, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56b678da65b3e6816198fe184eadfce88a636932c015bdd7043624837f571db5
|
|
| MD5 |
6e0746c38b6800c3e8de2464d1738296
|
|
| BLAKE2b-256 |
b90c090d4192706bba5737ae0481ec12433e680abb672f90c4cfa9c454b48455
|
File details
Details for the file httpit-1.21.7-cp39-cp39-macosx_10_9_universal2.whl.
File metadata
- Download URL: httpit-1.21.7-cp39-cp39-macosx_10_9_universal2.whl
- Upload date:
- Size: 75.7 kB
- Tags: CPython 3.9, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1749d1aedf110b7650b0d529ffb89c26dd3650ea43d34fa54be7b8bb53a5346
|
|
| MD5 |
60dfbda62c7e372a1bb5d6aabd986115
|
|
| BLAKE2b-256 |
c1c481d2f7e1e68b15043dd23744c585f5b781b61bb010304570845990380215
|