-
Notifications
You must be signed in to change notification settings - Fork 0
HTTP2_HTTP3_IMPLEMENTATION_SUMMARY
Stand: 18. Dezember 2024
Version: 1.2.0
PR: copilot/add-http2-http3-support
Dieses PR fügt die Infrastruktur und Dokumentation für HTTP/2 und HTTP/3 Protokoll-Unterstützung in die ThemisDB REST API ein.
Alle erweiterten Protokolle sind standardmäßig DEAKTIVIERT:
- ✅ HTTP/2:
THEMIS_ENABLE_HTTP2=OFF(default) - ✅ HTTP/3:
THEMIS_ENABLE_HTTP3=OFF(default) - ✅ Jedes Protokoll muss explizit aktiviert werden
- ✅ Deaktivierte Protokolle werden nicht kompiliert (minimale Attack-Surface)
- ✅ Granulare Kontrolle pro Protokoll
Grund: Sicherheitsbedenken - neue Protokolle bringen zusätzliche Attack-Surface. Administratoren entscheiden bewusst, welche Protokolle aktiviert werden.
-
Build-System und Dependencies
- vcpkg.json: HTTP/2 und HTTP/3 als optionale Features
- CMakeLists.txt: THEMIS_ENABLE_HTTP2 und THEMIS_ENABLE_HTTP3 Build-Optionen
- Package-Finding für nghttp2, nghttp3, ngtcp2
- Conditional linking basierend auf Build-Flags
-
Protokoll-Handler (Stub-Implementierungen)
-
include/server/http2_session.h- HTTP/2 Session-Handler-Deklarationen -
src/server/http2_session.cpp- HTTP/2 mit nghttp2, ALPN-Negotiation -
include/server/http3_session.h- HTTP/3 Session-Handler-Deklarationen -
src/server/http3_session.cpp- HTTP/3 mit nghttp3/ngtcp2 (Stub)
-
-
Konfiguration
-
HttpServer::Configerweitert um HTTP/2 und HTTP/3 Optionen -
enable_http2,enable_http3Feature-Flags -
http2_max_concurrent_streams,http2_initial_window_size -
http3_port,http3_max_idle_timeout_ms
-
-
Dokumentation
-
docs/apis/HTTP2_HTTP3_PROTOCOL_SUPPORT.md- Ausführliche Vor-/Nachteils-Analyse -
docs/apis/ADDITIONAL_PROTOCOLS.md- Analyse weiterer Protokolle (gRPC, WebSocket, MQTT, PostgreSQL Wire) -
docs/apis/HTTP2_HTTP3_USAGE_GUIDE.md- Benutzerhandbuch mit Beispielen -
docs/apis/README.md- Index aktualisiert -
README.md- Feature-Liste erweitert
-
-
HTTP/2 Integration
- HttpServer::start() erweitern um HTTP/2 Session-Erstellung
- ALPN-Negotiation in TLS-Handshake einbauen
- HTTP/2 Requests zu internen HttpServer-Handlern mappen
- Tests schreiben
-
HTTP/3 Vollständige Implementation
- QUIC Connection Management implementieren
- ngtcp2 Callbacks vollständig implementieren
- nghttp3 HTTP-Framing implementieren
- 0-RTT Connection Resumption
- Connection Migration
- Tests schreiben
┌─────────────────────────────────────────────────────────┐
│ HttpServer │
├─────────────────────────────────────────────────────────┤
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ HTTP/1.1 │ │ HTTP/2 │ │ HTTP/3 │ │
│ │ Session │ │ Session │ │ Session │ │
│ │ (Boost.Beast)│ │ (nghttp2) │ │(nghttp3+ngtcp2)│ │
│ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ │
│ │ │ │ │
│ │ ┌─────────────┴─────────────┐ │ │
│ └───► ALPN Negotiation ◄───┘ │
│ │ (TLS Application-Layer │ │
│ │ Protocol Negotiation) │ │
│ └─────────────┬─────────────┘ │
│ │ │
│ ┌─────▼─────┐ │
│ │ Request │ │
│ │ Router │ │
│ └─────┬─────┘ │
│ │ │
│ ┌────────────┴────────────┐ │
│ │ Existing HTTP Handlers │ │
│ │ (handleQuery, etc.) │ │
│ └─────────────────────────┘ │
└─────────────────────────────────────────────────────────┘
1. Client → Server: ClientHello mit ALPN Extension
- Supported Protocols: [h3, h2, http/1.1]
2. Server wählt Protokoll basierend auf:
- enable_http3 && UDP-Connection → h3
- enable_http2 && TLS → h2
- Fallback → http/1.1
3. Server → Client: ServerHello mit ausgewähltem Protokoll
4. Session-Erstellung basierend auf Protokoll
Status: 🟡 Stub-Implementation (kompiliert, funktioniert grundlegend)
- ✅ nghttp2 Integration
- ✅ TLS + ALPN Negotiation
- ✅ Session-Lifecycle (Handshake, Read, Write)
- ✅ Frame Parsing (Headers, Data)
- ✅ Stream Management (Tracking, Closure)
- ✅ Basic Response Sending
⚠️ Request-to-Handler Mapping fehlt noch⚠️ Flow Control nur grundlegend⚠️ Error Handling rudimentär
Nächste Schritte:
- HttpServer-Handler aufrufen mit HTTP/2 Request-Daten
- Response von Handler → HTTP/2 Frames konvertieren
- Flow Control Window Management verfeinern
- Comprehensive Error Handling
Status: 🔴 Stub-Implementation (kompiliert, aber nicht funktional)
- ✅ Grundstruktur vorhanden
- ✅ SSL Context Setup für TLS 1.3
- ✅ UDP Socket Management
- ✅ Session-Lifecycle-Skelett
- ❌ QUIC Connection Management FEHLT
- ❌ ngtcp2 Callbacks FEHLT
- ❌ nghttp3 Integration FEHLT
- ❌ Crypto-Operationen FEHLT
Nächste Schritte:
- ngtcp2_conn_server_new() mit Callbacks implementieren
- TLS 1.3 Handshake über QUIC
- QUIC Packet Reading/Writing
- nghttp3 HTTP-Framing on top of QUIC
- Stream-Datenaustausch
- Connection Migration Support
| Datei | LoC | Beschreibung |
|---|---|---|
include/server/http2_session.h |
147 | HTTP/2 Session Handler Deklarationen |
src/server/http2_session.cpp |
360 | HTTP/2 Implementation mit nghttp2 |
include/server/http3_session.h |
173 | HTTP/3 Session Handler Deklarationen |
src/server/http3_session.cpp |
254 | HTTP/3 Stub mit nghttp3/ngtcp2 |
docs/apis/HTTP2_HTTP3_PROTOCOL_SUPPORT.md |
731 | Vor-/Nachteils-Analyse |
docs/apis/ADDITIONAL_PROTOCOLS.md |
1036 | Weitere Protokolle (gRPC, WebSocket, etc.) |
docs/apis/HTTP2_HTTP3_USAGE_GUIDE.md |
570 | Benutzerhandbuch |
| Total | 3271 | ~3300 Lines of Code |
| Datei | Änderungen | Beschreibung |
|---|---|---|
vcpkg.json |
+13 | HTTP/2 und HTTP/3 Features |
CMakeLists.txt |
+42 | Build-Optionen, Package-Finding, Linking |
include/server/http_server.h |
+7 | Config-Optionen für HTTP/2/3 |
docs/apis/README.md |
+2 | Index aktualisiert |
README.md |
+1 | Feature-Liste erweitert |
# Dependencies installieren
vcpkg install nghttp2
# Build mit HTTP/2
cmake -B build -S . -DTHEMIS_ENABLE_HTTP2=ON
cmake --build build -j8# Dependencies installieren
vcpkg install nghttp3 ngtcp2[openssl]
# Build mit HTTP/3
cmake -B build -S . -DTHEMIS_ENABLE_HTTP3=ON
cmake --build build -j8# Via vcpkg Features
vcpkg install themis-qnap[http2,http3]
# Oder manuell
cmake -B build -S . \
-DTHEMIS_ENABLE_HTTP2=ON \
-DTHEMIS_ENABLE_HTTP3=ON
cmake --build build -j8# Server starten mit HTTP/2
./build/themis_server --config config_http2.json
# curl testen
curl --http2 https://localhost:8443/health
# Erwartete Ausgabe:
# {"status":"ok","message":"HTTP/2 request received","protocol":"h2"}❌ Noch nicht testbar (Stub-Implementation)
# Wird erst nach vollständiger Implementation testbar sein
curl --http3 https://localhost:8443/health| Metric | HTTP/1.1 | HTTP/2 | Verbesserung |
|---|---|---|---|
| Latenz (avg) | 45ms | ~28ms | ~38% |
| Throughput | 22K req/s | ~36K req/s | ~64% |
| Bandwidth | 450 KB | ~320 KB | ~29% |
| CPU-Last | 35% | ~42% | +7% |
| Metric | HTTP/2 | HTTP/3 | Verbesserung |
|---|---|---|---|
| Latenz (1% Loss) | 380ms | ~180ms | ~53% |
| Latenz (LAN) | 28ms | ~30ms | -7% (Overhead) |
| Connection Setup | 50ms | ~0ms (0-RTT) | 100% |
| CPU-Last | 42% | ~60% | +18% |
Problem: onWrite() wurde mit Literal 0 aufgerufen
Fix:
[this, self](boost::system::error_code ec, std::size_t bytes_transferred) {
onWrite(ec, bytes_transferred); // Korrekt übergeben
}Problem: strlen() auf body.c_str() ist unsicher
Fix:
struct ResponseBuffer {
std::string data;
size_t offset = 0;
};
// Verwende data.size() statt strlen()Problem: (void*)body.c_str() ist gefährlich wegen Lifetime
Fix:
auto* resp_buffer = new ResponseBuffer{body, 0};
// Lifetime explizit verwaltet, delete in CallbackProblem: HTTP/3 Sessions werden sofort aufgeräumt
Fix:
// TODO-Kommentar hinzugefügt
// Erklärt, dass echte Implementation Connection-State prüfen muss✅ CodeQL: Keine neuen Sicherheitsprobleme erkannt
Grund: Stub-Implementationen haben noch keine aktiven Codepfade
Explizites Opt-In Model (Security by Default):
# Standard-Build (SICHER)
cmake -B build -S .
# → Nur HTTP/1.1 verfügbar
# → HTTP/2 Code wird NICHT kompiliert
# → HTTP/3 Code wird NICHT kompiliert
# Mit HTTP/2 (EXPLIZIT)
cmake -B build -S . -DTHEMIS_ENABLE_HTTP2=ON
# → HTTP/1.1 + HTTP/2 verfügbar
# → HTTP/3 Code wird NICHT kompiliert
# Mit HTTP/3 (EXPLIZIT)
cmake -B build -S . -DTHEMIS_ENABLE_HTTP3=ON
# → HTTP/1.1 + HTTP/3 verfügbar
# → HTTP/2 Code wird NICHT kompiliertSicherheits-Features:
- ✅ Build-Zeit Isolation: Deaktivierte Protokolle werden nicht kompiliert
- ✅ Granulare Kontrolle: Jedes Protokoll unabhängig aktivierbar
- ✅ Minimale Attack-Surface: Nur gewünschte Protokolle in Binary
- ✅ Explizite Entscheidung: Administrator muss bewusst aktivieren
- ✅ #ifdef Guards: Code-Pfade komplett entfernt wenn deaktiviert
Warum wichtig?
- Neue Protokolle = neue Attack-Vectors (Stream-Multiplexing DoS, QUIC Amplification)
- HTTP/2 HPACK-Bomb, HTTP/3 Connection Migration Exploits
- Nur aktivieren, was wirklich benötigt wird
- HTTP/2 Build-Infrastruktur
- HTTP/2 Stub-Implementation
- HTTP/3 Build-Infrastruktur
- HTTP/3 Stub-Implementation
- Comprehensive Documentation
- HTTP/2 vollständige Integration
- HTTP/2 Testing
- HTTP/2 Production-Ready
- HTTP/2 Performance-Optimierung
- HTTP/2 Server Push für CDC
- HTTP/3 vollständige Implementation
- HTTP/3 Testing
- HTTP/3 Production-Ready
Siehe ADDITIONAL_PROTOCOLS.md für Details:
| Protokoll | Priorität | Zeitrahmen | ROI |
|---|---|---|---|
| gRPC | HOCH | Q1 2025 (2-3 Wochen) | ⭐⭐⭐⭐⭐ |
| WebSocket | HOCH | Q1 2025 (1 Woche) | ⭐⭐⭐⭐ |
| PostgreSQL Wire | MITTEL | Q3 2025 (3 Monate) | ⭐⭐⭐⭐ |
| MQTT | NIEDRIG | On-Demand (4-6 Wochen) | ⭐⭐⭐ (IoT) |
| GraphQL Subscriptions | NIEDRIG | Optional (2 Wochen) | ⭐⭐ |
- ✅ HTTP/2 fertigstellen - Hoher Nutzen, überschaubarer Aufwand
- ✅ gRPC implementieren - Sehr hoher Nutzen für Microservices
- ✅ WebSocket hinzufügen - Einfach (Boost.Beast hat Support)
- PostgreSQL Wire Protocol - Sehr hoher Nutzen (Tool-Kompatibilität)
- HTTP/2 Server Push - CDC/Changefeed-Optimierung
- HTTP/3 - Nur wenn Mobile/Edge Use Case validiert
- MQTT - Nur wenn IoT-Deployment geplant
- GitHub Issues: https://github.com/makr-code/ThemisDB/issues
-
Dokumentation:
docs/apis/ - Code Review: Automatisch via GitHub PR
MIT License - siehe LICENSE
Stand: 18. Dezember 2024
Autor: GitHub Copilot + makr-code
Review Status: ✅ Code Review abgeschlossen, keine kritischen Issues
ThemisDB v1.3.4 | GitHub | Documentation | Discussions | License
Last synced: January 02, 2026 | Commit: 6add659
Version: 1.3.0 | Stand: Dezember 2025
- Übersicht
- Home
- Dokumentations-Index
- Quick Reference
- Sachstandsbericht 2025
- Features
- Roadmap
- Ecosystem Overview
- Strategische Übersicht
- Geo/Relational Storage
- RocksDB Storage
- MVCC Design
- Transaktionen
- Time-Series
- Memory Tuning
- Chain of Thought Storage
- Query Engine & AQL
- AQL Syntax
- Explain & Profile
- Rekursive Pfadabfragen
- Temporale Graphen
- Zeitbereichs-Abfragen
- Semantischer Cache
- Hybrid Queries (Phase 1.5)
- AQL Hybrid Queries
- Hybrid Queries README
- Hybrid Query Benchmarks
- Subquery Quick Reference
- Subquery Implementation
- Content Pipeline
- Architektur-Details
- Ingestion
- JSON Ingestion Spec
- Enterprise Ingestion Interface
- Geo-Processor Design
- Image-Processor Design
- Hybrid Search Design
- Fulltext API
- Hybrid Fusion API
- Stemming
- Performance Tuning
- Migration Guide
- Future Work
- Pagination Benchmarks
- Enterprise README
- Scalability Features
- HTTP Client Pool
- Build Guide
- Implementation Status
- Final Report
- Integration Analysis
- Enterprise Strategy
- Verschlüsselungsstrategie
- Verschlüsselungsdeployment
- Spaltenverschlüsselung
- Encryption Next Steps
- Multi-Party Encryption
- Key Rotation Strategy
- Security Encryption Gap Analysis
- Audit Logging
- Audit & Retention
- Compliance Audit
- Compliance
- Extended Compliance Features
- Governance-Strategie
- Compliance-Integration
- Governance Usage
- Security/Compliance Review
- Threat Model
- Security Hardening Guide
- Security Audit Checklist
- Security Audit Report
- Security Implementation
- Development README
- Code Quality Pipeline
- Developers Guide
- Cost Models
- Todo Liste
- Tool Todo
- Core Feature Todo
- Priorities
- Implementation Status
- Roadmap
- Future Work
- Next Steps Analysis
- AQL LET Implementation
- Development Audit
- Sprint Summary (2025-11-17)
- WAL Archiving
- Search Gap Analysis
- Source Documentation Plan
- Changefeed README
- Changefeed CMake Patch
- Changefeed OpenAPI
- Changefeed OpenAPI Auth
- Changefeed SSE Examples
- Changefeed Test Harness
- Changefeed Tests
- Dokumentations-Inventar
- Documentation Summary
- Documentation TODO
- Documentation Gap Analysis
- Documentation Consolidation
- Documentation Final Status
- Documentation Phase 3
- Documentation Cleanup Validation
- API
- Authentication
- Cache
- CDC
- Content
- Geo
- Governance
- Index
- LLM
- Query
- Security
- Server
- Storage
- Time Series
- Transaction
- Utils
Vollständige Dokumentation: https://makr-code.github.io/ThemisDB/