LGPL 2.1 und Kommerzielle Lizenz.
  • PureBasic 98.4%
  • Shell 1.4%
  • Makefile 0.2%
Find a file
René Linder 37cbef1aaa feat(h2): RFC 9113/7541 Compliance Phase 3 — HPACK Strict + GOAWAY Delivery
H2_Stream: GOAWAY wird jetzt zuverlaessig zugestellt (goaway_sent Guard
im Frame-Loop verhindert weitere Verarbeitung nach GOAWAY).
SETTINGS_INITIAL_WINDOW_SIZE Delta loest jetzt Flush von pending DATA aus.

HPACK_Codec: 5 RFC 7541 Validierungen hinzugefuegt:
- Huffman EOS/Padding/Zero-Pad Fehler werden als COMPRESSION_ERROR propagiert
- Dynamic Table Size Update nur am Anfang des Header-Blocks erlaubt
- Dynamic Table Size Update darf SETTINGS_HEADER_TABLE_SIZE nicht ueberschreiten

h2spec h2c: 145/146 einzeln (1 = h2c Limitation), 127/146 Full Suite
Unit Tests: 501/501 gruen

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 11:18:02 +02:00
http_doc docs(security): L-06 — Debug Statements Review abgeschlossen 2026-03-31 15:30:15 +02:00
http_lib feat(h2): RFC 9113/7541 Compliance Phase 3 — HPACK Strict + GOAWAY Delivery 2026-04-01 11:18:02 +02:00
http_tests feat(compliance): Extended Test Infrastructure + Security Fix 2026-03-31 16:27:40 +02:00
net_doc chore: net_lib/net_doc Update aus NET_Framework 2026-03-31 15:06:46 +02:00
net_lib fix(net): TLS Race Condition vollständig behoben — alle 3 SSL_free Pfade 2026-04-01 06:03:40 +02:00
.gitignore feat(compliance): Extended Test Infrastructure + Security Fix 2026-03-31 16:27:40 +02:00
CLAUDE.md feat(websocket): WS_TestSuite + Makefile + Dokumentation 2026-03-31 13:53:24 +02:00
LICENSE Initial commit 2026-03-01 11:26:25 +01:00
Makefile feat(compliance): Extended Test Infrastructure + Security Fix 2026-03-31 16:27:40 +02:00
README.md V3.4: Routing Refactoring, Dynamisches SNI, Interne PKI 2026-03-16 07:26:55 +01:00

PureBasic HTTP Stack V3.4

Triple-Protocol HTTP Server & Client — HTTP/1.1 · HTTP/2 · HTTP/3

License: LGPL v2.1 Commercial License PureBasic Platform NET Stack Tests


Übersicht

Ein vollständiger, hochperformanter HTTP-Stack in PureBasic mit nativem Support für alle drei HTTP-Generationen:

Protokoll Standard Features
HTTP/1.1 RFC 72307235 Zero-Copy State-Machine Parser, Chunked Transfer
HTTP/2 RFC 9113 Binary Framing, HPACK, Stream Multiplexing, Push
HTTP/3 RFC 9114 QUIC Transport, QPACK, 0-RTT, Connection Migration

11 HTTP-Module · ~21'270 Codezeilen · 954/954 Tests bestanden

Basierend auf dem NET Stack V5.3 (14 Module, ~20'240 Zeilen) mit nativem QUIC, GSO/GRO, ECN und Pacing.


Features

  • Triple-Protocol Transparency — Ein einziges API für H1, H2 und H3; Protokollwahl erfolgt automatisch (ALPN)
  • QUIC / HTTP/3 — Native OpenSSL 3.5 QUIC Integration, QPACK Header-Kompression, H3 Framing
  • HTTP/2 — Full Binary Framing, HPACK, Server Push, h2c Cleartext Support
  • TLS / HTTPS — OpenSSL-basiert mit SNI Multi-Domain und ALPN Negotiation
  • ACME / Let's Encrypt — Automatische Zertifikatsbeschaffung und -erneuerung
  • Routing — Named Parameters (:id), Wildcards (*path), Spezifitäts-Ranking, Virtual Hosts
  • Interne PKI — Self-Signed Zertifikate, Interne Root CA, Auto-TLS (V3.4)
  • Static File Serving — Range Requests (HTTP 206), Directory Index, Path-Traversal-Schutz
  • HTTP Client — Vollständiger Client mit H1/H2/H3 Support, Downloads, Protokoll-Fixierung
  • QUIC Performance — GSO/GRO Batch-Sends, ECN Congestion Notification, Pacing (NET V5.3)

Neu in V3.4

Routing Refactoring — Named Parameters endlich implementiert (war seit V2.1 dokumentiert, funktionierte nie):

HTTP_Server::RegisterRoute("GET", "/users/:id", @GetUser())
; /users/42 → *req\query_params("id") = "42"

HTTP_Server::RegisterRoute("GET", "/files/*path", @FileHandler())
; /files/img/logo.png → *req\query_params("path") = "img/logo.png"

Spezifitäts-Ranking: EXACT schlägt PARAM schlägt WILDCARD — unabhängig von der Registrierungsreihenfolge. Neue APIs: UnregisterVHostRoute(), DumpRoutes().

Dynamisches SNIReloadSNICertificate() für ACME-Renewal, Zertifikat-Inventar (GetSNICertificateCount/List/Info()), Renewal-Callback.

Interne PKI — Neues Modul HTTP_PKI.pbi: Self-Signed Zertifikate, Interne Root CA für Intranet, Auto-TLS (StartTLS() ohne SetCertificate() generiert Self-Signed on-the-fly).


XIncludeFile "http_lib/HTTP_Server.pbi"

Procedure Hello(connection_id.i, *req.HTTP_Protokoll::HTTP_Request)
  HTTP_Server::RespondText(connection_id, 200, "Hello World!")
EndProcedure

HTTP_Server::Init()
HTTP_Server::RegisterRoute("GET", "/", @Hello())
HTTP_Server::Start("0.0.0.0", 8080)

Testen: curl http://localhost:8080/

Für HTTPS + HTTP/2:

HTTP_Server::SetCertificate("cert.pem", "key.pem")
HTTP_Server::StartTLS("0.0.0.0", 443)
; ALPN "h2,http/1.1" wird automatisch konfiguriert.
; Handler-Code ist für HTTP/1.1 und HTTP/2 identisch!

Noch schneller (V3.4 Auto-TLS — kein Zertifikat nötig):

XIncludeFile "http_lib/HTTP_PKI.pbi"     ; ← VOR HTTP_Server!
XIncludeFile "http_lib/HTTP_Server.pbi"

HTTP_Server::Init()
HTTP_Server::RegisterRoute("GET", "/", @Hello())
HTTP_Server::StartTLS("0.0.0.0", 443)    ; → Self-Signed wird automatisch generiert

Für ausführliche Beispiele (inkl. Routing, PKI, VHosts) siehe die Demos & Benutzung.


Modulübersicht

HTTP-Module (http_lib/)

Modul Zeilen Beschreibung
HTTP_Server.pbi ~5'190 Triple-Protocol Webserver (H1/H2/H3), Routing, VHosts, TLS, Auto-TLS
HTTP_Client.pbi ~2'660 Triple-Protocol Client, Downloads, Pooling, Protokoll-Fixierung
HTTP_PKI.pbi ~616 Interne PKI: Self-Signed, Root CA, Auto-TLS (V3.4)
HTTP_Protokoll.pbi ~1'172 Protocol Core: Methods, Status, URL, MIME, Pseudo-Headers
ACME_Protokoll.pbi ~2'324 Let's Encrypt ACME v2, HTTP-01/DNS-01, Auto-Renew
H2_Stream.pbi ~2'187 HTTP/2 Connection/Stream Manager, Flow-Control, Push
H2_Frame.pbi ~1'384 HTTP/2 Frame Parser & Builder (RFC 9113)
HPACK_Codec.pbi ~1'752 HTTP/2 Header-Kompression (RFC 7541)
H3_Stream.pbi ~1'411 HTTP/3 Session/Stream Manager (RFC 9114)
H3_Frame.pbi ~813 HTTP/3 Frame Parser & Builder
QPACK_Codec.pbi ~2'220 HTTP/3 Header-Kompression (RFC 9204)

NET-Module (net_lib/) — Separates Repository

14 Module (~20'240 Zeilen): NET_Core, NET_Server, NET_Client, TLS_OpenSSL, TLS_Dummy, QUIC_Native, QUIC_Perf, QUIC_Integration, NET_Metrics, NET_Shaping, NET_Multicast, NET_Discovery, Atomic_Ops, Lock-Free Queue. Siehe net_doc/README.md für Details.


Dokumentation

API-Referenz

Dokument Beschreibung
API-Referenz Übersicht und Einstiegspunkt
API-Standard HTTP_Server + HTTP_Client + ACME — alles was ein Anwender braucht
API-Experten Protokoll-Internals: H2/H3/HPACK/QPACK für Framework-Entwickler

Demos & Beispiele

Dokument Beschreibung
Demos & Benutzung Übersicht und Einstiegspunkt
Demo-Standard Quick Start, Routing, Static Files, VHosts, Client, ACME
Demo-Experten Triple-Protocol, SSE, Server Push, h2c, Protokoll-Fixierung

Tests

954/954 Tests bestanden (V3.4, März 2026):

Test Suite Tests Beschreibung
H1_HTTP_Protokoll_TestSuite 323 HTTP/1.1 Core, URL Encoding, MIME, Headers, H2/H3 Helpers
H2_TestSuite 501 HPACK, H2_Frame, Integration, RFC 9113 Compliance, Stress
V34_Routing_PKI_TestSuite 87 V3.4: Named Params, Wildcards, Spezifität, SNI, PKI
Upload_TestClient + Server 43 Binary Upload (0B10MB), Multipart, CRC32, Echo-Roundtrip, 413

Ausführung (erfordert C Backendpbcompilerc oder --backend c):

# V3.4 Tests
pbcompilerc http_tests/V34_Routing_PKI_TestSuite.pbi --thread --executable v34_test && ./v34_test

# H1 Protocol Tests
pbcompilerc http_tests/H1_HTTP_Protokoll_TestSuite.pbi --thread --executable h1_test && ./h1_test

# H2 Protocol Tests
pbcompilerc http_tests/H2_TestSuite.pbi --thread --executable h2_test && ./h2_test

# Upload Tests (Server + Client in separaten Terminals)
pbcompilerc http_tests/Upload_TestServer.pb --thread --executable upload_srv && ./upload_srv
pbcompilerc http_tests/Upload_TestClient.pb --thread --executable upload_cli && ./upload_cli

Hinweis: Der gesamte HTTP Stack benötigt den C Backend (pbcompilerc bzw. --backend c). Grund: atomic-ops.pbi verwendet C-Inline Atomics — darauf bauen Lock-Free Queue, NET_Core und der gesamte Stack auf.


Voraussetzungen

  • PureBasic 6.x (Linux x64, C Backendpbcompilerc / --backend c)
  • OpenSSL 3.5+ (für TLS und QUIC)
  • Linux mit epoll-Support (Kernel 2.6+, Kernel 4.18+ für QUIC GSO)

Lizenz

Dieses Projekt ist dual-lizenziert:

LGPL 2.1 (Open Source)

Für Open-Source-Projekte steht die Bibliothek unter der GNU Lesser General Public License v2.1 zur Verfügung. Du kannst die Bibliothek frei in eigenen Projekten verwenden, solange Änderungen an der Bibliothek selbst unter LGPL veröffentlicht werden.

Kommerzielle Lizenz

Für den Einsatz in proprietären oder Closed-Source-Projekten ohne LGPL-Pflichten ist eine kommerzielle Lizenz verfügbar.

📧 Kontakt: info@lihaso.ch


Entwicklung & Vibe Coding 🤖

Dieses Projekt wurde im Vibe-Coding-Stil entwickelt — in enger Zusammenarbeit zwischen Mensch und KI. Folgende KI-Assistenten waren am Entwicklungsprozess beteiligt:

KI-Assistent Anbieter
Claude Anthropic
Grok xAI
ChatGPT OpenAI
Mistral Mistral AI
DeepSeek DeepSeek
Qwen 2.5 Coder Alibaba (lokal via Ollama)

Vibe Coding = Der Mensch steuert Architektur, Design und Qualitätsanspruch. Die KI unterstützt bei Implementierung, Refactoring, Tests und Dokumentation. Das Ergebnis: Schnellere Iteration bei gleichbleibend hoher Code-Qualität.


Kontakt

Linder Hard- und Software René Linder

📧 info@lihaso.ch 🌐 lihaso.ch


Projektstruktur

.
├── README.md                          # Diese Datei
├── LICENSE                            # LGPL 2.1 Lizenztext
├── .gitignore
│
├── http_lib/                          # HTTP-Module (11 .pbi)
│   ├── HTTP_Server.pbi
│   ├── HTTP_Client.pbi
│   ├── HTTP_PKI.pbi                   # V3.4: Interne PKI, Self-Signed, Root CA
│   ├── HTTP_Protokoll.pbi
│   ├── ACME_Protokoll.pbi
│   ├── H2_Stream.pbi / H2_Frame.pbi / HPACK_Codec.pbi
│   └── H3_Stream.pbi / H3_Frame.pbi / QPACK_Codec.pbi
│
├── http_tests/                        # Testsuites & Test-Programme
│   ├── H1_HTTP_Protokoll_TestSuite.pbi   # 323 Tests
│   ├── H2_TestSuite.pbi                  # 501 Tests
│   ├── V34_Routing_PKI_TestSuite.pbi     # 87 Tests (V3.4)
│   ├── Upload_TestServer.pb / Upload_TestClient.pb  # 43 Tests
│   ├── H3_Frame_TestSuite.pbi / H3_Stream_TestSuite.pbi
│   ├── QPACK_TestSuite.pbi
│   └── client_*.pb / pb-wget.pb
│
├── http_doc/                          # HTTP-Dokumentation
│   ├── HTTP_API-Referenz.md           # Index → Standard + Experten
│   ├── HTTP_API-Standard.md           # Server + Client + ACME + PKI API
│   ├── HTTP_API-Experten.md           # H2/H3/HPACK/QPACK Internals
│   ├── HTTP_Demo-Benutzung.md         # Index → Standard + Experten
│   ├── HTTP_Demo-Standard.md          # Praxis-Beispiele
│   └── HTTP_Demo-Experten.md          # Fortgeschrittene Szenarien
│
├── net_lib/                           # NET Stack (separates Repository)
└── net_doc/                           # NET Dokumentation (separates Repository)